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
8991e403
Commit
8991e403
authored
Mar 26, 2014
by
James Tanner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #6705 Give each role a unique uuid and apply tags only to tasks matching the uuid
parent
c9f93ccd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
lib/ansible/playbook/play.py
+13
-5
No files found.
lib/ansible/playbook/play.py
View file @
8991e403
...
@@ -26,6 +26,7 @@ import pipes
...
@@ -26,6 +26,7 @@ import pipes
import
shlex
import
shlex
import
os
import
os
import
sys
import
sys
import
uuid
class
Play
(
object
):
class
Play
(
object
):
...
@@ -363,6 +364,13 @@ class Play(object):
...
@@ -363,6 +364,13 @@ class Play(object):
new_tasks
.
append
(
dict
(
meta
=
'flush_handlers'
))
new_tasks
.
append
(
dict
(
meta
=
'flush_handlers'
))
roles
=
self
.
_build_role_dependencies
(
roles
,
[],
self
.
vars
)
roles
=
self
.
_build_role_dependencies
(
roles
,
[],
self
.
vars
)
# give each role a uuid
for
idx
,
val
in
enumerate
(
roles
):
this_uuid
=
str
(
uuid
.
uuid4
())
roles
[
idx
][
0
][
'role_uuid'
]
=
this_uuid
roles
[
idx
][
-
2
][
'role_uuid'
]
=
this_uuid
role_names
=
[]
role_names
=
[]
for
(
role
,
role_path
,
role_vars
,
default_vars
)
in
roles
:
for
(
role
,
role_path
,
role_vars
,
default_vars
)
in
roles
:
...
@@ -725,21 +733,21 @@ class Play(object):
...
@@ -725,21 +733,21 @@ class Play(object):
role_tags
=
{}
role_tags
=
{}
for
task
in
self
.
_ds
[
'tasks'
]:
for
task
in
self
.
_ds
[
'tasks'
]:
if
'role_name'
in
task
:
if
'role_name'
in
task
:
this_role
=
task
[
'role_name'
]
this_role
=
task
[
'role_name'
]
+
"-"
+
task
[
'vars'
][
'role_uuid'
]
if
this_role
not
in
role_tags
:
if
this_role
not
in
role_tags
:
role_tags
[
this_role
]
=
[]
role_tags
[
this_role
]
=
[]
if
'tags'
in
task
[
'vars'
]:
if
'tags'
in
task
[
'vars'
]:
if
isinstance
(
task
[
'vars'
][
'tags'
],
basestring
):
if
isinstance
(
task
[
'vars'
][
'tags'
],
basestring
):
role_tags
[
t
ask
[
'role_name'
]
]
+=
shlex
.
split
(
task
[
'vars'
][
'tags'
])
role_tags
[
t
his_role
]
+=
shlex
.
split
(
task
[
'vars'
][
'tags'
])
else
:
else
:
role_tags
[
t
ask
[
'role_name'
]
]
+=
task
[
'vars'
][
'tags'
]
role_tags
[
t
his_role
]
+=
task
[
'vars'
][
'tags'
]
# apply each role's tags to it's tasks
# apply each role's tags to it's tasks
for
idx
,
val
in
enumerate
(
self
.
_tasks
):
for
idx
,
val
in
enumerate
(
self
.
_tasks
):
if
hasattr
(
val
,
'role_name'
)
:
if
getattr
(
val
,
'role_name'
,
None
)
is
not
None
:
this_role
=
val
.
role_name
this_role
=
val
.
role_name
+
"-"
+
val
.
module_vars
[
'role_uuid'
]
if
this_role
in
role_tags
:
if
this_role
in
role_tags
:
self
.
_tasks
[
idx
]
.
tags
=
sorted
(
set
(
self
.
_tasks
[
idx
]
.
tags
+
role_tags
[
this_role
]))
self
.
_tasks
[
idx
]
.
tags
=
sorted
(
set
(
self
.
_tasks
[
idx
]
.
tags
+
role_tags
[
this_role
]))
...
...
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