Define install_method default when hosts resolution depend on it

In some playbooks we try to fetch openstack_service_setup_host based on
install_method variable. However, if variable is not defined,
and it is not by default, playbooks will run against localhost,
which will result in failure.

Closes-Bug: #2031647
Change-Id: I247ce2a808076ff55347db54327a1e4913ea3006
(cherry picked from commit f05c90103c)
This commit is contained in:
Dmitriy Rabotyagov 2023-08-17 14:29:25 +02:00 committed by Dmitriy Rabotyagov
parent b2f0e20209
commit 5064a6d10f
5 changed files with 7 additions and 4 deletions

View File

@ -7,3 +7,6 @@ warn_list:
- unnamed-task
- no-handler
- var-naming
extra_vars:
openstack_service_setup_host: utility_all

View File

@ -17,7 +17,7 @@
hosts: "{{ openstack_service_setup_host | default('localhost') }}"
user: root
vars_files:
- "defaults/{{ install_method }}_install.yml"
- "defaults/{{ install_method | default('source') }}_install.yml"
vars:
ansible_python_interpreter: >-
{{ openstack_service_setup_host_python_interpreter |

View File

@ -99,7 +99,7 @@
hosts: "{{ openstack_service_setup_host | default('localhost') }}"
gather_facts: no
vars_files:
- "defaults/{{ install_method }}_install.yml"
- "defaults/{{ install_method | default('source') }}_install.yml"
vars:
ansible_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default(ansible_facts['python']['executable']) }}"
tasks:

View File

@ -23,7 +23,7 @@
hosts: "{{ openstack_service_setup_host | default('localhost') }}"
gather_facts: "{{ osa_gather_facts | default(True) }}"
vars_files:
- "defaults/{{ install_method }}_install.yml"
- "defaults/{{ install_method | default('source') }}_install.yml"
become: yes
tags:
- openrc

View File

@ -146,7 +146,7 @@ elif [[ "${ACTION}" == "linters" ]]; then
else
ROLE_DIR="${OSA_CLONE_DIR}"
${VENV_BIN_DIR}/ansible-lint playbooks/ --exclude /etc/ansible/roles
ansible-playbook --syntax-check --list-tasks playbooks/setup-everything.yml
ansible-playbook --syntax-check --list-tasks playbooks/setup-everything.yml -e openstack_service_setup_host=utility_all
fi
# Run bashate