generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplaybook.yml
64 lines (52 loc) · 1.55 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
#
# devshop.platform.playbook
#
# Global playbook for a devshop platform.
#
# Import this playbook in your own playbook in your own platform codebase.
# Optionally, set vars in the task or include a vars file by setting 'platform_vars_file'
#
# - name: Import the DevShop.Platform Playbook.
# import_playbook: roles/contrib/ansible_collections/devshop/platform/playbook.yml
#
# vars:
# platform_vars_file: "vars.yml" # Path relative to this playbook file.
#
- name: Servers
collections:
- devshop.platform
hosts: servers
become: yes
# If the play has tags, `gather_facts` uses those tags.
# If the play does NOT have tags, `gather_facts` uses the `always` tag.
# So, instead of this chaos, just gather facts in pre_tasks.
gather_facts: no
pre_tasks:
- name: Include platform vars file from importing playbook.
include_vars: "{{ lookup('env', 'PWD') }}/{{ platform_vars_file }}"
when: platform_vars_file is defined
tags: [always]
roles:
- role: host
tags:
- servers
# @TODO: Separate host.services role so we can skip it if tags=apps.
- role: services
tags:
- servers
- name: Apps
hosts: apps
become: yes
gather_facts: no
# Run with --tags servers to include the entire play.
tags:
- apps
pre_tasks:
- name: Include platform vars file from importing playbook.
include_vars: "{{ lookup('env', 'PWD') }}/{{ platform_vars_file }}"
when: platform_vars_file is defined
tags: [always]
roles:
- name: app
delegate_to: "{{ devshop_app_host }}"