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
f7cff27f
Commit
f7cff27f
authored
Feb 26, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drastically simply playbook syntax
parent
136d8fa3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
30 deletions
+18
-30
examples/playbook.yml
+11
-25
lib/ansible/playbook.py
+7
-5
No files found.
examples/playbook.yml
View file @
f7cff27f
-
pattern
:
'
*'
-
pattern
:
'
*'
hosts
:
/etc/ansible/hosts
hosts
:
/etc/ansible/hosts
tasks
:
tasks
:
-
do
:
-
name
:
config step
-
configure template & module variables for future template calls
action
:
setup a=2 b=3 c=4
-
setup a=2 b=3 c=4
-
name
:
copy comand
-
do
:
action
:
copy src=/srv/a dest=/srv/b
-
copy a file from the local disk to the remote
-
copy src=/srv/a dest=/srv/b
notify
:
notify
:
-
restart apache
-
restart apache
-
do
:
-
name
:
template step
-
template from local file template.j2 to remote location /srv/file.out
action
:
template src=/srv/template.j2 dest=/srv/file.out
-
template src=/srv/template.j2 dest=/srv/file.out
notify
:
notify
:
-
restart apache
-
restart apache
-
quack like a duck
-
name
:
execute bin
false
-
do
:
comment
:
call something that will fail just to demo failure counts and such
-
if running as non-root whne you template, you should specify the MD file (1)
action
:
command /bin/false
-
setup a=3 b=4 c=5 metadata=/tmp/metadata.json
-
do
:
-
if running as non-root when you template, you should specify the MD file (2)
-
template src=/srv/template.j2 dest=/srv/file2.out metadata=/tmp/metadata.json
-
do
:
-
call something that will fail just to demo failure counts and such
-
command /bin/false
handlers
:
handlers
:
-
do
:
-
name
:
restart apache
-
restart apache
action
:
service name=httpd ensure=restarted
-
service name=httpd ensure=restarted
-
do
:
-
quack like a duck
-
command /bin/true
lib/ansible/playbook.py
View file @
f7cff27f
...
@@ -113,9 +113,11 @@ class PlayBook(object):
...
@@ -113,9 +113,11 @@ class PlayBook(object):
# load the module name and parameters from the task
# load the module name and parameters from the task
# entry
# entry
instructions
=
task
[
'do'
]
name
=
task
[
'name'
]
(
comment
,
module_details
)
=
instructions
action
=
task
[
'action'
]
tokens
=
shlex
.
split
(
module_details
)
comment
=
task
.
get
(
'comment'
,
''
)
tokens
=
shlex
.
split
(
action
)
module_name
=
tokens
[
0
]
module_name
=
tokens
[
0
]
module_args
=
tokens
[
1
:]
module_args
=
tokens
[
1
:]
...
@@ -126,9 +128,9 @@ class PlayBook(object):
...
@@ -126,9 +128,9 @@ class PlayBook(object):
if
self
.
verbose
:
if
self
.
verbose
:
if
not
conditional
:
if
not
conditional
:
print
"
\n
TASK [
%
s]"
%
(
comment
)
print
"
\n
TASK [
%
s]"
%
(
name
)
else
:
else
:
print
"
\n
NOTIFIED [
%
s]"
%
(
comment
)
print
"
\n
NOTIFIED [
%
s]"
%
(
name
)
# load up an appropriate ansible runner to
# load up an appropriate ansible runner to
# run the task in parallel
# run the task in parallel
...
...
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