Skip to content

Commit

Permalink
Add -p arg to specify playbook on command line
Browse files Browse the repository at this point in the history
  • Loading branch information
fr33jc committed Mar 2, 2015
1 parent da42a10 commit f5bb14b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions bang/cmd_bang.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,36 @@ def get_parser():
configuration may fail if it references infrastructure
resources that have not already been created.
"""),
}),
('--playbook', '-p', {
'action': 'append',
'dest': 'playbooks',
'metavar': 'PLAYBOOK',
'help': dedent("""\
Specify playbook(s) to run during the Ansible phase.
*WARNING* This overrides any list of playbooks
specified in the bang config(s).
This argument can be passed multiple times to specify
multiple playbooks to run. They will be executed in
the order in which they are passed on the command line.
E.g.
# deploy and configure a stack as usual. playbooks
# are defined in ``my_own_cloud.yml``:
bang own_cloud.yml
# run an ad-hoc playbook on the same stack:
bang own_cloud.yml -p update_loadbalancers.yml
# run multiple ad-hoc playbooks:
bang own_cloud -p start_maintenance_window.yml \\
-p restart_apache.yml \\
-p stop_maintenance_window.yml
"""),
}),
# TODO: implement validate/dry-run
Expand Down Expand Up @@ -191,6 +221,9 @@ def run_bang(alt_args=None):

config = Config.from_config_specs(source)

if args.playbooks:
config[A.PLAYBOOKS] = args.playbooks

if args.dump_config:

if args.dump_config in ('yaml', 'yml'):
Expand Down

0 comments on commit f5bb14b

Please sign in to comment.