ansible-playbook-grapher/tests/fixtures/with_block.yml

51 lines
1.3 KiB
YAML
Raw Permalink Normal View History

2019-02-18 18:40:54 +00:00
---
- hosts: all
pre_tasks:
- name: Include role
include_role:
name: fake_role
- name: Block in pre task
block:
- name: debug
debug:
msg: "pre task debug"
2019-02-18 18:40:54 +00:00
tasks:
- name: Install tree
yum:
name: tree
2019-02-18 18:40:54 +00:00
- name: Install Apache
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "6")
2019-02-18 18:40:54 +00:00
block:
- name: Install some packages
yum:
name: "{{ item }}"
state: installed
with_items:
- httpd
- memcached
- template:
src: templates/src.j2
dest: /etc/foo.conf
- block:
- get_url: url={{ remote_database_dump }} dest={{ local_database_dump }}
when: "True"
- command: pg_restore -d {{ dbname }} {{ local_database_dump }}
2019-02-18 18:40:54 +00:00
- service:
name: bar
state: started
enabled: True
- name: Create a username for tomcat
user:
name: tomcatadm
group: users
post_tasks:
- name: Debug
debug:
msg: "Debug 1"
- name: My post task block
block:
- template:
src: templates/src.j2
dest: /etc/foo.conf