feat(post-checks): add option to skip post-checks

This commit is contained in:
Xan Manning 2022-09-02 18:02:06 +01:00
parent 25a17b8511
commit 21fe3bccbf
No known key found for this signature in database
GPG Key ID: FEBA410BBAD454FF
5 changed files with 19 additions and 8 deletions

View File

@ -188,11 +188,12 @@ configuration.
The below variables are used to change the way the role executes in Ansible, The below variables are used to change the way the role executes in Ansible,
particularly with regards to privilege escalation. particularly with regards to privilege escalation.
| Variable | Description | Default Value | | Variable | Description | Default Value |
|-----------------------|----------------------------------------------------------------|---------------| |------------------------|----------------------------------------------------------------|---------------|
| `k3s_skip_validation` | Skip all tasks that validate configuration. | `false` | | `k3s_skip_validation` | Skip all tasks that validate configuration. | `false` |
| `k3s_skip_env_checks` | Skip all tasks that check environment configuration. | `false` | | `k3s_skip_env_checks` | Skip all tasks that check environment configuration. | `false` |
| `k3s_become` | Escalate user privileges for tasks that need root permissions. | `false` | | `k3s_skip_post_checks` | Skip all tasks that check post execution state. | `false` |
| `k3s_become` | Escalate user privileges for tasks that need root permissions. | `false` |
#### Important note about Python #### Important note about Python

View File

@ -38,6 +38,9 @@ k3s_skip_validation: false
# Skip all tasks that check environment configuration # Skip all tasks that check environment configuration
k3s_skip_env_checks: false k3s_skip_env_checks: false
# Skip post-checks
k3s_skip_post_checks: false
# Installation directory for k3s # Installation directory for k3s
k3s_install_dir: /usr/local/bin k3s_install_dir: /usr/local/bin

View File

@ -13,6 +13,7 @@
node-ip: "{{ ansible_default_ipv4.address }}" node-ip: "{{ ansible_default_ipv4.address }}"
snapshotter: native snapshotter: native
k3s_skip_validation: "{{ k3s_service_handler[ansible_service_mgr] == 'service' }}" k3s_skip_validation: "{{ k3s_service_handler[ansible_service_mgr] == 'service' }}"
k3s_skip_post_checks: "{{ ansible_os_family | lower == 'redhat' }}"
pre_tasks: pre_tasks:
- name: Set each node to be a control node - name: Set each node to be a control node
ansible.builtin.set_fact: ansible.builtin.set_fact:

View File

@ -93,10 +93,14 @@
- not k3s_primary_control_node - not k3s_primary_control_node
- import_tasks: post_checks_control_plane.yml - import_tasks: post_checks_control_plane.yml
when: not k3s_skip_validation when:
- not k3s_skip_validation
- not k3s_skip_post_checks
- name: Flush Handlers - name: Flush Handlers
ansible.builtin.meta: flush_handlers ansible.builtin.meta: flush_handlers
- import_tasks: post_checks_nodes.yml - import_tasks: post_checks_nodes.yml
when: not k3s_skip_validation when:
- not k3s_skip_validation
- not k3s_skip_post_checks

View File

@ -7,4 +7,6 @@
- import_tasks: ensure_uninstalled.yml - import_tasks: ensure_uninstalled.yml
- import_tasks: post_checks_uninstalled.yml - import_tasks: post_checks_uninstalled.yml
when: not k3s_skip_validation when:
- not k3s_skip_validation
- not k3s_skip_post_checks