mirror of
https://github.com/haidaraM/ansible-playbook-grapher
synced 2024-11-12 23:17:07 +00:00
50 lines
1.3 KiB
YAML
50 lines
1.3 KiB
YAML
---
|
|
- 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"
|
|
tasks:
|
|
- name: Install tree
|
|
yum:
|
|
name: tree
|
|
- name: Install Apache
|
|
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "6")
|
|
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 }}
|
|
- 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
|
|
|