[hosts] switch to yaml format

This commit is contained in:
bronsen 2025-03-02 11:48:46 +01:00
parent 0a44247e74
commit e391518581
3 changed files with 29 additions and 26 deletions

View file

@ -1,4 +1,4 @@
[defaults]
inventory = hosts.ini
inventory = hosts.yaml
gathering = smart
transport = ssh

View file

@ -1,25 +0,0 @@
; Group named "multi"
[multi:children]
application_servers
database_servers
; Variables that will be applied to all servers in group "multi"
[multi:vars]
ansible_host = 127.0.0.1
ansible_ssh_user = vagrant
ansible_ssh_private_key_file = /home/bronsen/.local/share/vagrant/insecure_private_keys/vagrant.key.rsa
ansible_ssh_host_key_checking = false
ansible_ssh_common_args = -o DSAAuthentication=yes -o IdentitiesOnly=yes -o PubkeyAcceptedKeyTypes=+ssh-rsa -o HostKeyAlgorithms=+ssh-rsa
; hide all warnings regarding the discovered python interpreters on the remote side
; https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html
ansible_python_interpreter = auto_silent
; hostnames are resolved via dns, see Vagrantfile for actual IP addresses
[application_servers]
app1 ansible_ssh_port=2222
app2 ansible_ssh_port=2200
[database_servers]
db ansible_ssh_port=2201 ansible_become_user=postgres

28
hosts.yaml Normal file
View file

@ -0,0 +1,28 @@
multi:
vars:
ansible_host: "127.0.0.1"
ansible_ssh_user: "vagrant"
ansible_ssh_private_key_file: "/home/bronsen/.local/share/vagrant/insecure_private_keys/vagrant.key.rsa"
ansible_ssh_host_key_checking: false
ansible_ssh_common_args: "-o DSAAuthentication=yes -o IdentitiesOnly=yes -o PubkeyAcceptedKeyTypes=+ssh-rsa -o HostKeyAlgorithms=+ssh-rsa"
# hide all warnings regarding the discovered python interpreters on the remote side
# https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html
ansible_python_interpreter: "auto_silent"
children:
application_servers:
database_servers:
application_servers:
hosts:
app1:
ansible_ssh_port: 2222
app2:
ansible_ssh_port: 2200
database_servers:
hosts:
db:
ansible_ssh_port: 2201
ansible_become_user: "postgres"