Following-on from Iffb462371939989b03e5d6ac6c5df63aa7708513, instead of directly referring to a hostname when adding the bastion host to the inventory for the production playbooks, this finds it from the first element of the "bastion" group. As we do this twice for the run and post playbooks, abstract it into a role. The host value is currently "bridge.openstack.org" -- as is the existing hard-coding -- thus this is intended to be a no-op change. It is setting the foundation to make replacing the bastion host a simpler process in the future. Change-Id: I286796ebd71173019a627f8fe8d9a25d0bfc575achanges/86/858486/11
parent
04a129c328
commit
51611845d4
@ -0,0 +1,4 @@
|
||||
Add the bastion host to the inventory dynamically
|
||||
|
||||
For roles that run on the bastion host, it should be added to the
|
||||
inventory dynamically by the production jobs.
|
@ -0,0 +1,21 @@
|
||||
- name: Get the bastion hostname
|
||||
set_fact:
|
||||
_bastion_hostname: '{{ groups["bastion"][0] }}'
|
||||
|
||||
- name: Show bastion details
|
||||
debug:
|
||||
msg: "Bastion host is {{ _bastion_hostname }}"
|
||||
|
||||
- name: Add bastion host to inventory for playbook
|
||||
add_host:
|
||||
name: '{{ _bastion_hostname }}'
|
||||
groups: 'bastion'
|
||||
ansible_python_interpreter: python3
|
||||
ansible_user: zuul
|
||||
# Without setting ansible_host directly, mirror-workspace-git-repos
|
||||
# gets sad because if delegate_to localhost and with add_host that
|
||||
# ends up with ansible_host being localhost.
|
||||
ansible_host: '{{ _bastion_hostname }}'
|
||||
ansible_port: 22
|
||||
# Port 19885 is firewalled
|
||||
zuul_console_disabled: true
|
Loading…
Reference in new issue