Add global inventory to launch_node

Passing the -i to the jobdir means we're overriding the inventory.
This means variables that come from the /etc/ansible vars, like
sysadmins, are missing.

Add the global inventory to the command line for ansible-playbook.
We have --limit specified from '-l' - so we should still only run
on the host in question.

Change-Id: Ia67e65d25a1d961b619aa445303015fd577dee57
This commit is contained in:
Monty Taylor 2019-03-08 17:53:28 +00:00
parent 683b73b4fb
commit eb6c3c2f1a

View File

@ -170,9 +170,15 @@ def bootstrap_server(server, key, name, volume_device, keep,
t.daemon = True t.daemon = True
t.start() t.start()
inventory_list = ','.join([
jobdir.inventory_root,
'/opt/system-config/inventory/openstack.yaml',
'/opt/system-config/inventory/groups.yaml',
'/opt/system-config/inventory/emergency.yaml',
])
ansible_cmd = [ ansible_cmd = [
'ansible-playbook', 'ansible-playbook',
'-i', jobdir.inventory_root, '-l', name, '-i', inventory_list, '-l', name,
'--private-key={key}'.format(key=jobdir.key), '--private-key={key}'.format(key=jobdir.key),
"--ssh-common-args='-o StrictHostKeyChecking=no'", "--ssh-common-args='-o StrictHostKeyChecking=no'",
'-e', 'target={name}'.format(name=name), '-e', 'target={name}'.format(name=name),