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
This commit is contained in:
David Shrewsbury 2017-09-19 14:15:08 -04:00
parent 0015fda37b
commit 501bd0526d
4 changed files with 4 additions and 4 deletions

View File

@ -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

View File

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

View File

@ -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

View File

@ -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')