Skip to content

Commit

Permalink
Support /inventory/ansible/ansible.cfg (#422)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <berendt@osism.tech>
  • Loading branch information
berendt authored Aug 2, 2023
1 parent cdcdf39 commit 74afde3
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 13 deletions.
4 changes: 3 additions & 1 deletion files/scripts/run-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion files/scripts/run-ceph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion files/scripts/run-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion files/scripts/run-generic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion files/scripts/run-infrastructure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion files/scripts/run-kolla.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion files/scripts/run-monitoring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion files/scripts/run-netbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion files/scripts/run-openstack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion files/scripts/run-state.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion files/scripts/run-validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion files/scripts/run-without-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion files/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 74afde3

Please sign in to comment.