mirror of
https://github.com/ansible/ansible.git
synced 2026-08-07 16:14:36 +02:00
Show more whitespace throughout playbook examples to encourage better standards in first playbooks folks write.
This commit is contained in:
@@ -136,6 +136,7 @@ Filters Often Used With Conditionals
|
||||
The following tasks are illustrative of how filters can be used with conditionals::
|
||||
|
||||
tasks:
|
||||
|
||||
- shell: /usr/bin/foo
|
||||
register: result
|
||||
ignore_errors: True
|
||||
@@ -691,13 +692,16 @@ the main playbook.
|
||||
You can do this by using an external variables file, or files, just like this::
|
||||
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
remote_user: root
|
||||
vars:
|
||||
favcolor: blue
|
||||
vars_files:
|
||||
- /vars/external_vars.yml
|
||||
|
||||
tasks:
|
||||
|
||||
- name: this is just a placeholder
|
||||
command: /bin/echo foo
|
||||
|
||||
@@ -731,8 +735,10 @@ This is useful, for, among other things, setting the hosts group or the user for
|
||||
Example::
|
||||
|
||||
---
|
||||
- remote_user: '{{ user }}'
|
||||
hosts: '{{ hosts }}'
|
||||
|
||||
- hosts: '{{ hosts }}'
|
||||
remote_user: '{{ user }}'
|
||||
|
||||
tasks:
|
||||
- ...
|
||||
|
||||
@@ -765,12 +771,15 @@ As an example, the name of the Apache package may be different between CentOS an
|
||||
but it is easily handled with a minimum of syntax in an Ansible Playbook::
|
||||
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
remote_user: root
|
||||
vars_files:
|
||||
- "vars/common.yml"
|
||||
- [ "vars/{{ ansible_os_family }}.yml", "vars/os_defaults.yml" ]
|
||||
|
||||
tasks:
|
||||
|
||||
- name: make sure apache is running
|
||||
service: name={{ apache }} state=running
|
||||
|
||||
|
||||
Reference in New Issue
Block a user