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
64721054
Commit
64721054
authored
Apr 02, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #105 from skvidal/master
log a bit more and var_prompts
parents
25eedcdb
bcef25f7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
lib/ansible/callbacks.py
+7
-0
lib/ansible/playbook.py
+7
-0
lib/ansible/runner.py
+6
-0
No files found.
lib/ansible/callbacks.py
View file @
64721054
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
import
utils
import
utils
import
sys
import
sys
import
getpass
#######################################################
#######################################################
...
@@ -176,6 +177,12 @@ class PlaybookCallbacks(object):
...
@@ -176,6 +177,12 @@ class PlaybookCallbacks(object):
def
on_task_start
(
self
,
name
,
is_conditional
):
def
on_task_start
(
self
,
name
,
is_conditional
):
print
utils
.
task_start_msg
(
name
,
is_conditional
)
print
utils
.
task_start_msg
(
name
,
is_conditional
)
def
on_vars_prompt
(
self
,
varname
,
private
=
True
):
msg
=
'input for
%
s: '
%
varname
if
private
:
return
getpass
.
getpass
(
msg
)
return
raw_input
(
msg
)
def
on_setup_primary
(
self
):
def
on_setup_primary
(
self
):
print
"SETUP PHASE ****************************
\n
"
print
"SETUP PHASE ****************************
\n
"
...
...
lib/ansible/playbook.py
View file @
64721054
...
@@ -95,6 +95,13 @@ class PlayBook(object):
...
@@ -95,6 +95,13 @@ class PlayBook(object):
vars
=
play
.
get
(
'vars'
,
{})
vars
=
play
.
get
(
'vars'
,
{})
if
type
(
vars
)
!=
dict
:
if
type
(
vars
)
!=
dict
:
raise
errors
.
AnsibleError
(
"'vars' section must contain only key/value pairs"
)
raise
errors
.
AnsibleError
(
"'vars' section must contain only key/value pairs"
)
vars_prompt
=
play
.
get
(
'vars_prompt'
,
{})
if
type
(
vars_prompt
)
!=
dict
:
raise
errors
.
AnsibleError
(
"'vars_prompt' section must contain only key/value pairs"
)
for
vname
in
vars_prompt
:
print
vars_prompt
[
vname
]
# FIXME - need some way to know that this prompt should be getpass or raw_input
vars
[
vname
]
=
self
.
callbacks
.
on_vars_prompt
(
vname
)
return
vars
return
vars
# *****************************************************
# *****************************************************
...
...
lib/ansible/runner.py
View file @
64721054
...
@@ -357,6 +357,12 @@ class Runner(object):
...
@@ -357,6 +357,12 @@ class Runner(object):
cmd
=
"
%
s
%
s"
%
(
remote_module_path
,
argsfile
)
cmd
=
"
%
s
%
s"
%
(
remote_module_path
,
argsfile
)
else
:
else
:
cmd
=
" "
.
join
([
str
(
x
)
for
x
in
[
remote_module_path
,
async_jid
,
async_limit
,
async_module
,
argsfile
]])
cmd
=
" "
.
join
([
str
(
x
)
for
x
in
[
remote_module_path
,
async_jid
,
async_limit
,
async_module
,
argsfile
]])
# log command as the full command not as the path to args file - helps with debugging
msg
=
'
%
s: "
%
s"'
%
(
self
.
module_name
,
args
)
conn
.
exec_command
(
'/usr/bin/logger -t ansible -p auth.info "
%
s"'
%
msg
,
None
)
res
,
err
=
self
.
_exec_command
(
conn
,
cmd
,
tmp
,
sudoable
=
True
)
res
,
err
=
self
.
_exec_command
(
conn
,
cmd
,
tmp
,
sudoable
=
True
)
return
(
res
,
err
,
client_executed_str
)
return
(
res
,
err
,
client_executed_str
)
...
...
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