From 74afde3f69c6ab9823d56a8077c88d1e0ab8326b Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Wed, 2 Aug 2023 16:33:10 +0200 Subject: [PATCH] Support /inventory/ansible/ansible.cfg (#422) Signed-off-by: Christian Berendt --- files/scripts/run-ansible.sh | 4 +++- files/scripts/run-ceph.sh | 4 +++- files/scripts/run-custom.sh | 4 +++- files/scripts/run-generic.sh | 4 +++- files/scripts/run-infrastructure.sh | 4 +++- files/scripts/run-kolla.sh | 4 +++- files/scripts/run-monitoring.sh | 4 +++- files/scripts/run-netbox.sh | 5 ++++- files/scripts/run-openstack.sh | 4 +++- files/scripts/run-state.sh | 4 +++- files/scripts/run-validate.sh | 4 +++- files/scripts/run-without-secrets.sh | 4 +++- files/scripts/run.sh | 4 +++- 13 files changed, 40 insertions(+), 13 deletions(-) diff --git a/files/scripts/run-ansible.sh b/files/scripts/run-ansible.sh index 8283244..28b1995 100755 --- a/files/scripts/run-ansible.sh +++ b/files/scripts/run-ansible.sh @@ -24,7 +24,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$environment/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$environment/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$environment/ansible.cfg fi diff --git a/files/scripts/run-ceph.sh b/files/scripts/run-ceph.sh index 8cf985d..0872c23 100755 --- a/files/scripts/run-ceph.sh +++ b/files/scripts/run-ceph.sh @@ -24,7 +24,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg fi diff --git a/files/scripts/run-custom.sh b/files/scripts/run-custom.sh index e37f7be..dee180c 100755 --- a/files/scripts/run-custom.sh +++ b/files/scripts/run-custom.sh @@ -24,7 +24,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg fi diff --git a/files/scripts/run-generic.sh b/files/scripts/run-generic.sh index d863429..be90cb3 100755 --- a/files/scripts/run-generic.sh +++ b/files/scripts/run-generic.sh @@ -24,7 +24,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg fi diff --git a/files/scripts/run-infrastructure.sh b/files/scripts/run-infrastructure.sh index c967dc6..310dae8 100755 --- a/files/scripts/run-infrastructure.sh +++ b/files/scripts/run-infrastructure.sh @@ -24,7 +24,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg fi diff --git a/files/scripts/run-kolla.sh b/files/scripts/run-kolla.sh index 17dfc6a..432c482 100755 --- a/files/scripts/run-kolla.sh +++ b/files/scripts/run-kolla.sh @@ -24,7 +24,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg fi diff --git a/files/scripts/run-monitoring.sh b/files/scripts/run-monitoring.sh index 5f171b7..d6ca1ad 100755 --- a/files/scripts/run-monitoring.sh +++ b/files/scripts/run-monitoring.sh @@ -24,7 +24,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg fi diff --git a/files/scripts/run-netbox.sh b/files/scripts/run-netbox.sh index 1cefa69..80046c3 100755 --- a/files/scripts/run-netbox.sh +++ b/files/scripts/run-netbox.sh @@ -20,8 +20,11 @@ if [[ -e /ansible/ara.env ]]; then fi export ANSIBLE_INVENTORY=$CONFIGURATION_DIRECTORY/$ENVIRONMENT/inventory/hosts.yml + export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $CONFIGURATION_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $CONFIGURATION_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then export ANSIBLE_CONFIG=$CONFIGURATION_DIRECTORY/$ENVIRONMENT/ansible.cfg fi diff --git a/files/scripts/run-openstack.sh b/files/scripts/run-openstack.sh index 58fb2f3..9ecec0c 100755 --- a/files/scripts/run-openstack.sh +++ b/files/scripts/run-openstack.sh @@ -24,7 +24,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg fi diff --git a/files/scripts/run-state.sh b/files/scripts/run-state.sh index 6054462..e8cb65e 100755 --- a/files/scripts/run-state.sh +++ b/files/scripts/run-state.sh @@ -24,7 +24,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg fi diff --git a/files/scripts/run-validate.sh b/files/scripts/run-validate.sh index 87b0520..cba3728 100755 --- a/files/scripts/run-validate.sh +++ b/files/scripts/run-validate.sh @@ -24,7 +24,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$ENVIRONMENT/ansible.cfg fi diff --git a/files/scripts/run-without-secrets.sh b/files/scripts/run-without-secrets.sh index dee2138..c635273 100755 --- a/files/scripts/run-without-secrets.sh +++ b/files/scripts/run-without-secrets.sh @@ -24,7 +24,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$environment/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$environment/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$environment/ansible.cfg fi diff --git a/files/scripts/run.sh b/files/scripts/run.sh index 608f21e..bc57ad2 100755 --- a/files/scripts/run.sh +++ b/files/scripts/run.sh @@ -27,7 +27,9 @@ fi export ANSIBLE_INVENTORY=$ANSIBLE_DIRECTORY/inventory/hosts.yml export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/ansible.cfg -if [[ -e $ENVIRONMENTS_DIRECTORY/$environment/ansible.cfg ]]; then +if [[ -e /inventory/ansible/ansible.cfg ]]; then + export ANSIBLE_CONFIG=/inventory/ansible/ansible.cfg +elif [[ -e $ENVIRONMENTS_DIRECTORY/$environment/ansible.cfg ]]; then export ANSIBLE_CONFIG=$ENVIRONMENTS_DIRECTORY/$environment/ansible.cfg fi