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
98dda72b
Commit
98dda72b
authored
May 03, 2012
by
Jim Richardson
Committed by
Michael DeHaan
May 06, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first bit of getting sudo -u functionality
parent
cbbd9d8f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
+9
-4
bin/ansible
+4
-2
lib/ansible/constants.py
+1
-0
lib/ansible/runner.py
+4
-2
No files found.
bin/ansible
View file @
98dda72b
...
@@ -52,7 +52,8 @@ class Cli(object):
...
@@ -52,7 +52,8 @@ class Cli(object):
parser
.
add_option
(
'-m'
,
'--module-name'
,
dest
=
'module_name'
,
parser
.
add_option
(
'-m'
,
'--module-name'
,
dest
=
'module_name'
,
help
=
"module name to execute (default=
%
s)"
%
C
.
DEFAULT_MODULE_NAME
,
help
=
"module name to execute (default=
%
s)"
%
C
.
DEFAULT_MODULE_NAME
,
default
=
C
.
DEFAULT_MODULE_NAME
)
default
=
C
.
DEFAULT_MODULE_NAME
)
parser
.
add_option
(
'-U'
,
'--sudo_user'
,
dest
=
'sudo_user'
,
help
=
'desired sudo user'
,
default
=
C
.
DEFAULT_SUDO_USER
)
options
,
args
=
parser
.
parse_args
()
options
,
args
=
parser
.
parse_args
()
self
.
callbacks
.
options
=
options
self
.
callbacks
.
options
=
options
...
@@ -76,6 +77,7 @@ class Cli(object):
...
@@ -76,6 +77,7 @@ class Cli(object):
sshpass
=
None
sshpass
=
None
sudopass
=
None
sudopass
=
None
sudouser
=
options
.
sudo_user
if
options
.
ask_pass
:
if
options
.
ask_pass
:
sshpass
=
getpass
.
getpass
(
prompt
=
"SSH password: "
)
sshpass
=
getpass
.
getpass
(
prompt
=
"SSH password: "
)
if
options
.
ask_sudo_pass
:
if
options
.
ask_sudo_pass
:
...
@@ -92,7 +94,7 @@ class Cli(object):
...
@@ -92,7 +94,7 @@ class Cli(object):
forks
=
options
.
forks
,
forks
=
options
.
forks
,
pattern
=
pattern
,
pattern
=
pattern
,
callbacks
=
self
.
callbacks
,
sudo
=
options
.
sudo
,
callbacks
=
self
.
callbacks
,
sudo
=
options
.
sudo
,
sudo_pass
=
sudopass
,
sudo_pass
=
sudopass
,
sudo_user
=
options
.
sudo_user
,
transport
=
options
.
connection
,
debug
=
options
.
debug
transport
=
options
.
connection
,
debug
=
options
.
debug
)
)
...
...
lib/ansible/constants.py
View file @
98dda72b
...
@@ -33,6 +33,7 @@ DEFAULT_POLL_INTERVAL = 15
...
@@ -33,6 +33,7 @@ DEFAULT_POLL_INTERVAL = 15
DEFAULT_REMOTE_USER
=
'root'
DEFAULT_REMOTE_USER
=
'root'
DEFAULT_REMOTE_PASS
=
None
DEFAULT_REMOTE_PASS
=
None
DEFAULT_SUDO_PASS
=
None
DEFAULT_SUDO_PASS
=
None
DEFAULT_SUDO_USER
=
'root'
DEFAULT_REMOTE_PORT
=
22
DEFAULT_REMOTE_PORT
=
22
DEFAULT_TRANSPORT
=
'paramiko'
DEFAULT_TRANSPORT
=
'paramiko'
DEFAULT_TRANSPORT_OPTS
=
[
'local'
,
'paramiko'
]
DEFAULT_TRANSPORT_OPTS
=
[
'local'
,
'paramiko'
]
...
...
lib/ansible/runner.py
View file @
98dda72b
...
@@ -77,8 +77,8 @@ class Runner(object):
...
@@ -77,8 +77,8 @@ class Runner(object):
remote_pass
=
C
.
DEFAULT_REMOTE_PASS
,
remote_port
=
C
.
DEFAULT_REMOTE_PORT
,
remote_pass
=
C
.
DEFAULT_REMOTE_PASS
,
remote_port
=
C
.
DEFAULT_REMOTE_PORT
,
sudo_pass
=
C
.
DEFAULT_SUDO_PASS
,
background
=
0
,
basedir
=
None
,
sudo_pass
=
C
.
DEFAULT_SUDO_PASS
,
background
=
0
,
basedir
=
None
,
setup_cache
=
None
,
transport
=
C
.
DEFAULT_TRANSPORT
,
conditional
=
'True'
,
setup_cache
=
None
,
transport
=
C
.
DEFAULT_TRANSPORT
,
conditional
=
'True'
,
callbacks
=
None
,
debug
=
False
,
sudo
=
False
,
module_vars
=
None
,
callbacks
=
None
,
debug
=
False
,
sudo
=
False
,
sudo_user
=
C
.
DEFAULT_SUDO_USER
is_playbook
=
False
,
inventory
=
None
):
,
module_vars
=
None
,
is_playbook
=
False
,
inventory
=
None
):
"""
"""
host_list : path to a host list file, like /etc/ansible/hosts
host_list : path to a host list file, like /etc/ansible/hosts
...
@@ -91,6 +91,7 @@ class Runner(object):
...
@@ -91,6 +91,7 @@ class Runner(object):
remote_user : connect as this remote username
remote_user : connect as this remote username
remote_pass : supply this password (if not using keys)
remote_pass : supply this password (if not using keys)
remote_port : use this default remote port (if not set by the inventory system)
remote_port : use this default remote port (if not set by the inventory system)
sudo_user : If you want to sudo to a user other than root.
sudo_pass : sudo password if using sudo and sudo requires a password
sudo_pass : sudo password if using sudo and sudo requires a password
background : run asynchronously with a cap of this many # of seconds (if not 0)
background : run asynchronously with a cap of this many # of seconds (if not 0)
basedir : paths used by modules if not absolute are relative to here
basedir : paths used by modules if not absolute are relative to here
...
@@ -143,6 +144,7 @@ class Runner(object):
...
@@ -143,6 +144,7 @@ class Runner(object):
self
.
basedir
=
basedir
self
.
basedir
=
basedir
self
.
sudo
=
sudo
self
.
sudo
=
sudo
self
.
sudo_pass
=
sudo_pass
self
.
sudo_pass
=
sudo_pass
self
.
sudo_user
=
sudo_user
self
.
is_playbook
=
is_playbook
self
.
is_playbook
=
is_playbook
euid
=
pwd
.
getpwuid
(
os
.
geteuid
())[
0
]
euid
=
pwd
.
getpwuid
(
os
.
geteuid
())[
0
]
...
...
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