Autonomous Ansible Hosts File Management Server

Antsible runs a server to listen for incoming hosts to add to your /etc/ansible/hosts file. It maintains the proper groups each host should belong to and keeps them organized.


  • Download antsible.py, server.py and sabi.py to the same directory
    • Using wget:
      • wget https://raw.githubusercontent.com/sabi/sabi/main/sabi.py
      • wget https://raw.githubusercontent.com/sabi/antsible/main/server.py
      • wget https://raw.githubusercontent.com/sabi/antsible/main/antsible.py
    • Using curl:
      • curl https://raw.githubusercontent.com/sabi/sabi/main/sabi.py > sabi.py
      • curl https://raw.githubusercontent.com/sabi/antsible/main/antsible.py > antsible.py
      • curl https://raw.githubusercontent.com/sabi/antsible/main/server.py > server.py
  • Install python3, python3-pip
    • sudo apt install python3 python3-pip
  • Install Flask and Gunicorn
    • pip3 install flask gunicorn
  • Install Antsible
    • sudo python3 antsible.py install
  • Start server
    • sudo gunicorn --bind -w 4 server.py

Use via Command Line

  • antsible host
  • antsible host group1 group2 group3
  • ants host group1

Use via curl (for remote usage)

  • curl http://server_ip:port_number/<host>/<group1+group2+group3>
  • Ex: curl http://example_domain:11110/sabipc/dev-servers+ubuntu-servers
    • Note: Multiple groups should be separated with a + delimiter