Browse Source

Changes for Ansible 2.4

Squashed changes:
   - Use 'inventory' instead of 'hostfile' in ansible.cfg.

     'hostfile' is deprecated.

   - Use 'os.environ.copy()' in zuul_return.py since this causes 2.4 to
     throw an exception now deep within module.exit_json().

Change-Id: I0a52c9e169a54d24a7b361010045fb10211418b7
changes/54/505354/10
David Shrewsbury 4 years ago
parent
commit
501bd0526d
  1. 2
      playbooks/zuul-stream/templates/ansible.cfg.j2
  2. 2
      tools/test-logs.sh
  3. 2
      zuul/ansible/library/zuul_return.py
  4. 2
      zuul/executor/server.py

2
playbooks/zuul-stream/templates/ansible.cfg.j2

@ -1,5 +1,5 @@
[defaults]
hostfile = {{ ansible_user_dir }}/inventory.yaml
inventory = {{ ansible_user_dir }}/inventory.yaml
gathering = smart
gather_subset = !all
lookup_plugins = {{ ansible_user_dir }}/src/git.openstack.org/openstack-infra/zuul/zuul/ansible/lookup

2
tools/test-logs.sh

@ -42,7 +42,7 @@ fi
cat >$WORK_DIR/ansible.cfg <<EOF
[defaults]
hostfile = $INVENTORY
inventory = $INVENTORY
gathering = smart
gather_subset = !all
fact_caching = jsonfile

2
zuul/ansible/library/zuul_return.py

@ -63,7 +63,7 @@ def main():
path = os.path.join(os.environ['ZUUL_JOBDIR'], 'work',
'results.json')
set_value(path, p['data'], p['file'])
module.exit_json(changed=True, e=os.environ)
module.exit_json(changed=True, e=os.environ.copy())
from ansible.module_utils.basic import * # noqa
from ansible.module_utils.basic import AnsibleModule

2
zuul/executor/server.py

@ -1185,7 +1185,7 @@ class AnsibleJob(object):
callback_path = self.executor_server.callback_dir
with open(jobdir_playbook.ansible_config, 'w') as config:
config.write('[defaults]\n')
config.write('hostfile = %s\n' % self.jobdir.inventory)
config.write('inventory = %s\n' % self.jobdir.inventory)
config.write('local_tmp = %s/local_tmp\n' %
self.jobdir.ansible_cache_root)
config.write('retry_files_enabled = False\n')

Loading…
Cancel
Save