From e3915185813935ae6bfd23d0b5d90899c82af9b2 Mon Sep 17 00:00:00 2001
From: bronsen <kontakt+gitcommit@nrrd.de>
Date: Sun, 2 Mar 2025 11:48:46 +0100
Subject: [PATCH] [hosts] switch to yaml format

---
 ansible.cfg |  2 +-
 hosts.ini   | 25 -------------------------
 hosts.yaml  | 28 ++++++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 26 deletions(-)
 delete mode 100644 hosts.ini
 create mode 100644 hosts.yaml

diff --git a/ansible.cfg b/ansible.cfg
index 8737919..4992475 100644
--- a/ansible.cfg
+++ b/ansible.cfg
@@ -1,4 +1,4 @@
 [defaults]
-inventory = hosts.ini
+inventory = hosts.yaml
 gathering = smart
 transport = ssh
diff --git a/hosts.ini b/hosts.ini
deleted file mode 100644
index d20eff9..0000000
--- a/hosts.ini
+++ /dev/null
@@ -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
diff --git a/hosts.yaml b/hosts.yaml
new file mode 100644
index 0000000..58a414c
--- /dev/null
+++ b/hosts.yaml
@@ -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"
+