prole/infrastructure/playbooks/k3s_mariadb_datastore_rollout.yml

55 lines
1.8 KiB
YAML

---
- name: Roll out k3s config for external MariaDB datastore (servers)
hosts: k3s_hosts
gather_facts: false
become: true
serial: 1
pre_tasks:
- name: Require explicit acknowledgement (this changes the k3s datastore)
ansible.builtin.assert:
that:
- k3s_datastore_migration_ack | default(false) | bool
fail_msg: >-
Refusing to proceed without k3s_datastore_migration_ack=true.
Switching k3s datastore backends may require a rebuild/migration plan.
- name: Only run on k3s server nodes
ansible.builtin.meta: end_host
when: k3s_role | default('') != 'server'
- name: Require k3s_datastore_endpoint for MariaDB datastore
ansible.builtin.assert:
that:
- (k3s_datastore_endpoint | default('')) | length > 0
fail_msg: "k3s_datastore_endpoint is empty on {{ inventory_hostname }}"
tasks:
- name: Apply k3s install/config changes (server)
ansible.builtin.import_role:
name: k3s
tasks_from: install
- name: Roll out k3s config for external MariaDB datastore (agents)
hosts: k3s_hosts
gather_facts: false
become: true
serial: 1
pre_tasks:
- name: Require explicit acknowledgement (this changes the k3s datastore)
ansible.builtin.assert:
that:
- k3s_datastore_migration_ack | default(false) | bool
fail_msg: >-
Refusing to proceed without k3s_datastore_migration_ack=true.
Switching k3s datastore backends may require a rebuild/migration plan.
- name: Only run on k3s agent nodes
ansible.builtin.meta: end_host
when: k3s_role | default('') != 'agent'
tasks:
- name: Apply k3s install/config changes (agent)
ansible.builtin.import_role:
name: k3s
tasks_from: install