Do not consider skipped targets as failed for ansible.playbooks state

This commit is contained in:
Pablo Suárez Hernández 2021-10-01 10:23:32 +01:00 committed by Megan Wilhite
parent 4e91f385d9
commit 60e85eaf01

View file

@ -185,19 +185,13 @@ def playbooks(name, rundir=None, git_repo=None, git_kwargs=None, ansible_kwargs=
name, rundir=rundir, check=True, diff=True, **ansible_kwargs
)
if all(
not check["changed"]
and not check["failures"]
and not check["unreachable"]
and not check["skipped"]
not check["changed"] and not check["failures"] and not check["unreachable"]
for check in checks["stats"].values()
):
ret["comment"] = "No changes to be made from playbook {}".format(name)
ret["result"] = True
elif any(
check["changed"]
and not check["failures"]
and not check["unreachable"]
and not check["skipped"]
check["changed"] and not check["failures"] and not check["unreachable"]
for check in checks["stats"].values()
):
ret["comment"] = "Changes will be made from playbook {}".format(name)
@ -214,10 +208,7 @@ def playbooks(name, rundir=None, git_repo=None, git_kwargs=None, ansible_kwargs=
name, rundir=rundir, diff=True, **ansible_kwargs
)
if all(
not check["changed"]
and not check["failures"]
and not check["unreachable"]
and not check["skipped"]
not check["changed"] and not check["failures"] and not check["unreachable"]
for check in results["stats"].values()
):
ret["comment"] = "No changes to be made from playbook {}".format(name)
@ -226,9 +217,7 @@ def playbooks(name, rundir=None, git_repo=None, git_kwargs=None, ansible_kwargs=
else:
ret["changes"] = _changes(results)
ret["result"] = all(
not check["failures"]
and not check["unreachable"]
and not check["skipped"]
not check["failures"] and not check["unreachable"]
for check in results["stats"].values()
)
if ret["result"]: