Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
f72bded2
Commit
f72bded2
authored
Feb 28, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:mpdehaan/ansible
parents
34b72d02
4ba366c2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
56 deletions
+21
-56
bin/ans-command
+1
-4
bin/ansible
+13
-38
docs/man/man1/ansible.1
+5
-14
lib/ansible/scripts.py
+2
-0
No files found.
bin/ans-command
View file @
f72bded2
...
...
@@ -47,9 +47,6 @@ def main(args):
sshpass
=
None
if
options
.
askpass
:
sshpass
=
getpass
.
getpass
(
prompt
=
"SSH password: "
)
pattern
=
'*'
if
options
.
host
:
pattern
+=
';'
.
join
(
options
.
host
)
if
options
.
output_dest
:
if
options
.
output_dest
[
0
]
!=
'/'
:
...
...
@@ -79,7 +76,7 @@ def main(args):
remote_pass
=
sshpass
,
host_list
=
options
.
host_list
,
forks
=
options
.
forks
,
pattern
=
pattern
,
pattern
=
options
.
pattern
,
verbose
=
True
,
)
...
...
bin/ansible
View file @
f72bded2
...
...
@@ -25,6 +25,7 @@ import shlex
import
ansible.runner
import
ansible.playbook
import
ansible.constants
as
C
from
ansible.scripts
import
base_ans_parser
class
Cli
(
object
):
...
...
@@ -32,26 +33,11 @@ class Cli(object):
pass
def
runner
(
self
):
parser
=
OptionParser
()
parser
.
add_option
(
"-P"
,
"--askpass"
,
default
=
False
,
action
=
"store_true"
,
help
=
"ask the user to input the ssh password for connecting"
)
parser
.
add_option
(
"-H"
,
"--host-list"
,
dest
=
"host_list"
,
help
=
"path to hosts list"
,
default
=
C
.
DEFAULT_HOST_LIST
)
parser
.
add_option
(
"-L"
,
"--library"
,
dest
=
"module_path"
,
help
=
"path to module library"
,
default
=
C
.
DEFAULT_MODULE_PATH
)
parser
.
add_option
(
"-f"
,
"--forks"
,
dest
=
"forks"
,
type
=
"int"
,
help
=
"level of parallelism"
,
default
=
C
.
DEFAULT_FORKS
)
parser
=
base_ans_parser
()
parser
.
add_option
(
"-n"
,
"--name"
,
dest
=
"module_name"
,
help
=
"module name to execute"
,
default
=
C
.
DEFAULT_MODULE_NAME
)
parser
.
add_option
(
"-a"
,
"--args"
,
dest
=
"module_args"
,
help
=
"module arguments"
,
default
=
C
.
DEFAULT_MODULE_ARGS
)
parser
.
add_option
(
"-p"
,
"--pattern"
,
dest
=
"pattern"
,
help
=
"hostname pattern"
,
default
=
C
.
DEFAULT_PATTERN
)
parser
.
add_option
(
"-u"
,
"--remote-user"
,
dest
=
"remote_user"
,
help
=
"remote username"
,
default
=
C
.
DEFAULT_REMOTE_USER
)
parser
.
add_option
(
"-r"
,
"--run-playbook"
,
dest
=
"playbook"
,
help
=
"playbook file, instead of -n and -a"
,
default
=
None
)
options
,
args
=
parser
.
parse_args
()
# TODO: more shell like splitting on module_args would
...
...
@@ -61,28 +47,17 @@ class Cli(object):
if
options
.
askpass
:
sshpass
=
getpass
.
getpass
(
prompt
=
"SSH password: "
)
if
options
.
playbook
is
None
:
return
ansible
.
runner
.
Runner
(
module_name
=
options
.
module_name
,
module_path
=
options
.
module_path
,
module_args
=
shlex
.
split
(
options
.
module_args
),
remote_user
=
options
.
remote_user
,
remote_pass
=
sshpass
,
host_list
=
options
.
host_list
,
forks
=
options
.
forks
,
pattern
=
options
.
pattern
,
verbose
=
True
,
)
else
:
return
ansible
.
playbook
.
PlayBook
(
playbook
=
options
.
playbook
,
module_path
=
options
.
module_path
,
remote_user
=
options
.
remote_user
,
remote_pass
=
sshpass
,
host_list
=
options
.
host_list
,
forks
=
options
.
forks
,
verbose
=
True
)
return
ansible
.
runner
.
Runner
(
module_name
=
options
.
module_name
,
module_path
=
options
.
module_path
,
module_args
=
shlex
.
split
(
options
.
module_args
),
remote_user
=
options
.
remote_user
,
remote_pass
=
sshpass
,
host_list
=
options
.
host_list
,
forks
=
options
.
forks
,
pattern
=
options
.
pattern
,
verbose
=
True
,
)
if
__name__
==
'__main__'
:
...
...
docs/man/man1/ansible.1
View file @
f72bded2
'\" t
.\" Title: ansible
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.7
6.1
<http://docbook.sf.net/>
.\" Date: 02/2
6
/2012
.\" Generator: DocBook XSL Stylesheets v1.7
5.2
<http://docbook.sf.net/>
.\" Date: 02/2
8
/2012
.\" Manual: System administration commands
.\" Source: Ansible 0.0.1
.\" Language: English
.\"
.TH "ANSIBLE" "1" "02/26/2012" "Ansible 0\&.0\&.1" "System administration commands"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH "ANSIBLE" "1" "02/28/2012" "Ansible 0\&.0\&.1" "System administration commands"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
...
...
@@ -34,7 +25,7 @@ ansible \- run a command somewhere else
ansible [\-H hosts_path] [\-L library_path] [\-f forks] [\-n module_name] [\-a [args1 [args2 \&...]]] [\-p host_pattern] [\-u remote_user]
.SH "DESCRIPTION"
.sp
\fBAnsible\fR is an extra\-simple Python API for doing \
*(Aqremote things\*(Aq
over SSH\&.
\fBAnsible\fR is an extra\-simple Python API for doing \
'remote things\'
over SSH\&.
.SH "OPTIONS"
.PP
\fB\-P\fR, \fB\-\-askpass\fR
...
...
@@ -102,7 +93,7 @@ Ansible was originally written by Michael DeHaan\&. See the AUTHORS file for a c
.sp
Copyright \(co 2012, Michael DeHaan
.sp
Ansible is released under the terms of the
MIT l
icense\&.
Ansible is released under the terms of the
GPLv3 L
icense\&.
.SH "SEE ALSO"
.sp
\fBansible\-modules\fR(5), \fBansible\-playbook\fR(5)
...
...
lib/ansible/scripts.py
View file @
f72bded2
...
...
@@ -26,6 +26,8 @@ def base_ans_parser():
help
=
"path to module library"
,
default
=
C
.
DEFAULT_MODULE_PATH
)
parser
.
add_option
(
'-u'
,
'--user'
,
default
=
C
.
DEFAULT_REMOTE_USER
,
dest
=
'remote_user'
,
help
=
'set the default username'
)
parser
.
add_option
(
"-p"
,
"--pattern"
,
dest
=
"pattern"
,
help
=
"hostname pattern"
,
default
=
C
.
DEFAULT_PATTERN
)
parser
.
add_option
(
"-P"
,
"--askpass"
,
default
=
False
,
action
=
"store_true"
,
help
=
"ask the user to input the ssh password for connecting"
)
parser
.
add_option
(
'-f'
,
'--forks'
,
dest
=
'forks'
,
default
=
C
.
DEFAULT_FORKS
,
type
=
'int'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment