add-bastion-host: use hostname directly

Similar to I84acaa917187db092a302519c14bc94a6a87c2c0, this is a
follow-on to I286796ebd71173019a627f8fe8d9a25d0bfc575a.

At this point, there is no "bastion" group for the executor Ansible to
use.

The idea here is to reduce the number of places we're directly
referencing bridge.openstack.org.  We could move this into a job
variable, but that's the same as defining it here.  KISS and reference
it directly here (since it's in a role and used multiple times, it's
still better than hardcoding in multiple places).

Change-Id: If6dbcb34e25e3eb721cd2892b8adb84344289882
This commit is contained in:
Ian Wienand 2022-10-25 12:55:25 +11:00
parent f2244610ff
commit 2f213de5a6
No known key found for this signature in database

View File

@ -1,21 +1,13 @@
- name: Get the bastion hostname - name: Add bastion host to inventory for production playbook
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: add_host:
name: '{{ _bastion_hostname }}' name: 'bridge.openstack.org'
groups: 'bastion' groups: 'bastion'
ansible_python_interpreter: python3 ansible_python_interpreter: python3
ansible_user: zuul ansible_user: zuul
# Without setting ansible_host directly, mirror-workspace-git-repos # Without setting ansible_host directly, mirror-workspace-git-repos
# gets sad because if delegate_to localhost and with add_host that # gets sad because if delegate_to localhost and with add_host that
# ends up with ansible_host being localhost. # ends up with ansible_host being localhost.
ansible_host: '{{ _bastion_hostname }}' ansible_host: 'bridge.openstack.org'
ansible_port: 22 ansible_port: 22
# Port 19885 is firewalled # Port 19885 is firewalled
zuul_console_disabled: true zuul_console_disabled: true