feat!: Rewrite configure script in ansible (#822)
* feat: smol changes Signed-off-by: Devin Buhl <devin@buhl.casa> * feat!: Rewrite configure script in ansible Signed-off-by: Devin Buhl <devin@buhl.casa> * fix: add comment for real path Signed-off-by: Devin Buhl <devin@buhl.casa> * feat: verification is done Signed-off-by: Devin Buhl <devin@buhl.casa> * fix: do not need net common Signed-off-by: Devin Buhl <devin@buhl.casa> * chore: clean up old comments Signed-off-by: Devin Buhl <devin@buhl.casa> * chore: clean up old comments Signed-off-by: Devin Buhl <devin@buhl.casa> * feat: finish up ansible host generation and more Signed-off-by: Devin Buhl <devin@buhl.casa> * fix: backup/restore sops config between tasks Signed-off-by: Devin Buhl <devin@buhl.casa> * chore: clean up test comments Signed-off-by: Devin Buhl <devin@buhl.casa> * fix: use ansible template on template Signed-off-by: Devin Buhl <devin@buhl.casa> * Update template/vars/config.sample.yaml Co-authored-by: Manuel Rüger <manuel@rueg.eu> * Update template/tasks/verify_cli.yaml * chore: update readme Signed-off-by: Devin Buhl <devin@buhl.casa> * chore: update readme Signed-off-by: Devin Buhl <devin@buhl.casa> * Update README.md Co-authored-by: Manuel Rüger <manuel@rueg.eu> * fix: move bcrypt logic to template Signed-off-by: Devin Buhl <devin@buhl.casa> * fix: derp Signed-off-by: Devin Buhl <devin@buhl.casa> --------- Signed-off-by: Devin Buhl <devin@buhl.casa> Co-authored-by: Manuel Rüger <manuel@rueg.eu>
This commit is contained in:
1 parent
26164c7278
commit
de0ed1c70a
58 files changed
+698
-764
No files matched your search
@@ -0,0 +1,91 @@
|
||||
---
|
||||
version: "3"
|
||||
|
||||
env:
|
||||
K8S_AUTH_KUBECONFIG: "{{.ROOT_DIR}}/kubeconfig"
|
||||
|
||||
vars:
|
||||
ANSIBLE_PLAYBOOK_DIR: "{{.ANSIBLE_DIR}}/playbooks"
|
||||
ANSIBLE_INVENTORY_DIR: "{{.ANSIBLE_DIR}}/inventory"
|
||||
|
||||
tasks:
|
||||
|
||||
init:
|
||||
desc: Install / Upgrade Ansible galaxy deps
|
||||
dir: "{{.ANSIBLE_DIR}}"
|
||||
cmds:
|
||||
- pip3 install --user --requirement requirements.txt
|
||||
- ansible-galaxy install -r requirements.yaml --roles-path ~/.ansible/roles --force
|
||||
- ansible-galaxy collection install -r requirements.yaml --collections-path ~/.ansible/collections --force
|
||||
|
||||
list:
|
||||
desc: List all the hosts
|
||||
dir: "{{.ANSIBLE_DIR}}"
|
||||
cmds:
|
||||
- ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml --list-hosts
|
||||
|
||||
prepare:
|
||||
desc: Prepare all the k8s nodes for running k3s
|
||||
dir: "{{.ANSIBLE_DIR}}"
|
||||
cmds:
|
||||
- ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-prepare.yaml
|
||||
env:
|
||||
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"
|
||||
|
||||
install:
|
||||
desc: Install Kubernetes on the nodes
|
||||
dir: "{{.ANSIBLE_DIR}}"
|
||||
cmds:
|
||||
- ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-installation.yaml
|
||||
env:
|
||||
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"
|
||||
|
||||
upgrade:
|
||||
desc: Upgrade Kubernetes on the nodes (currently this only upgrades kube-vip)
|
||||
dir: "{{.ANSIBLE_DIR}}"
|
||||
cmds:
|
||||
- ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-upgrade.yaml
|
||||
env:
|
||||
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"
|
||||
|
||||
nuke:
|
||||
desc: Uninstall Kubernetes on the nodes
|
||||
dir: "{{.ANSIBLE_DIR}}"
|
||||
interactive: true
|
||||
cmds:
|
||||
- ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-nuke.yaml
|
||||
- task: force-reboot
|
||||
env:
|
||||
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"
|
||||
|
||||
ping:
|
||||
desc: Ping all the hosts
|
||||
dir: "{{.ANSIBLE_DIR}}"
|
||||
cmds:
|
||||
- ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml --one-line -m 'ping'
|
||||
env:
|
||||
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"
|
||||
|
||||
uptime:
|
||||
desc: Uptime of all the hosts
|
||||
dir: "{{.ANSIBLE_DIR}}"
|
||||
cmds:
|
||||
- ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml --one-line -a 'uptime'
|
||||
env:
|
||||
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"
|
||||
|
||||
force-reboot:
|
||||
desc: Reboot all the k8s nodes
|
||||
dir: "{{.ANSIBLE_DIR}}"
|
||||
cmds:
|
||||
- ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-reboot.yaml
|
||||
env:
|
||||
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"
|
||||
|
||||
force-poweroff:
|
||||
desc: Shutdown all the k8s nodes
|
||||
dir: "{{.ANSIBLE_DIR}}"
|
||||
cmds:
|
||||
- ansible kubernetes -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml -a '/usr/bin/systemctl poweroff' --become
|
||||
env:
|
||||
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"
|
||||
Reference in new issue
Block a user