https://github.com/m4wh6k/ansible-tailscale-inventory
Dynamic Ansible inventory for your Tailscale hosts
https://github.com/m4wh6k/ansible-tailscale-inventory
ansible ansible-inventory tailscale
Last synced: 2 months ago
JSON representation
Dynamic Ansible inventory for your Tailscale hosts
- Host: GitHub
- URL: https://github.com/m4wh6k/ansible-tailscale-inventory
- Owner: m4wh6k
- License: mit
- Created: 2022-06-07T01:54:22.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-18T16:53:23.000Z (4 months ago)
- Last Synced: 2025-04-09T17:14:22.845Z (2 months ago)
- Topics: ansible, ansible-inventory, tailscale
- Language: Python
- Homepage:
- Size: 23.4 KB
- Stars: 49
- Watchers: 4
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ansible-tailscale-inventory
Dependency-free dynamic Ansible inventory for your Tailscale hosts. Allows you to reach your Tailscale hosts easily with
Ansible. All you need is Tailscale installed and working, python 3.8+, and a copy of `ansible_tailscale_inventory.py`
from this repo.## Usage
From one of your Tailscale nodes on your network, make `ansible_tailscale_inventory.py` available as an inventory to
Ansible. This can be done as an argument to the `-i` option on Ansible commands, or by setting the `ANSIBLE_INVENTORY`
environment variable's value as the path to the script.Notes:
- At the time of writing, the inventory script has been tested with macOS and Linux, but not Windows.
- If you copy/paste the script from GitHub rather than cloning the repo and copying the file, ensure the script is
marked as an executable.## Ansible Groups
`ansible_tailscale_inventory.py` automatically provides a few groups.
- There are groups of hosts for each operating system (`macOS`, `linux`, etc)
- Online hosts are found in the `online` group, offline hosts in the `offline` group
- The `self` group includes the local host
- Each Tailscale tag that has at least one host will be a group as well. The name will be formatted as `tag_TagName`
(`-` and `:` characters will be replaced with underscores)## Inventory Metadata
The inventory automatically adds all available Tailscale IPs as a list in the fact `tailscale_ips`.
## Contributing
Check out the [contributing doc](CONTRIBUTING.md).