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
8ed343cc
Commit
8ed343cc
authored
Sep 30, 2013
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jsmartin-hide_skipped_hosts' into devel
parents
ac0a7d96
c8fa83c9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
11 deletions
+28
-11
docsite/latest/rst/intro_configuration.rst
+9
-0
examples/ansible.cfg
+6
-0
lib/ansible/callbacks.py
+12
-11
lib/ansible/constants.py
+1
-0
No files found.
docsite/latest/rst/intro_configuration.rst
View file @
8ed343cc
...
...
@@ -109,6 +109,15 @@ different locations::
Most users will not need to use this feature. See `developing_plugins` for more details
display_skipped_hosts
=====================
If set to `False`, ansible will not display any status for a task that is skipped. The default behavior is to display skipped tasks::
#display_skipped_hosts=True
Note that Ansible will always show the task header for any task, regardless of whether or not the task is skipped.
error_on_undefined_vars
=======================
...
...
examples/ansible.cfg
View file @
8ed343cc
...
...
@@ -72,6 +72,12 @@ timeout = 10
# replacing {file}, {host} and {uid} and strftime codes with proper values.
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
# by default, ansible-playbook will display "Skipping [host]" if it determines a task
# should not be run on a host. Set this to "False" if you don't want to see these "Skipping"
# messages. NOTE: the task header will still be shown regardless of whether or not the
# task is skipped.
#display_skipped_hosts = True
# by default (as of 1.3), Ansible will raise errors when attempting to dereference
# Jinja2 variables that are not set in templates or action lines. Uncomment this line
# to revert the behavior to pre-1.3.
...
...
lib/ansible/callbacks.py
View file @
8ed343cc
...
...
@@ -74,7 +74,7 @@ def get_cowsay_info():
cowsay
,
noncow
=
get_cowsay_info
()
def
log_lockfile
():
tempdir
=
tempfile
.
gettempdir
()
tempdir
=
tempfile
.
gettempdir
()
uid
=
os
.
getuid
()
path
=
os
.
path
.
join
(
tempdir
,
".ansible-lock.
%
s"
%
uid
)
return
path
...
...
@@ -93,7 +93,7 @@ def log_flock(runner):
fcntl
.
lockf
(
LOG_LOCK
,
fcntl
.
LOCK_EX
)
except
OSError
:
pass
def
log_unflock
(
runner
):
if
runner
is
not
None
:
...
...
@@ -471,7 +471,7 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
super
(
PlaybookRunnerCallbacks
,
self
)
.
on_failed
(
host
,
results
,
ignore_errors
=
ignore_errors
)
def
on_ok
(
self
,
host
,
host_result
):
item
=
host_result
.
get
(
'item'
,
None
)
host_result2
=
host_result
.
copy
()
...
...
@@ -519,13 +519,14 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
super
(
PlaybookRunnerCallbacks
,
self
)
.
on_error
(
host
,
err
)
def
on_skipped
(
self
,
host
,
item
=
None
):
msg
=
''
if
item
:
msg
=
"skipping: [
%
s] => (item=
%
s)"
%
(
host
,
item
)
else
:
msg
=
"skipping: [
%
s]"
%
host
display
(
msg
,
color
=
'cyan'
,
runner
=
self
.
runner
)
super
(
PlaybookRunnerCallbacks
,
self
)
.
on_skipped
(
host
,
item
)
if
constants
.
DISPLAY_SKIPPED_HOSTS
:
msg
=
''
if
item
:
msg
=
"skipping: [
%
s] => (item=
%
s)"
%
(
host
,
item
)
else
:
msg
=
"skipping: [
%
s]"
%
host
display
(
msg
,
color
=
'cyan'
,
runner
=
self
.
runner
)
super
(
PlaybookRunnerCallbacks
,
self
)
.
on_skipped
(
host
,
item
)
def
on_no_hosts
(
self
):
display
(
"FATAL: no hosts matched or all hosts have already failed -- aborting
\n
"
,
color
=
'red'
,
runner
=
self
.
runner
)
...
...
@@ -581,7 +582,7 @@ class PlaybookCallbacks(object):
msg
=
"TASK: [
%
s]"
%
name
if
is_conditional
:
msg
=
"NOTIFIED: [
%
s]"
%
name
if
hasattr
(
self
,
'start_at'
):
if
name
==
self
.
start_at
or
fnmatch
.
fnmatch
(
name
,
self
.
start_at
):
# we found out match, we can get rid of this now
...
...
lib/ansible/constants.py
View file @
8ed343cc
...
...
@@ -130,6 +130,7 @@ DEFAULT_LOG_PATH = shell_expand_path(get_config(p, DEFAULTS, 'log_
ANSIBLE_NOCOLOR
=
get_config
(
p
,
DEFAULTS
,
'nocolor'
,
'ANSIBLE_NOCOLOR'
,
None
,
boolean
=
True
)
ANSIBLE_NOCOWS
=
get_config
(
p
,
DEFAULTS
,
'nocows'
,
'ANSIBLE_NOCOWS'
,
None
,
boolean
=
True
)
DISPLAY_SKIPPED_HOSTS
=
get_config
(
p
,
DEFAULTS
,
'display_skipped_hosts'
,
'DISPLAY_SKIPPED_HOSTS'
,
True
,
boolean
=
True
)
ANSIBLE_SSH_ARGS
=
get_config
(
p
,
'ssh_connection'
,
'ssh_args'
,
'ANSIBLE_SSH_ARGS'
,
None
)
ANSIBLE_SSH_CONTROL_PATH
=
get_config
(
p
,
'ssh_connection'
,
'control_path'
,
'ANSIBLE_SSH_CONTROL_PATH'
,
"
%(directory)
s/ansible-ssh-
%%
h-
%%
p-
%%
r"
)
PARAMIKO_RECORD_HOST_KEYS
=
get_config
(
p
,
'paramiko_connection'
,
'record_host_keys'
,
'ANSIBLE_PARAMIKO_RECORD_HOST_KEYS'
,
True
,
boolean
=
True
)
...
...
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