summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMichael DeHaan <michael.dehaan@gmail.com>2012-03-02 22:54:25 -0500
committerMichael DeHaan <michael.dehaan@gmail.com>2012-03-02 22:54:25 -0500
commitcbfabcd0fbb78bdc9b33e4d5c1e5d1bbb9ac8d7e (patch)
tree96bbb0ef875729dd3279683f84e8e84830d6d9d1 /bin
parente4304a0ac5ef777832a2f4db8899507d0d0dfacc (diff)
downloadansible-cbfabcd0fbb78bdc9b33e4d5c1e5d1bbb9ac8d7e.tar.gz
Add -i, -k, and -M to ansible-playbook CLI to match options in /usr/bin/ansible
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ansible-playbook20
1 files changed, 16 insertions, 4 deletions
diff --git a/bin/ansible-playbook b/bin/ansible-playbook
index 04f880dc3a..05d555b4dd 100755
--- a/bin/ansible-playbook
+++ b/bin/ansible-playbook
@@ -21,6 +21,7 @@
import sys
import ansible.playbook
import ansible.constants as C
+import getpass
from optparse import OptionParser
#######################################################
@@ -33,21 +34,32 @@ def main(args):
parser.usage = "ans-playbook playbook.yml ..."
parser.add_option('-f','--forks', dest='forks', default=C.DEFAULT_FORKS, type='int',
help='set the number of forks to start up')
- parser.add_option("-m", "--module-path", dest="module_path",
+ parser.add_option("-i", "--inventory-file", dest="inventory",
+ help="inventory host file", default=C.DEFAULT_HOST_LIST)
+ parser.add_option("-k", "--ask-pass", default=False, action="store_true",
+ help="ask for SSH password")
+ parser.add_option("-M", "--module-path", dest="module_path",
help="path to module library", default=C.DEFAULT_MODULE_PATH)
+
options, args = parser.parse_args(args)
if len(args) == 0:
- print >> sys.stderr, "playbook path is a required argument"
- return 1
+ print >> sys.stderr, "playbook path is a required argument"
+ return 1
+
+ sshpass = None
+ if options.ask_pass:
+ sshpass = getpass.getpass(prompt="SSH password: ")
# run all playbooks specified on the command line
for playbook in args:
pb = ansible.playbook.PlayBook(
playbook=playbook,
+ host_list=options.inventory,
module_path=options.module_path,
forks=options.forks,
- verbose=True
+ verbose=True,
+ remote_pass=sshpass,
)
pb.run()