From 075b5bd00845ca3ae41ebd22568c93184cf2292c Mon Sep 17 00:00:00 2001 From: Alexander Dietrich Date: Mon, 23 Mar 2020 21:17:56 +0100 Subject: [PATCH] Move inventory to separate directory --- README.md | 30 ++++++--------------- default.nix | 16 ----------- {group_vars => inventory/group_vars}/all | 0 {group_vars => inventory/group_vars}/ffhh | 0 {group_vars => inventory/group_vars}/vms | 0 {host_vars => inventory/host_vars}/gw03-new | 0 {host_vars => inventory/host_vars}/srv01 | 0 {host_vars => inventory/host_vars}/srv02 | 0 {host_vars => inventory/host_vars}/srv03 | 0 {host_vars => inventory/host_vars}/srv04 | 0 production => inventory/hosts | 0 requirements.txt | 2 -- site | 2 +- 13 files changed, 9 insertions(+), 41 deletions(-) delete mode 100644 default.nix rename {group_vars => inventory/group_vars}/all (100%) rename {group_vars => inventory/group_vars}/ffhh (100%) rename {group_vars => inventory/group_vars}/vms (100%) rename {host_vars => inventory/host_vars}/gw03-new (100%) rename {host_vars => inventory/host_vars}/srv01 (100%) rename {host_vars => inventory/host_vars}/srv02 (100%) rename {host_vars => inventory/host_vars}/srv03 (100%) rename {host_vars => inventory/host_vars}/srv04 (100%) rename production => inventory/hosts (100%) delete mode 100644 requirements.txt diff --git a/README.md b/README.md index 8d38269..52bfb8f 100644 --- a/README.md +++ b/README.md @@ -2,32 +2,18 @@ ## Vorraussetzungen -[Ansible][] wird nicht auf den Hosts installiert, sondern muss auf dem jeweiligen -Rechner, von dem aus die Hosts verwaltet werden sollen installiert werden. +[Ansible][] muß auf dem Rechner installiert sein, von dem aus die Hosts +verwaltet werden sollen. Zu den Hosts ist SSH-Zugang mit sudo-Rechten +erforderlich. -Ansible kann zusammen mit den benötigten Abhängigkeiten wie folgt installiert -werden: +[Ansible]: https://docs.ansible.com/ansible/ - pip install -r requirements.txt - -Unter NixOS kann alternativ über die default.nix eine nix-shell erzeugt werden: - - nix-shell - - [Ansible]: https://docs.ansible.com/ansible/ - -### SSH - -Zur Konfiguration wird auf den Hosts jeweils ein Nutzer mit sudo-Rechten -benötigt. Für diesen muss ein SSH-Key hinterlegt sein. - -## Übernehmen der Änderungen für alle Hosts +## Anwenden der Konfiguration auf alle Hosts ./site -Das Skript führt das Playbook `site.yml` mit dem Inventar `production` aus. - -Zum Testen kann noch `-C` angehängt werden. +Das Skript führt das Playbook `site.yml` aus. Zum Testen kann noch `-C` +angehängt werden. ## Ansible Convenience @@ -37,4 +23,4 @@ Einschränken auf bestimmte Tags, z.B. `nginx`: Einschränken auf bestimmte Hosts: - ./site -l srv03,srv04 + ./site -l srv01 diff --git a/default.nix b/default.nix deleted file mode 100644 index 4ca2915..0000000 --- a/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -with import {}; - -stdenv.mkDerivation rec { - name = "ffhh-ansible-config"; - - buildInputs = [ - python27 - python27Packages.virtualenv - ]; - - shellHook = '' - virtualenv ENV - source ENV/bin/activate - pip install -r requirements.txt - ''; -} diff --git a/group_vars/all b/inventory/group_vars/all similarity index 100% rename from group_vars/all rename to inventory/group_vars/all diff --git a/group_vars/ffhh b/inventory/group_vars/ffhh similarity index 100% rename from group_vars/ffhh rename to inventory/group_vars/ffhh diff --git a/group_vars/vms b/inventory/group_vars/vms similarity index 100% rename from group_vars/vms rename to inventory/group_vars/vms diff --git a/host_vars/gw03-new b/inventory/host_vars/gw03-new similarity index 100% rename from host_vars/gw03-new rename to inventory/host_vars/gw03-new diff --git a/host_vars/srv01 b/inventory/host_vars/srv01 similarity index 100% rename from host_vars/srv01 rename to inventory/host_vars/srv01 diff --git a/host_vars/srv02 b/inventory/host_vars/srv02 similarity index 100% rename from host_vars/srv02 rename to inventory/host_vars/srv02 diff --git a/host_vars/srv03 b/inventory/host_vars/srv03 similarity index 100% rename from host_vars/srv03 rename to inventory/host_vars/srv03 diff --git a/host_vars/srv04 b/inventory/host_vars/srv04 similarity index 100% rename from host_vars/srv04 rename to inventory/host_vars/srv04 diff --git a/production b/inventory/hosts similarity index 100% rename from production rename to inventory/hosts diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 74b24ce..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -ansible -netaddr diff --git a/site b/site index b783acb..fa126b1 100755 --- a/site +++ b/site @@ -1,3 +1,3 @@ #!/bin/bash -ansible-playbook site.yml -i production -bK $* +ansible-playbook site.yml -i inventory -bK $*