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
5268d49b
Commit
5268d49b
authored
Jan 28, 2013
by
Daniel Hokka Zakrisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sudo_flags configuration option to alter sudo behaviour
Default to -H to set $HOME appropriately.
parent
133874a5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
4 deletions
+10
-4
CHANGELOG.md
+3
-2
examples/ansible.cfg
+3
-0
lib/ansible/constants.py
+1
-0
lib/ansible/utils/__init__.py
+3
-2
No files found.
CHANGELOG.md
View file @
5268d49b
...
...
@@ -14,11 +14,12 @@ New modules:
New config settings:
*
default_
sudo_exe parameter can be set in config to use sudo alternatives
*
added when_failed and when_changed
*
sudo_exe parameter can be set in config to use sudo alternatives
*
sudo_flags parameter can alter the flags used with sudo
New playbook/language features:
*
added when_failed and when_changed
*
task includes can now be of infinite depth
*
when_set and when_unset can take more than one var (when_set: $a and $b and $c)
*
added the with_sequence lookup plugin
...
...
examples/ansible.cfg
View file @
5268d49b
...
...
@@ -76,6 +76,9 @@ remote_port=22
sudo_exe=sudo
# the default flags passed to sudo
# sudo_flags=-H
# how to handle hash defined in several places
# hash can be merged, or replaced
# if you use replace, and have multiple hashes named 'x', the last defined
...
...
lib/ansible/constants.py
View file @
5268d49b
...
...
@@ -92,6 +92,7 @@ DEFAULT_MANAGED_STR = get_config(p, DEFAULTS, 'ansible_managed', None,
DEFAULT_SYSLOG_FACILITY
=
get_config
(
p
,
DEFAULTS
,
'syslog_facility'
,
'ANSIBLE_SYSLOG_FACILITY'
,
'LOG_USER'
)
DEFAULT_KEEP_REMOTE_FILES
=
get_config
(
p
,
DEFAULTS
,
'keep_remote_files'
,
'ANSIBLE_KEEP_REMOTE_FILES'
,
'0'
)
DEFAULT_SUDO_EXE
=
get_config
(
p
,
DEFAULTS
,
'sudo_exe'
,
'ANSIBLE_SUDO_EXE'
,
'sudo'
)
DEFAULT_SUDO_FLAGS
=
get_config
(
p
,
DEFAULTS
,
'sudo_flags'
,
'ANSIBLE_SUDO_FLAGS'
,
'-H'
)
DEFAULT_HASH_BEHAVIOUR
=
get_config
(
p
,
DEFAULTS
,
'hash_behaviour'
,
'ANSIBLE_HASH_BEHAVIOUR'
,
'replace'
)
DEFAULT_ACTION_PLUGIN_PATH
=
shell_expand_path
(
get_config
(
p
,
DEFAULTS
,
'action_plugins'
,
'ANSIBLE_ACTION_PLUGINS'
,
'/usr/share/ansible_plugins/action_plugins'
))
...
...
lib/ansible/utils/__init__.py
View file @
5268d49b
...
...
@@ -590,6 +590,7 @@ def make_sudo_cmd(sudo_user, executable, cmd):
# the -p option.
randbits
=
''
.
join
(
chr
(
random
.
randint
(
ord
(
'a'
),
ord
(
'z'
)))
for
x
in
xrange
(
32
))
prompt
=
'[sudo via ansible, key=
%
s] password: '
%
randbits
sudocmd
=
'
%
s -k &&
%
s -S -p "
%
s" -u
%
s
%
s -c
%
s'
%
(
C
.
DEFAULT_SUDO_EXE
,
C
.
DEFAULT_SUDO_EXE
,
prompt
,
sudo_user
,
executable
or
'$SHELL'
,
pipes
.
quote
(
cmd
))
sudocmd
=
'
%
s -k &&
%
s
%
s -S -p "
%
s" -u
%
s
%
s -c
%
s'
%
(
C
.
DEFAULT_SUDO_EXE
,
C
.
DEFAULT_SUDO_EXE
,
C
.
DEFAULT_SUDO_FLAGS
,
prompt
,
sudo_user
,
executable
or
'$SHELL'
,
pipes
.
quote
(
cmd
))
return
(
'/bin/sh -c '
+
pipes
.
quote
(
sudocmd
),
prompt
)
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