Git Product home page Git Product logo

simple-ansible-connection-plugin's Introduction

Simple Ansible Connection Plugin

A simple Ansible connection plugin that uses gRPC. This project includes both client and server implementations.

Features

  • gRPC-based connection plugin for Ansible
  • SSH key-based authentication
  • Dynamic SSH key reloading
  • Support for user-specific environment variables
  • Systemd service configuration for gRPC server

Installation

  1. Clone the repository:

    git clone https://github.com/HZ89/simple-ansible-connection-plugin.git
    cd simple-ansible-connection-plugin
  2. Build the project:

    make
  3. Ensure the required Python packages are installed:

    pip install paramiko grpcio

Configuration

Dockerfile

  • The Dockerfile uses the golang:1.22-buster base image. If this image is not accessible, replace it with any suitable Golang image from Docker Hub.

gRPC Plugin Enhancements

  • The plugin now includes improved SSH key handling and error management.
  • The grpc_plugin.py script fetches SSH keys and handles multiple keys dynamically.
  • The SSHAuthenticator class in ssh_key.go uses fsnotify to monitor changes in the authorized keys file and reload keys automatically.
  • The main server code has been updated to parse structured metadata for authentication and support user-specific environment variables during command execution.
  • Home directory tilde expansion is implemented for file paths in PutFile and FetchFile methods.

Systemd Service

  • A systemd service file ansible-grpc-connection-server.service is added to manage the gRPC server as a systemd service.

Usage

  1. Start the gRPC server:

    ./target/ansible-grpc-connection-server --v 3 -l ":60051"
  2. Configure the client to connect to the gRPC server by setting the appropriate connection parameters in your Ansible playbook.

Systemd Service Setup

  1. Copy the systemd service file to /etc/systemd/system/:

    cp utils/ansible-grpc-connection-server.service /etc/systemd/system/
  2. Reload systemd manager configuration:

    systemctl daemon-reload
  3. Enable and start the service:

    systemctl enable ansible-grpc-connection-server
    systemctl start ansible-grpc-connection-server

Contributing

Contributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.

License

This project is licensed under the MIT License.

simple-ansible-connection-plugin's People

Contributors

hz89 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.