generated from onedr0p/cluster-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAnsibleTasks.yml
106 lines (88 loc) · 3.3 KB
/
AnsibleTasks.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
version: "3"
env:
ANSIBLE_CONFIG: "{{.PROJECT_DIR}}/ansible.cfg"
vars:
ANSIBLE_PLAYBOOK_DIR: "{{.ANSIBLE_DIR}}/playbooks"
ANSIBLE_INVENTORY_DIR: "{{.ANSIBLE_DIR}}/inventory"
tasks:
deps:
desc: Upgrade Ansible galaxy deps
dir: provision/ansible
cmds:
- "ansible-galaxy install -r requirements.yaml --force"
list:
desc: List all the hosts
dir: provision/ansible
cmds:
- "ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml --list-hosts"
playbook:vpn-install:
desc: Prepare VPN node
dir: provision/ansible
cmds:
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/vpn-install.yaml"
playbook:3x-ui-install:
desc: Prepare VPN node
dir: provision/ansible
cmds:
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/3x-ui-install.yaml"
playbook:vpn-gateway-install:
desc: Prepare VPN node
dir: provision/ansible
cmds:
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/vpn-gateway-install.yaml"
playbook:cctv-install:
desc: Prepare CCTV node
dir: provision/ansible
cmds:
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cctv-install.yaml"
playbook:mail-install:
desc: Prepare Mail node
dir: provision/ansible
cmds:
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/mail-install.yaml"
playbook:ubuntu-prepare:
desc: Prepare all the k8s nodes for running k3s
dir: provision/ansible
cmds:
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/ubuntu-prepare.yaml"
playbook:ubuntu-upgrade:
desc: Upgrade all the k8s nodes operating system
dir: provision/ansible
cmds:
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/ubuntu-upgrade.yaml"
playbook:k3s-install:
desc: Install Kubernetes on the nodes
dir: provision/ansible
cmds:
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/k3s-install.yaml"
playbook:nvidia-ctr-install:
desc: Install Kubernetes on the nodes
dir: provision/ansible
cmds:
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/nvidia-ctr-install.yaml"
playbook:k3s-nuke:
desc: Uninstall Kubernetes on the nodes
dir: provision/ansible
cmds:
- "ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/k3s-nuke.yaml"
adhoc:ping:
desc: Ping all the hosts
dir: provision/ansible
cmds:
- "ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml --one-line -m 'ping'"
adhoc:uptime:
desc: Uptime of all the hosts
dir: provision/ansible
cmds:
- ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml --one-line -a 'uptime'
adhoc:reboot:
desc: Reboot all the k8s nodes
dir: provision/ansible
cmds:
- "ansible kubernetes -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml -a '/usr/bin/systemctl reboot' --become"
adhoc:poweroff:
desc: Shutdown all the k8s nodes
dir: provision/ansible
cmds:
- "ansible kubernetes -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml -a '/usr/bin/systemctl poweroff' --become"