{"id":19516120,"url":"https://github.com/deviantony/foreman-ssh","last_synced_at":"2025-02-25T23:44:07.832Z","repository":{"id":32245151,"uuid":"35819426","full_name":"deviantony/foreman-ssh","owner":"deviantony","description":"Query the Foreman API to exec commands via SSH on a host list.","archived":false,"fork":false,"pushed_at":"2015-06-24T08:49:42.000Z","size":156,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-01-08T12:38:28.005Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deviantony.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-18T13:27:03.000Z","updated_at":"2015-05-18T15:58:42.000Z","dependencies_parsed_at":"2022-09-19T00:51:12.324Z","dependency_job_id":null,"html_url":"https://github.com/deviantony/foreman-ssh","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/deviantony%2Fforeman-ssh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviantony%2Fforeman-ssh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviantony%2Fforeman-ssh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviantony%2Fforeman-ssh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deviantony","download_url":"https://codeload.github.com/deviantony/foreman-ssh/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240766672,"owners_count":19854114,"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":[],"created_at":"2024-11-10T23:44:36.983Z","updated_at":"2025-02-25T23:44:07.795Z","avatar_url":"https://github.com/deviantony.png","language":"Python","readme":"# Foreman SSH\n\nA tool to trigger SSH commands against a host list retrieved via the Foreman API (it will force the use of the API version 2).\n\n# Usage\n\nUse the binary to request a list of host against the Foreman API and run a command against them. By default, it will retrieve the 50 first hosts sorted by alphabetical order.\n\nThe following will execute the command \"ls /tmp\" against the 50 first hosts sorted by alphabetical order:\n\n````\n$ foreman-ssh http://foreman.domain/api \"ls /tmp\" --foreman-user user --foreman-password password\n````\n\n## Dry-run\n\nYou can specify the `--dry-run` flag to specify that you do not want to execute the command on the host list. Instead it will print the list of targeted hosts, use this if you want to be sure of the host list.\n\n````\n$ foreman-ssh http://foreman.domain/api \"ls /tmp\" --foreman-user user --foreman-password password --dry-run\n````\n\n## Foreman related options\n\nYou can specify a search query (using the syntax you would use in the Foreman UI):\n\n````\n$ foreman-ssh http://foreman.domain/api \"ls /tmp\" --foreman-user user --foreman-password password --foreman-search \"hostgroup_fullname  = myHostGroup\"\n````\n\n## SSH related options\n\nBy default, SSH will use the user who started the binary to run distant commands.\n\n### Authentication\n\nYou can specify another user/password for the SSH authentication:\n\n````\n$ foreman-ssh http://foreman.domain/api \"ls /tmp\" --foreman-user user --foreman-password password --foreman-search \"hostgroup_fullname  = myHostGroup\" --ssh-user myUser --ssh-password myPassword\n````\n\n### Connection retries\n\nIn case of connection error, the binary will retry to connect to the host up to three 3 times. Use the `--ssh-retry` option to change that value:\n\n````\n$ foreman-ssh http://foreman.domain/api \"ls /tmp\" --foreman-user user --foreman-password password --foreman-search \"hostgroup_fullname  = myHostGroup\" --ssh-user myUser --ssh-password myPassword --ssh-retry 1\n````\n\n### Timeout\n\nAny SSH connection will timeout after 5 secs, you can change this value using the `--ssh-timeout` option:\n\n````\n$ foreman-ssh http://foreman.domain/api \"ls /tmp\" --foreman-user user --foreman-password password --foreman-search \"hostgroup_fullname  = myHostGroup\" --ssh-user myUser --ssh-password myPassword --ssh-retry 1 --ssh-timeout 10\n````\n\n### Command parallelization\n\nThe SSH client will run command in parallel using a pool of 10 hosts by default. You can update this value using the `--ssh-parallel-count` option:\n\n````\n$ foreman-ssh http://foreman.domain/api \"ls /tmp\" --foreman-user user --foreman-password password --foreman-search \"hostgroup_fullname  = myHostGroup\" --ssh-user myUser --ssh-password myPassword --ssh-retry 1 --ssh-timeout 10 --ssh-parallel-count 50\n````\n\n# Development \n\nEnsure you have a Python 2.7 environment running.\n\nInstall the dependencies:\n\n````\n$ pip install -r requirements.txt\n````\n\nCreate the binary:\n\n````\npip install --editable .\n````\n\n# Limitations\n\nThis tool has been tested on the following OSes:\n\n* Ubuntu 12.04\n* Ubuntu 14.04\n\nIt supports the following Python versions:\n\n* 2.7\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeviantony%2Fforeman-ssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeviantony%2Fforeman-ssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeviantony%2Fforeman-ssh/lists"}