-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice_facts_role_multiple_plays.yml
48 lines (46 loc) · 1.4 KB
/
service_facts_role_multiple_plays.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
---
- name: Get services info from system
hosts: all
gather_facts: yes
become: yes
vars:
ansible_linux_folder: /opt/Metrolinx/Ansible/temp
ansible_linux_archive_folder: /opt/Metrolinx/Ansible/archive
roles:
- r7_prepatch_services
- name: Second play - stop a couple services
hosts: all
gather_facts: yes
become: yes
vars:
ansible_linux_folder: /opt/Metrolinx/Ansible/temp
ansible_linux_archive_folder: /opt/Metrolinx/Ansible/archive
tasks:
- name: Do something else
ping:
- name: Stop services to create delta
service:
name: "{{ item }}"
state: stopped
enabled: no
ignore_errors: true
loop:
- crond
- ntpd
- chronyd
- name: Third play running postpatch role
hosts: all
gather_facts: yes
become: yes
vars:
ansible_linux_folder: /opt/Metrolinx/Ansible/temp
ansible_linux_archive_folder: /opt/Metrolinx/Ansible/archive
pre_tasks:
- name: No reason to fetch files because we have them in memory between Plays
debug:
msg: "No reason to fetch files because we have them in memory between Plays"
- name: Not true - No reason to fetch files because we have them in memory between Plays
debug:
msg: "Need to fetch files because we may stop after pre services role, and then only execute post services role at a later point in time."
roles:
- r7_postpatch_services