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
dir: provision/ansible
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:
desc: Install Kubernetes on the nodes
dir: provision/ansible
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:
desc: Uninstall Kubernetes on the nodes
dir: provision/ansible
interactive: true
cmds:
- ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml {{.ANSIBLE_PLAYBOOK_DIR}}/k3s-nuke.yml
- defer: 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-nuke.yml
- task: reboot
ping:
desc: Ping all the hosts
@@ -58,7 +59,7 @@ tasks:
desc: Reboot all the k8s nodes
dir: provision/ansible
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:
desc: Shutdown all the k8s nodes
@@ -5,9 +5,21 @@
become: true
gather_facts: 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:
- 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...
pause:
ansible.builtin.pause:
seconds: 5
tasks:
- name: Kill k3s
@@ -10,4 +10,4 @@
pause:
seconds: 5
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:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/master
operator: Exists
- key: node-role.kubernetes.io/master
operator: Exists
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists
- key: node-role.kubernetes.io/control-plane
operator: Exists
tolerations:
- effect: NoSchedule
operator: Exists
@@ -37,4 +37,3 @@
net.bridge.bridge-nf-call-ip6tables: 1
net.ipv4.conf.default.rp_filter: 0
net.ipv4.conf.all.rp_filter: 0