From 87d2cea6a798ae160153621f213d30fe8153dd58 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 20 May 2019 13:09:40 +1000 Subject: [PATCH] launch.py: Fix inventory list This was introduced with Ia67e65d25a1d961b619aa445303015fd577dee57 Passing "-i file1,file2,file.." makes Ansible think that the inventory argument is a list of hostnames. Separate out the "-i" flags so it reads each file as desired. Change-Id: I92c9a74de6552968da6c919074d84f2911faf4d4 --- launch/launch-node.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/launch/launch-node.py b/launch/launch-node.py index b5b9abde9f..edd07d7b33 100755 --- a/launch/launch-node.py +++ b/launch/launch-node.py @@ -170,20 +170,19 @@ def bootstrap_server(server, key, name, volume_device, keep, t.daemon = True t.start() - inventory_list = ','.join([ + inventory_list = ( jobdir.inventory_root, '/opt/system-config/inventory/openstack.yaml', '/opt/system-config/inventory/groups.yaml', '/opt/system-config/inventory/emergency.yaml', - ]) - ansible_cmd = [ - 'ansible-playbook', - '--flush-cache', - '-i', inventory_list, '-l', name, - '--private-key={key}'.format(key=jobdir.key), - "--ssh-common-args='-o StrictHostKeyChecking=no'", - '-e', 'target={name}'.format(name=name), - ] + ) + inventory_cmds = [v for e in inventory_list for v in ('-i', e)] + ansible_cmd = ['ansible-playbook', '--flush-cache' ] + \ + inventory_cmds + \ + ['-l', name, + '--private-key={key}'.format(key=jobdir.key), + "--ssh-common-args='-o StrictHostKeyChecking=no'", + '-e', 'target={name}'.format(name=name)] # Run the base playbook limited to just this server we just created for playbook in [