Skip to content

Commit

Permalink
Allow checking and diffing the Ansible run
Browse files Browse the repository at this point in the history
  • Loading branch information
shepmaster committed Jun 28, 2023
1 parent 0cd104a commit d906b99
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ansible/apply
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def run_playbook(args):
ansible_args += ["-u", args.user]
if args.start_at_task is not None:
ansible_args += ["--start-at-task", args.start_at_task]
if args.check:
ansible_args += ["--check"]
if args.diff:
ansible_args += ["--diff"]
res = subprocess.run(ansible_args, cwd=str(tempdir))
if res.returncode != 0:
exit(1)
Expand All @@ -72,6 +76,14 @@ if __name__ == "__main__":
"--start-at-task", help="start at a task with the provided name",
default=None,
)
parser.add_argument(
"--check", help="perform an Ansible check run",
action="store_true",
)
parser.add_argument(
"--diff", help="perform an Ansible diff run",
action="store_true",
)
args = parser.parse_args()

install_ansible()
Expand Down

0 comments on commit d906b99

Please sign in to comment.