Skip to content

stan-smith/AnsiScale

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

AnsiScale

🪄 Auto-magically Generate Ansible Inventory Files From Your Tailnet 🪄

AnsiScale uses the a mixture between Tailscale ACL tags and Custom assigned values

(which can be assigned en-masse using the auto tagger - https://github.com/xkz0/tailscale-auto-tagger)

All you need to do is generate an API key at the link below and then enter it when the script opens.

https://login.tailscale.com/admin/settings/keys

AnsiScale then looks at your Tailnet by using two methods:
ACL Tags - You will be given suggested names for your parent/child inventory values based on the ACL tags you have set (you can also use custom values)
Custom Tags - If you have given custom attributes using either the TS API or my Auto-Tagger, then you can use those to generate parent/child names as well
Once you have selected either tags/custom tags, the script will then generate you an inventory.yaml file with all of the associated hosts inside their respective groups
You also have the option to add in your ssh keys to the inventory file, this will follow the pattern generated by my ssh_key_management tool

(https://github.com/xkz0/ssh_key_management)

I want to state none of this is revolutionary, I just manage hundreds of devices at work and my inventory is constantly increasing/changing so this makes it very easy to capture changes I've missed.

Here's an example inventory generated in about 30 seconds:

# Ansible inventory generated from custom data
---
servers:
  children:
    group_a:
      hosts:
          server-001.example.com:
            ansible_ssh_private_key_file: /path/to/ssh_keys/id_rsa_server-001.example.com
            ansible_user: user
          server-002.example.com:
            ansible_ssh_private_key_file: /path/to/ssh_keys/id_rsa_server-002.example.com
            ansible_user: user
          server-003.example.com:
            ansible_ssh_private_key_file: /path/to/ssh_keys/id_rsa_server-003.example.com
            ansible_user: user
          server-004.example.com:
            ansible_ssh_private_key_file: /path/to/ssh_keys/id_rsa_server-004.example.com
            ansible_user: user
          server-005.example.com:
            ansible_ssh_private_key_file: /path/to/ssh_keys/id_rsa_server-005.example.com
            ansible_user: user

    group_b:
      hosts:
          server-006.example.com:
            ansible_ssh_private_key_file: /path/to/ssh_keys/id_rsa_server-006.example.com
            ansible_user: user
          server-007.example.com:
            ansible_ssh_private_key_file: /path/to/ssh_keys/id_rsa_server-007.example.com
            ansible_user: user
          server-008.example.com:
            ansible_ssh_private_key_file: /path/to/ssh_keys/id_rsa_server-008.example.com
            ansible_user: user
          server-009.example.com:
            ansible_ssh_private_key_file: /path/to/ssh_keys/id_rsa_server-009.example.com
            ansible_user: user
          server-010.example.com:
            ansible_ssh_private_key_file: /path/to/ssh_keys/id_rsa_server-010.example.com
            ansible_user: user

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages