-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal.yml
73 lines (63 loc) · 1.5 KB
/
local.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
65
66
67
68
69
70
71
72
73
---
#
# Pre tasks
#
- hosts: all
tags: always
become: true
pre_tasks:
- name: "pre-run | Load variables from 'host_vars/{{ansible_hostname}}.yml'"
include_vars:
file: "host_vars/{{ansible_hostname}}.yml"
- name: pre-run | Display all variables/facts known for a host
ansible.builtin.debug:
var: hostvars[inventory_hostname]
verbosity: 4
- name: pre-run | Update apt cache
tags: always
apt:
update_cache: '{{ apt.update_cache }}'
changed_when: False
#
# Install roles
#
- hosts: all
tags: base
become: true
roles:
- base
- hosts: workstation
tags: workstation
become: true
roles:
- role: workstation
- role: geerlingguy.docker
when: docker is defined and docker == true
#
# Post tasks
#
- hosts: all
become: true
tasks:
- name: post-run | Cleanup apt cache and remove orphan packages
tags: always
apt:
autoclean: '{{ apt.update_cache }}'
autoremove: '{{ apt.autoremove }}'
changed_when: false
when: ansible_distribution in ["Debian", "Ubuntu"]
- name: post-run | Send completion alert
tags: always
uri:
url: https://hc-ping.com/{{ healthcheck_uuid }}
changed_when: False
when:
- task_failed is not defined
- healthcheck_uuid is defined
- name: post-run | Send failure alert
tags: always
uri:
url: https://hc-ping.com/{{ healthcheck_uuid }}/fail
when:
- task_failed is defined
- task_failed == true