Make inventory file writable

Looks like ansible_runner.utils.dump_artifact() makes it
read-only and redeploy fails with permission error.

Closes-Bug: #1950767
Change-Id: I32acdb51ac12be08c94efa5c198ea83549a8f034
(cherry picked from commit 6b2892508a)
This commit is contained in:
rabi 2021-11-12 15:45:02 +05:30 committed by Rabi Mishra
parent 2909e00222
commit 0021766610
1 changed files with 4 additions and 3 deletions

View File

@ -371,11 +371,12 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
inventory,
default_flow_style=False
)
return ansible_runner.utils.dump_artifact(
inv_file = ansible_runner.utils.dump_artifact(
inventory,
workdir,
constants.ANSIBLE_HOSTS_FILENAME
)
constants.ANSIBLE_HOSTS_FILENAME)
os.chmod(inv_file, 0o600)
return inv_file
def _running_ansible_msg(playbook, timeout=None):
if timeout and timeout > 0: