Name | ansible-inventory-to-ssh-config JSON |
Version |
1.1.2
JSON |
| download |
home_page | None |
Summary | Generate ssh config file from Ansible inventory |
upload_time | 2024-08-26 01:26:29 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2020 Yioda Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
egg
bacon
sausage
tomatoes
lobster thermidor
|
VCS |
|
bugtrack_url |
|
requirements |
ansible
sshconf
setuptools-scm
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[![PyPI version](https://img.shields.io/pypi/v/ansible-core.svg)](https://pypi.org/project/ansible-core)
[![Pylint check](https://github.com/yioda/ansible-inventory-to-ssh-config/actions/workflows/pylint.yml/badge.svg)](https://github.com/yioda/ansible-inventory-to-ssh-config/actions/workflows/pylint.yml)
[![PyPI pulish](https://github.com/yioda/ansible-inventory-to-ssh-config/actions/workflows/publish-to-pypi.yml/badge.svg)](https://github.com/yioda/ansible-inventory-to-ssh-config/actions/workflows/publish-to-pypi.yml)
# Ansible inventory file to ssh config
This is a Python tool for updating the SSH config from the Ansible inventory file.
## Dependencies
- [ansible>=2.10.7](https://pypi.org/project/ansible/2.10.5/)
- [sshconf==0.2.5](https://pypi.org/project/sshconf/0.2.5/)
## Install
> [!WARNING]
> This project would install Ansible with the specified version metioned above, be careful that might conflict with the version you are using currently.
> You might need a separated env for this tool, for example:
> ``` console
> $ mkdir foo;cd foo
> foo$ pyenv virtualenv 3.11.4 bar;pyenv local bar
> (bar)foo$
> ```
``` bash
$ pip install ansible-inventory-to-ssh-config
```
From Github:
``` bash
$ pip install git+https://github.com/yioda/ansible-inventory-to-ssh-config
```
Local install
``` bash
$ git clone https://github.com/yioda/ansible-inventory-to-ssh-config.git
$ pip install .
```
## Usage
``` bash
$ aitsc -h # or ansible-inventory-to-ssh-config -h
usage: aitsc [-h] [-v] [-o OUTPUT] [-d] [-b] [-O] inventory_file
positional arguments:
inventory_file ansible inventory file
options:
-h, --help show this help message and exit
-v, --version show program version number and exit
-o OUTPUT, --output OUTPUT
ssh config output path (default: ~/.ssh/config.ansible)
-d, --dry-run show new configurations without updating file
-b, --with-backup update with backup
-O, --override override whole config, this would remove those hosts undefined in playbook
# Update ~/.ssh/config.ansible from specified inventory file
$ aitsc $INVENTORY_FILE
# Update with backup
$ aitsc $INVENTORY_FILE --with-backup
# Output as a new file
$ aitsc $INVENTORY_FILE -o new_ssh_config
# Show content without output
$ aitsc $INVENTORY_FILE -d
# Override while config
$ aitsc $INVENTORY_FILE -O
```
## Example
``` bash
# Input (Inventory File)
$ cat hosts
[group_1]
node1 ansible_ssh_host=192.168.0.5
node2 ansible_ssh_host=192.168.0.6
[group_2]
node3 ansible_host=192.168.0.7 ansible_ssh_private_key_file=~/.ssh/id_rsa_for_ansible
node4 ansible_host=192.168.0.8 ansible_port=10422 ansible_user=foo
# Commnad
$ aitsc hosts -o newconfig
Inventory: hosts
Target: newconfig
# Output (SSH Config Format)
$ cat new_ssh_config
Host node1
HostName 192.168.0.5
Host node2
HostName 192.168.0.6
Host node3
HostName 192.168.0.7
IdentityFile ~/.ssh/id_rsa_for_ansible
Host node4
HostName 192.168.0.8
Port 10422
User foo
```
Raw data
{
"_id": null,
"home_page": null,
"name": "ansible-inventory-to-ssh-config",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Yioda <jyc180g@gmail.com>",
"keywords": "egg, bacon, sausage, tomatoes, Lobster Thermidor",
"author": null,
"author_email": "Yioda <jyc180g@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/2a/10/0ff409b9856d32a5b263f04a25c7d8d5d04b3596cdd1ce67cc5592e3b11d/ansible_inventory_to_ssh_config-1.1.2.tar.gz",
"platform": null,
"description": "[![PyPI version](https://img.shields.io/pypi/v/ansible-core.svg)](https://pypi.org/project/ansible-core)\n[![Pylint check](https://github.com/yioda/ansible-inventory-to-ssh-config/actions/workflows/pylint.yml/badge.svg)](https://github.com/yioda/ansible-inventory-to-ssh-config/actions/workflows/pylint.yml)\n[![PyPI pulish](https://github.com/yioda/ansible-inventory-to-ssh-config/actions/workflows/publish-to-pypi.yml/badge.svg)](https://github.com/yioda/ansible-inventory-to-ssh-config/actions/workflows/publish-to-pypi.yml)\n\n# Ansible inventory file to ssh config\nThis is a Python tool for updating the SSH config from the Ansible inventory file.\n\n## Dependencies\n\n- [ansible>=2.10.7](https://pypi.org/project/ansible/2.10.5/)\n- [sshconf==0.2.5](https://pypi.org/project/sshconf/0.2.5/)\n\n## Install\n\n> [!WARNING]\n> This project would install Ansible with the specified version metioned above, be careful that might conflict with the version you are using currently.\n> You might need a separated env for this tool, for example:\n> ``` console\n> $ mkdir foo;cd foo\n> foo$ pyenv virtualenv 3.11.4 bar;pyenv local bar\n> (bar)foo$\n> ```\n\n``` bash\n$ pip install ansible-inventory-to-ssh-config\n```\n\nFrom Github:\n\n``` bash\n$ pip install git+https://github.com/yioda/ansible-inventory-to-ssh-config\n```\n\nLocal install\n\n``` bash\n$ git clone https://github.com/yioda/ansible-inventory-to-ssh-config.git\n$ pip install .\n```\n\n## Usage\n\n``` bash\n$ aitsc -h # or ansible-inventory-to-ssh-config -h\nusage: aitsc [-h] [-v] [-o OUTPUT] [-d] [-b] [-O] inventory_file\n\npositional arguments:\n inventory_file ansible inventory file\n\noptions:\n -h, --help show this help message and exit\n -v, --version show program version number and exit\n -o OUTPUT, --output OUTPUT\n ssh config output path (default: ~/.ssh/config.ansible)\n -d, --dry-run show new configurations without updating file\n -b, --with-backup update with backup\n -O, --override override whole config, this would remove those hosts undefined in playbook\n\n\n# Update ~/.ssh/config.ansible from specified inventory file\n$ aitsc $INVENTORY_FILE\n\n# Update with backup\n$ aitsc $INVENTORY_FILE --with-backup\n\n# Output as a new file\n$ aitsc $INVENTORY_FILE -o new_ssh_config\n\n# Show content without output\n$ aitsc $INVENTORY_FILE -d\n\n# Override while config\n$ aitsc $INVENTORY_FILE -O\n```\n\n## Example\n\n``` bash\n# Input (Inventory File)\n$ cat hosts\n\n[group_1]\nnode1 ansible_ssh_host=192.168.0.5\nnode2 ansible_ssh_host=192.168.0.6\n\n[group_2]\nnode3 ansible_host=192.168.0.7 ansible_ssh_private_key_file=~/.ssh/id_rsa_for_ansible\nnode4 ansible_host=192.168.0.8 ansible_port=10422 ansible_user=foo\n\n# Commnad\n$ aitsc hosts -o newconfig\nInventory: hosts\nTarget: newconfig\n\n# Output (SSH Config Format)\n$ cat new_ssh_config\n\nHost node1\n HostName 192.168.0.5\n\n\nHost node2\n HostName 192.168.0.6\n\n\nHost node3\n HostName 192.168.0.7\n IdentityFile ~/.ssh/id_rsa_for_ansible\n\n\nHost node4\n HostName 192.168.0.8\n Port 10422\n User foo\n```\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2020 Yioda Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Generate ssh config file from Ansible inventory",
"version": "1.1.2",
"project_urls": {
"Documentation": "https://github.com/yioda/ansible-inventory-to-ssh-config",
"Homepage": "https://github.com/yioda/ansible-inventory-to-ssh-config",
"Repository": "https://github.com/yioda/ansible-inventory-to-ssh-config.git"
},
"split_keywords": [
"egg",
" bacon",
" sausage",
" tomatoes",
" lobster thermidor"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "07c7664682731f22835057b131b1c6e3ebefb56f8f5d2322cfa6656fc8223ee6",
"md5": "8a4625493eacd44364d4c943381735d5",
"sha256": "bc9fb87560c93dc9ecae2fb09a378c031e9f2500159b2e5fd65a73ce65349bf2"
},
"downloads": -1,
"filename": "ansible_inventory_to_ssh_config-1.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8a4625493eacd44364d4c943381735d5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5775,
"upload_time": "2024-08-26T01:26:27",
"upload_time_iso_8601": "2024-08-26T01:26:27.817555Z",
"url": "https://files.pythonhosted.org/packages/07/c7/664682731f22835057b131b1c6e3ebefb56f8f5d2322cfa6656fc8223ee6/ansible_inventory_to_ssh_config-1.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2a100ff409b9856d32a5b263f04a25c7d8d5d04b3596cdd1ce67cc5592e3b11d",
"md5": "4605a5fe25b27bdc2ede390e748c082d",
"sha256": "3a8bf440c92836c8348643349477263c0532050cf9baa374b4631f8e12b2d08d"
},
"downloads": -1,
"filename": "ansible_inventory_to_ssh_config-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "4605a5fe25b27bdc2ede390e748c082d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 8290,
"upload_time": "2024-08-26T01:26:29",
"upload_time_iso_8601": "2024-08-26T01:26:29.408351Z",
"url": "https://files.pythonhosted.org/packages/2a/10/0ff409b9856d32a5b263f04a25c7d8d5d04b3596cdd1ce67cc5592e3b11d/ansible_inventory_to_ssh_config-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-26 01:26:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yioda",
"github_project": "ansible-inventory-to-ssh-config",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "ansible",
"specs": [
[
">=",
"2.10.7"
]
]
},
{
"name": "sshconf",
"specs": [
[
"==",
"0.2.5"
]
]
},
{
"name": "setuptools-scm",
"specs": []
}
],
"lcname": "ansible-inventory-to-ssh-config"
}