feat: add task to create a monthly cronjob for restarting k3s

This commit is contained in:
Sebastian Mark 2024-03-13 09:28:16 +01:00
parent 4d2f192a01
commit 4359716e07

View file

@ -1,7 +1,7 @@
--- ---
- hosts: all - name: Install k3s server
hosts: all
gather_facts: false gather_facts: false
name: Install k3s server
tags: k3s-server tags: k3s-server
tasks: tasks:
- name: Download k3s install script - name: Download k3s install script
@ -20,15 +20,20 @@
name: k3s name: k3s
state: started state: started
enabled: true enabled: true
- name: Add restart cronjob
ansible.builtin.cron:
name: "restart k3s (and regenerate certs if necessary)"
special_time: monthly
job: "systemctl restart k3s"
- name: Get kubeconfig - name: Get kubeconfig
ansible.builtin.fetch: ansible.builtin.fetch:
src: /etc/rancher/k3s/k3s.yaml src: /etc/rancher/k3s/k3s.yaml
dest: kubeconfig_{{ ansible_host }}.yml dest: kubeconfig_{{ ansible_host }}.yml
flat: true flat: true
- hosts: all - name: Deploy baseline
hosts: all
gather_facts: false gather_facts: false
name: Deploy baseline
tags: baseline tags: baseline
tasks: tasks:
- name: Copy manifest - name: Copy manifest