feat(ansible): rename playbooks and update AnsibleTasks

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl committed 2022-06-08 09:42:09 -04:00
1 parent e7d8409bd7
commit 46f1a392fb
15 files changed
+39 -12

No files matched your search

+6 -5
View File
@@ -27,20 +27,21 @@ tasks:
desc: Prepare all the k8s nodes for running k3s desc: Prepare all the k8s nodes for running k3s
dir: provision/ansible dir: provision/ansible
cmds: cmds:
- ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/ubuntu-prepare.yml - ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-prepare.yml
install: install:
desc: Install Kubernetes on the nodes desc: Install Kubernetes on the nodes
dir: provision/ansible dir: provision/ansible
cmds: cmds:
- ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/k3s-install.yml - ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-installation.yml
nuke: nuke:
desc: Uninstall Kubernetes on the nodes desc: Uninstall Kubernetes on the nodes
dir: provision/ansible dir: provision/ansible
interactive: true
cmds: cmds:
- ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/k3s-nuke.yml - ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-nuke.yml
- defer: ansible kubernetes -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml -a '/usr/bin/systemctl reboot' --become - task: reboot
ping: ping:
desc: Ping all the hosts desc: Ping all the hosts
@@ -58,7 +59,7 @@ tasks:
desc: Reboot all the k8s nodes desc: Reboot all the k8s nodes
dir: provision/ansible dir: provision/ansible
cmds: cmds:
- ansible kubernetes -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml -a '/usr/bin/systemctl reboot' --become - ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-reboot.yml
poweroff: poweroff:
desc: Shutdown all the k8s nodes desc: Shutdown all the k8s nodes
@@ -5,9 +5,21 @@
become: true become: true
gather_facts: true gather_facts: true
any_errors_fatal: true any_errors_fatal: true
vars_prompt:
- name: nuke
prompt: |-
Are you sure you want to nuke this cluster?
Type YES I WANT TO DESTROY THIS CLUSTER to proceed
default: "n"
private: false
pre_tasks: pre_tasks:
- name: Check for confirmation
ansible.builtin.fail:
msg: Aborted nuking the cluster
when: nuke != 'YES I WANT TO DESTROY THIS CLUSTER'
- name: Pausing for 5 seconds... - name: Pausing for 5 seconds...
pause: ansible.builtin.pause:
seconds: 5 seconds: 5
tasks: tasks:
- name: Kill k3s - name: Kill k3s
@@ -10,4 +10,4 @@
pause: pause:
seconds: 5 seconds: 5
roles: roles:
- ubuntu - prepare
@@ -0,0 +1,15 @@
---
- hosts:
- master
- worker
become: true
gather_facts: true
any_errors_fatal: true
pre_tasks:
- name: Pausing for 5 seconds...
ansible.builtin.pause:
seconds: 5
tasks:
- name: Reboot
ansible.builtin.reboot:
msg: Rebooting nodes
@@ -63,11 +63,11 @@ spec:
requiredDuringSchedulingIgnoredDuringExecution: requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms: nodeSelectorTerms:
- matchExpressions: - matchExpressions:
- key: node-role.kubernetes.io/master - key: node-role.kubernetes.io/master
operator: Exists operator: Exists
- matchExpressions: - matchExpressions:
- key: node-role.kubernetes.io/control-plane - key: node-role.kubernetes.io/control-plane
operator: Exists operator: Exists
tolerations: tolerations:
- effect: NoSchedule - effect: NoSchedule
operator: Exists operator: Exists
@@ -37,4 +37,3 @@
net.bridge.bridge-nf-call-ip6tables: 1 net.bridge.bridge-nf-call-ip6tables: 1
net.ipv4.conf.default.rp_filter: 0 net.ipv4.conf.default.rp_filter: 0
net.ipv4.conf.all.rp_filter: 0 net.ipv4.conf.all.rp_filter: 0