From 5adcf4536cbd2049adc694610e047f8dfa3d519a Mon Sep 17 00:00:00 2001 From: Jacob Babor Date: Sat, 19 Mar 2022 13:05:18 -0500 Subject: [PATCH] Modularize the heck out of our inventories --- ansible.cfg | 2 +- inventories/hardcoded/group_vars | 1 + inventories/hardcoded/host_vars | 1 + .../hardcoded}/hosts.yml | 0 inventories/production-no-auto/group_vars | 1 + inventories/production-no-auto/host_vars | 1 + inventories/production-no-auto/hosts.yml | 21 +++++++++++++++++++ .../production}/group_vars/all.yml | 0 .../group_vars/manufacturers_raspi.yml | 0 .../host_vars/dsk-ryzen-0.desu.ltd.yml | 0 .../production}/hosts.yml | 0 inventory-hard/group_vars | 1 - inventory-hard/host_vars | 1 - 13 files changed, 26 insertions(+), 3 deletions(-) create mode 120000 inventories/hardcoded/group_vars create mode 120000 inventories/hardcoded/host_vars rename {inventory-hard => inventories/hardcoded}/hosts.yml (100%) create mode 120000 inventories/production-no-auto/group_vars create mode 120000 inventories/production-no-auto/host_vars create mode 100644 inventories/production-no-auto/hosts.yml rename {inventory => inventories/production}/group_vars/all.yml (100%) rename {inventory => inventories/production}/group_vars/manufacturers_raspi.yml (100%) rename {inventory => inventories/production}/host_vars/dsk-ryzen-0.desu.ltd.yml (100%) rename {inventory => inventories/production}/hosts.yml (100%) delete mode 120000 inventory-hard/group_vars delete mode 120000 inventory-hard/host_vars diff --git a/ansible.cfg b/ansible.cfg index 0e40a09..b6a7731 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -2,7 +2,7 @@ forks = 16 host_key_checking = false interpreter_python = python3 -inventory = inventory +inventory = inventories/production private_key_file = ~/.ssh/desu remote_tmp = /tmp roles_path = .roles:roles diff --git a/inventories/hardcoded/group_vars b/inventories/hardcoded/group_vars new file mode 120000 index 0000000..1b35f8f --- /dev/null +++ b/inventories/hardcoded/group_vars @@ -0,0 +1 @@ +../production/group_vars \ No newline at end of file diff --git a/inventories/hardcoded/host_vars b/inventories/hardcoded/host_vars new file mode 120000 index 0000000..01f984b --- /dev/null +++ b/inventories/hardcoded/host_vars @@ -0,0 +1 @@ +../production/host_vars \ No newline at end of file diff --git a/inventory-hard/hosts.yml b/inventories/hardcoded/hosts.yml similarity index 100% rename from inventory-hard/hosts.yml rename to inventories/hardcoded/hosts.yml diff --git a/inventories/production-no-auto/group_vars b/inventories/production-no-auto/group_vars new file mode 120000 index 0000000..1b35f8f --- /dev/null +++ b/inventories/production-no-auto/group_vars @@ -0,0 +1 @@ +../production/group_vars \ No newline at end of file diff --git a/inventories/production-no-auto/host_vars b/inventories/production-no-auto/host_vars new file mode 120000 index 0000000..01f984b --- /dev/null +++ b/inventories/production-no-auto/host_vars @@ -0,0 +1 @@ +../production/host_vars \ No newline at end of file diff --git a/inventories/production-no-auto/hosts.yml b/inventories/production-no-auto/hosts.yml new file mode 100644 index 0000000..30f6e1c --- /dev/null +++ b/inventories/production-no-auto/hosts.yml @@ -0,0 +1,21 @@ +plugin: netbox.netbox.nb_inventory +token: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 31656630386363323836663537383930346336393061363461653532323561386632343063353161 + 6630636535373331633762363738613232636366663430330a356333623466623230616433373036 + 35386162633961616438383332346165323930333662376665616531613837316333653361313332 + 3065343761343338340a336266316339616134336332376336326332663435323937343531636238 + 37323530333463383062396363616263386430356438306133393130626365333932323734383165 + 3064663435626339393836353837643730333266366436373033 +api_endpoint: "https://netbox.desu.ltd" +interfaces: yes +group_by: + - device_roles + - device_types + - manufacturers + - platforms + - tags +query_filters: + - has_primary_ip: "true" + - status: "active" + - tag__n: "no-ansible" diff --git a/inventory/group_vars/all.yml b/inventories/production/group_vars/all.yml similarity index 100% rename from inventory/group_vars/all.yml rename to inventories/production/group_vars/all.yml diff --git a/inventory/group_vars/manufacturers_raspi.yml b/inventories/production/group_vars/manufacturers_raspi.yml similarity index 100% rename from inventory/group_vars/manufacturers_raspi.yml rename to inventories/production/group_vars/manufacturers_raspi.yml diff --git a/inventory/host_vars/dsk-ryzen-0.desu.ltd.yml b/inventories/production/host_vars/dsk-ryzen-0.desu.ltd.yml similarity index 100% rename from inventory/host_vars/dsk-ryzen-0.desu.ltd.yml rename to inventories/production/host_vars/dsk-ryzen-0.desu.ltd.yml diff --git a/inventory/hosts.yml b/inventories/production/hosts.yml similarity index 100% rename from inventory/hosts.yml rename to inventories/production/hosts.yml diff --git a/inventory-hard/group_vars b/inventory-hard/group_vars deleted file mode 120000 index 06abdc6..0000000 --- a/inventory-hard/group_vars +++ /dev/null @@ -1 +0,0 @@ -../inventory/group_vars \ No newline at end of file diff --git a/inventory-hard/host_vars b/inventory-hard/host_vars deleted file mode 120000 index e6dbbfc..0000000 --- a/inventory-hard/host_vars +++ /dev/null @@ -1 +0,0 @@ -../inventory/host_vars \ No newline at end of file