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
dede1175
Commit
dede1175
authored
Dec 15, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1775 from dagwieers/boolean-yes-no
Make use of yes/no booleans in playbooks
parents
29611bde
66fb7fd9
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
30 additions
and
28 deletions
+30
-28
CHANGELOG.md
+2
-2
docsite/rst/YAMLSyntax.rst
+2
-0
docsite/rst/playbooks.rst
+2
-2
docsite/rst/playbooks2.rst
+8
-8
examples/playbooks/group_commands.yml
+1
-1
examples/playbooks/intro_example.yml
+1
-1
examples/playbooks/loop_plugins.yml
+1
-1
examples/playbooks/postgresql.yml
+4
-4
examples/playbooks/prompts.yml
+4
-4
examples/playbooks/register_logic.yml
+1
-1
hacking/templates/man.j2
+2
-2
test/playbook-included.yml
+2
-2
No files found.
CHANGELOG.md
View file @
dede1175
...
@@ -256,13 +256,13 @@ playbooks:
...
@@ -256,13 +256,13 @@ playbooks:
*
error reporting if with_items value is unbound
*
error reporting if with_items value is unbound
*
with_items no longer creates lots of tasks, creates one task that makes multiple calls
*
with_items no longer creates lots of tasks, creates one task that makes multiple calls
*
can use host_specific facts inside with_items (see above)
*
can use host_specific facts inside with_items (see above)
*
at the top level of a playbook, set 'gather_facts:
False
' to skip fact gathering
*
at the top level of a playbook, set 'gather_facts:
no
' to skip fact gathering
*
first_available_file and with_items used together will now raise an error
*
first_available_file and with_items used together will now raise an error
*
to catch typos, like 'var' for 'vars', playbooks and tasks now yell on invalid parameters
*
to catch typos, like 'var' for 'vars', playbooks and tasks now yell on invalid parameters
*
automatically load (directory_of_inventory_file)/group_vars/groupname and /host_vars/hostname in vars_files
*
automatically load (directory_of_inventory_file)/group_vars/groupname and /host_vars/hostname in vars_files
*
playbook is now colorized, set ANSIBLE_NOCOLOR=1 if you do not like this, does not colorize if not a TTY
*
playbook is now colorized, set ANSIBLE_NOCOLOR=1 if you do not like this, does not colorize if not a TTY
*
hostvars now preserved between plays (regression in 0.5 from 0.4), useful for sharing vars in multinode configs
*
hostvars now preserved between plays (regression in 0.5 from 0.4), useful for sharing vars in multinode configs
*
ignore_errors:
True
on a task can be used to allow a task to fail and not stop the play
*
ignore_errors:
yes
on a task can be used to allow a task to fail and not stop the play
*
with_items with the apt/yum module will install/remove/update everything in a single command
*
with_items with the apt/yum module will install/remove/update everything in a single command
inventory:
inventory:
...
...
docsite/rst/YAMLSyntax.rst
View file @
dede1175
...
@@ -54,6 +54,8 @@ Ansible doesn't really use these too much, but you can also specify a
...
@@ -54,6 +54,8 @@ Ansible doesn't really use these too much, but you can also specify a
boolean value (true/false) in several forms::
boolean value (true/false) in several forms::
---
---
create_key: yes
needs_agent: no
knows_oop: True
knows_oop: True
likes_emacs: TRUE
likes_emacs: TRUE
uses_cvs: false
uses_cvs: false
...
...
docsite/rst/playbooks.rst
View file @
dede1175
...
@@ -88,14 +88,14 @@ Support for running things from sudo is also available::
...
@@ -88,14 +88,14 @@ Support for running things from sudo is also available::
---
---
- hosts: webservers
- hosts: webservers
user: yourname
user: yourname
sudo:
True
sudo:
yes
You can also login as you, and then sudo to different users than root::
You can also login as you, and then sudo to different users than root::
---
---
- hosts: webservers
- hosts: webservers
user: yourname
user: yourname
sudo:
True
sudo:
yes
sudo_user: postgres
sudo_user: postgres
If you need to specify a password to sudo, run `ansible-playbook` with ``--ask-sudo-pass`` (`-K`).
If you need to specify a password to sudo, run `ansible-playbook` with ``--ask-sudo-pass`` (`-K`).
...
...
docsite/rst/playbooks2.rst
View file @
dede1175
...
@@ -67,7 +67,7 @@ write a task that looks like this::
...
@@ -67,7 +67,7 @@ write a task that looks like this::
- name: this will not be counted as a failure
- name: this will not be counted as a failure
action: command /bin/false
action: command /bin/false
ignore_errors:
True
ignore_errors:
yes
Accessing Complex Variable Data
Accessing Complex Variable Data
```````````````````````````````
```````````````````````````````
...
@@ -190,10 +190,10 @@ some other options, but otherwise works equivalently::
...
@@ -190,10 +190,10 @@ some other options, but otherwise works equivalently::
vars_prompt:
vars_prompt:
- name: "some_password"
- name: "some_password"
prompt: "Enter password"
prompt: "Enter password"
private:
True
private:
yes
- name: "release_version"
- name: "release_version"
prompt: "Product release version"
prompt: "Product release version"
private:
False
private:
no
Passing Variables On The Command Line
Passing Variables On The Command Line
...
@@ -543,7 +543,7 @@ can turn off fact gathering. This has advantages in scaling ansible in push mod
...
@@ -543,7 +543,7 @@ can turn off fact gathering. This has advantages in scaling ansible in push mod
systems, mainly, or if you are using Ansible on experimental platforms. In any play, just do this::
systems, mainly, or if you are using Ansible on experimental platforms. In any play, just do this::
- hosts: whatever
- hosts: whatever
gather_facts:
False
gather_facts:
no
Pull-Mode Playbooks
Pull-Mode Playbooks
```````````````````
```````````````````
...
@@ -663,9 +663,9 @@ if you have a large number of hosts::
...
@@ -663,9 +663,9 @@ if you have a large number of hosts::
# set up the fireball transport
# set up the fireball transport
- hosts: all
- hosts: all
gather_facts:
False
gather_facts:
no
connection: ssh # or paramiko
connection: ssh # or paramiko
sudo:
True
sudo:
yes
tasks:
tasks:
- action: fireball
- action: fireball
...
@@ -683,8 +683,8 @@ any platform. You will also need gcc and zeromq-devel installed from your packa
...
@@ -683,8 +683,8 @@ any platform. You will also need gcc and zeromq-devel installed from your packa
---
---
- hosts: all
- hosts: all
sudo:
True
sudo:
yes
gather_facts:
False
gather_facts:
no
connection: ssh
connection: ssh
tasks:
tasks:
- action: easy_install name=pip
- action: easy_install name=pip
...
...
examples/playbooks/group_commands.yml
View file @
dede1175
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
-
hosts
:
all
-
hosts
:
all
user
:
root
user
:
root
sudo
:
True
sudo
:
yes
tasks
:
tasks
:
...
...
examples/playbooks/intro_example.yml
View file @
dede1175
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
# could have also have done:
# could have also have done:
# user: mdehaan
# user: mdehaan
# sudo:
True
# sudo:
yes
# make these variables available inside of templates
# make these variables available inside of templates
# for when we use the 'template' action/module later on...
# for when we use the 'template' action/module later on...
...
...
examples/playbooks/loop_plugins.yml
View file @
dede1175
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
# see lib/ansible/runner/lookup_plugins/fileglob.py -- they can do basically anything!
# see lib/ansible/runner/lookup_plugins/fileglob.py -- they can do basically anything!
-
hosts
:
all
-
hosts
:
all
gather_facts
:
False
gather_facts
:
no
tasks
:
tasks
:
...
...
examples/playbooks/postgresql.yml
View file @
dede1175
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
#
#
---
---
-
hosts
:
webservers
-
hosts
:
webservers
sudo
:
True
sudo
:
yes
gather_facts
:
False
gather_facts
:
no
tasks
:
tasks
:
-
name
:
ensure apt cache is up to date
-
name
:
ensure apt cache is up to date
...
@@ -21,9 +21,9 @@
...
@@ -21,9 +21,9 @@
-
python-psycopg2
-
python-psycopg2
-
hosts
:
webservers
-
hosts
:
webservers
sudo
:
True
sudo
:
yes
sudo_user
:
postgres
sudo_user
:
postgres
gather_facts
:
False
gather_facts
:
no
vars
:
vars
:
dbname
:
myapp
dbname
:
myapp
...
...
examples/playbooks/prompts.yml
View file @
dede1175
...
@@ -28,16 +28,16 @@
...
@@ -28,16 +28,16 @@
vars_prompt
:
vars_prompt
:
-
name
:
"
some_password"
-
name
:
"
some_password"
prompt
:
"
Enter
password"
prompt
:
"
Enter
password"
private
:
True
private
:
yes
-
name
:
"
release_version"
-
name
:
"
release_version"
prompt
:
"
Product
release
version"
prompt
:
"
Product
release
version"
private
:
False
private
:
no
-
name
:
"
my_password2"
-
name
:
"
my_password2"
prompt
:
"
Enter
password2"
prompt
:
"
Enter
password2"
private
:
True
private
:
yes
encrypt
:
"
md5_crypt"
encrypt
:
"
md5_crypt"
confirm
:
True
confirm
:
yes
salt_size
:
7
salt_size
:
7
salt
:
"
foo"
salt
:
"
foo"
...
...
examples/playbooks/register_logic.yml
View file @
dede1175
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
# available to tasks and templates made further down in the execution flow.
# available to tasks and templates made further down in the execution flow.
-
action
:
shell grep hi /etc/motd
-
action
:
shell grep hi /etc/motd
ignore_errors
:
True
ignore_errors
:
yes
register
:
motd_result
register
:
motd_result
# and here we access the register. Note that variable is structured data because
# and here we access the register. Note that variable is structured data because
...
...
hacking/templates/man.j2
View file @
dede1175
...
@@ -21,9 +21,9 @@
...
@@ -21,9 +21,9 @@
{% if v.get('choices') %}
{% if v.get('choices') %}
.IR Choices :
.IR Choices :
{% for choice in v.get('choices',[]) %}
@{ choice }@
{% if not loop.last %},{%else%}.{%endif%}{% endfor %}{% endif %}
{% for choice in v.get('choices',[]) %}
{% if choice == True %}yes{%elif choice == False %}no{% else %}@{ choice }@{% endif %}
{% if not loop.last %},{%else%}.{%endif%}{% endfor %}{% endif %}
{% if v.get('required') %}(required){% endif %}
{% if v.get('required') %}(required){% endif %}
{% if v.get('default') %} (default:
@{ v.get('default') }@)
{% endif %}
{% if v.get('default') %} (default:
{% if v.get('default') == True %}yes{%elif v.get('default') == False %}no{% else %}@{ v.get('default') }@){% endif %}
{% endif %}
{#---------------------------------------------- #}
{#---------------------------------------------- #}
{% if v.get('version_added') %}
{% if v.get('version_added') %}
(Added in Ansible version @{ v.get('version_added') }@.)
(Added in Ansible version @{ v.get('version_added') }@.)
...
...
test/playbook-included.yml
View file @
dede1175
---
---
-
hosts
:
all
-
hosts
:
all
connection
:
local
connection
:
local
gather_facts
:
False
gather_facts
:
no
tasks
:
tasks
:
-
action
:
debug msg="$variable"
-
action
:
debug msg="$variable"
...
@@ -9,6 +9,6 @@
...
@@ -9,6 +9,6 @@
connection
:
local
connection
:
local
vars
:
vars
:
-
ugly
:
var
-
ugly
:
var
gather_facts
:
False
gather_facts
:
no
tasks
:
tasks
:
-
action
:
debug msg="$variable"
-
action
:
debug msg="$variable"
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