{"id":13499338,"url":"https://github.com/gaqzi/ansible-ssh-config","last_synced_at":"2025-03-29T04:31:09.649Z","repository":{"id":12045510,"uuid":"14631251","full_name":"gaqzi/ansible-ssh-config","owner":"gaqzi","description":"Letting Ansible manage ssh config","archived":true,"fork":false,"pushed_at":"2021-01-30T02:36:15.000Z","size":66,"stargazers_count":95,"open_issues_count":18,"forks_count":37,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-31T17:39:27.489Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/gaqzi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2013-11-22T22:35:06.000Z","updated_at":"2024-09-07T03:29:35.000Z","dependencies_parsed_at":"2022-08-19T04:40:55.285Z","dependency_job_id":null,"html_url":"https://github.com/gaqzi/ansible-ssh-config","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaqzi%2Fansible-ssh-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaqzi%2Fansible-ssh-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaqzi%2Fansible-ssh-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaqzi%2Fansible-ssh-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gaqzi","download_url":"https://codeload.github.com/gaqzi/ansible-ssh-config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140565,"owners_count":20729797,"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-07-31T22:00:32.315Z","updated_at":"2025-03-29T04:31:09.362Z","avatar_url":"https://github.com/gaqzi.png","language":"Python","funding_links":[],"categories":["Apps","Python"],"sub_categories":["`.ssh/config`"],"readme":"ansible-ssh-config\n==================\n\nTHIS MODULE HAS MIGRATED TO https://github.com/ansible-collections/community.general/blob/main/plugins/modules/system/ssh_config.py\nUse the community version instead.\n\nA module for Ansible for configuring ssh configuration files.\n\n# Why?\n\nWe have several libraries that carry shared functionality between\nprojects at work. These libraries are on GitHub and they're in their\nown repo. Our deploy users don't have access to every single repo but\nonly the ones they need to deploy a specific project.\n\nTo manage this we have added in fake hostnames to our ~/.ssh/config\nfiles on the line of:\n\n```\nHost: internal-lib.github.com\n  Hostname: github.com\n  IdentityFile: id_rsa.internal-lib\n```\n\nWhen I started out with Ansible I tried just adding in our lines\nwith [lineinfile], but it didn't work out for me since several lines\nneeded to be added.\n\n# Usage\n\nThe usage is fairly straightforward and it handles the normal use\ncases of adding, changing and removing hosts from your config file.\n\n```yaml\n- name: Add internal-lib.github.com to ssh config\n  ssh_config: host=internal-lib.github.com hostname=github.com\n              identity_file=id_rsa.internal-lib port=222 state=present\n- name: Remove old-internal-lib.github.com from ssh config\n  ssh_config: host=old-internal-lib.github.com state=absent\n```\n\nFor the full set of options please look at the top of the module file.\n\n# Installation\n\n**Note**: The module needs to be installed into your library folder for\nAnsible to pick it up.\n\n## Requirements file\n\nAdd the following line to your `requirements.yml`:\n\n```yaml\n- src: gaqzi.ssh-config\n  path: library/\n```\n\n## Ansible Galaxy\nAlternatively install it from [Ansible Galaxy] by doing:\n\n```shell\n$ ansible-galaxy install gaqzi.ssh-config -p library/\n```\n\nYour directory structure should then look like this:\n\n```\n.\n├── library\n│   └── gaqzi.ssh-config\n│       ├── CHANGELOG.md\n│       ├── library\n│       │   └── ssh_config.py\n│       ├── meta\n│       │   └── main.yml\n│       └── README.md\n└── site.yml\n```\n\n## Manual\nCopy `ssh_config` into the library directory at the root of your Playbook.\n\n```\n.\n├── library\n│   └── ssh_config\n└── site.yml\n```\n\n# Credits\n\nFor managing the config files I blatantly copied `ConfigParser`\nfrom [stormssh] and [paramiko] which implemented all the functionality,\nbut since I want to keep everything in one file to be easily\nreusable/shareable with Ansible we ended up here.\n\n[lineinfile]: http://www.ansibleworks.com/docs/modules.html#lineinfile\n[stormssh]: https://github.com/emre/storm/\n[paramiko]: https://github.com/paramiko/paramiko\n[Ansible Galaxy]: https://galaxy.ansible.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaqzi%2Fansible-ssh-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaqzi%2Fansible-ssh-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaqzi%2Fansible-ssh-config/lists"}