{"id":15292052,"url":"https://github.com/mihaitodor/wormhole","last_synced_at":"2025-05-07T04:04:21.964Z","repository":{"id":57613563,"uuid":"164487927","full_name":"mihaitodor/wormhole","owner":"mihaitodor","description":"A minimalistic Ansible-like tool for configuring remote servers via ssh","archived":false,"fork":false,"pushed_at":"2019-06-30T11:51:49.000Z","size":98,"stargazers_count":25,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T04:04:15.866Z","etag":null,"topics":["ansible","configuration","playbook","remote","ssh"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mihaitodor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-07T20:11:50.000Z","updated_at":"2024-12-27T09:24:38.000Z","dependencies_parsed_at":"2022-09-03T18:10:13.268Z","dependency_job_id":null,"html_url":"https://github.com/mihaitodor/wormhole","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaitodor%2Fwormhole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaitodor%2Fwormhole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaitodor%2Fwormhole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaitodor%2Fwormhole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mihaitodor","download_url":"https://codeload.github.com/mihaitodor/wormhole/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252810270,"owners_count":21807759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","configuration","playbook","remote","ssh"],"created_at":"2024-09-30T16:16:20.258Z","updated_at":"2025-05-07T04:04:21.945Z","avatar_url":"https://github.com/mihaitodor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wormhole\n\n## Introduction\n\nWormhole is a minimalistic [ansible](https://www.ansible.com/)-like tool.\n\nIt is designed to read a list of servers from [inventory.yaml](inventory.yaml) and run on each of them a playbook, for example [wormhole.yaml](playbooks/wormhole.yaml).\n\n## Features\n\n- Connections to remote servers are performed via `ssh` using username/password authentication.\n- The `scp` protocol is used for copying files on remote servers.\n- Early playbook cancellation via SIGINT (Ctrl+C) / SIGTERM. The application will exit almost immediately.\n- Parallel execution on multiple hosts.\n- Super-fast build and execution times.\n\n## Build instructions\n\nFirst, run `bootstrap.sh` to check dependencies and fetch the required version of Go. Afterwards, run `build.sh` to build and test the code. The main executable will be generated in `./wormhole`.\n\nPlease note that both `gcc` and `git` need to be installed on the system.\n\nThis project has been tested on both OSX and Ubuntu.\n\n### Test against a Docker container\n\n```Shell\n\u003e sudo docker run --rm -p2222:22 -p80:80 rastasheep/ubuntu-sshd:14.04\n\n\u003e cat inventory.yaml\n---\n\n- host: localhost\n  port: 2222\n  username: root\n  password: root\n\n\u003e ./wormhole playbooks/wormhole.yaml\nINFO[0000] Running playbook on servers: localhost:2222\nINFO[0000] Running task [1/6] on \"localhost:2222\": Install Apache and PHP\nINFO[0015] Running task [2/6] on \"localhost:2222\": Configure Apache ServerName\nINFO[0015] Running task [3/6] on \"localhost:2222\": Configure Apache default site\nINFO[0015] Running task [4/6] on \"localhost:2222\": Restart Apache\nINFO[0017] Running task [5/6] on \"localhost:2222\": Copy index.php\nINFO[0017] Running task [6/6] on \"localhost:2222\": Validate host\nINFO[0017] Playbook ran successfully on servers: localhost:2222\n```\n\n### Code linter\n\nDone via [`golangci-lint run`](https://github.com/golangci/golangci-lint).\n\n## Usage\n\nFor typical usage, add your servers to `inventory.yaml` and run `./wormhole path/to/playbook.yaml`.\n\nUse `./wormhole --help` to get quick information about the rest of the parameters, which are optional.\n\n### Optional command line parameters\n\n- `-i` - The path to the server inventory file (default `inventory.yaml`), which is a Yaml sequence, each sequence item containing the connection details of a distinct server. Example server definition:\n\n```YAML\n- host: \"ec2-127-0-0-1.compute-1.amazonaws.com\"\n  port: 22\n  username: ubuntu\n  password: \"Passw0rd!\"\n```\n\n- `-c` - The connection timeout for the ssh connection to the remote host\n\n- `-e` - The execution timeout for each command that will run via ssh\n\n- `-m` - The maximum number of servers on which the playbook will be executed in parallel\n\n### Playbooks\n\nA playbook contains a list of named tasks that are executed in sequence on each server. Each task consists of a collection of actions.\n\nFor a detailed playbook example, please check [wormhole.yaml](playbooks/wormhole.yaml).\n\nCurrently, the following actions are implemented:\n\n#### File action\n\nCopies a local file, `src`, to `dest` on a remote server with the specified owner, owner group and mode. Example playbook definition:\n\n```YAML\n- name: Copy test.txt\n  file:\n    src:   files/test.txt\n    dest:  /tmp/test.txt\n    owner: root\n    group: root\n    mode:  \"0644\"\n```\n\n#### Apt action\n\nExecutes `apt-get update` and then `apt-get \u003cinstall/remove\u003e -y \u003cpackage\u003e` for each specified package on the remote server. Example playbook definition:\n\n```YAML\n- name: Install Apache and PHP\n  apt:\n    state: install\n    pkg:\n      - apache2\n      - php5\n```\n\n#### Service action\n\nExecutes `service \u003cservice_name\u003e \u003cstart/stop/restart\u003e` on the remote server. Example playbook definition:\n\n```YAML\n- name: Restart Apache\n  service:\n    name: apache2\n    state: restart\n```\n\n#### Shell action\n\nExecutes a shell command on the remote server. Example playbook definition:\n\n```YAML\n- name: Enable servername.conf for Apache\n  shell: \"a2enconf -q servername\"\n```\n\n#### Validate action\n\nValidates that a remote server can be reached on a given `port` after at most `retries` attempts. Each attempt needs to respond within the specified `timeout` with the specified `status_code` and `body_content`. Example playbook definition:\n\n```YAML\n- name: Validate host\n  validate:\n    scheme:       http\n    port:         80\n    url_path:     \"/\"\n    retries:      3\n    timeout:      3s\n    status_code:  200\n    body_content: \"Hello, world!\"\n```\n\n## TODO\n\n- [ ] Integration tests against a Docker container\n- [ ] Continuous integration\n- [ ] Support for ActionFileTemplate using Go's package template\n- [ ] Verbose mode: Copy and print stdout and stderr from the remote process\n- [ ] Better user input validation for the playbook and the inventory\n- [ ] More unit tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihaitodor%2Fwormhole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmihaitodor%2Fwormhole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihaitodor%2Fwormhole/lists"}