mirror of
https://github.com/PyratLabs/ansible-role-k3s
synced 2024-11-08 14:43:28 +01:00
Fix(tests): Resolve Ansible Lint warnings and fix Molecule tests on GitHub Actions (#202)
* fix(ansible-lint): FQDN and `name` * fix(ansible-lint): add `name` and FQDN for module call * fix(ansible-lint): add `name` to tasks and FQDN for module * fix(ansible-lint): add task `name` and FQDN for module calls * fix(ansible-lint): last `include_tasks` * fix(ansible-lint): add task names and FQDN * refactor: `Ensure` to `Run` * [skip ci]refactor: add exist and seperate ensure installed node task, mention build cluster * [skip ci]refactor: Pipe seperator * [skip ci]refactor: run * refactor: remove quotes as other files don't use them For templated vars in task name * [skip ci]refactor: task names, use `Run` * [skip ci]refactor: use variable name in task name * [skip ci]refactor: task names * [skip ci]refactor: add service mgr in task name * [skip ci]refactor: add task names and module FQDNs * [skip ci]refactor: fix task name * [skip ci]refactor: add - * [skip ci]refactor: include task names and FQDNs * [skip ci]refactor: add task names and FQDNs * [skip ci]: ignore `name[template]` * refactor: `when` clause for `block` should be before `block` * fix: https://github.com/ansible-community/molecule/issues/3883 * refactor: molecule lint command was removed in version `5.0.0` Use separate CI job step to run linting instead. * [skip ci]refactor: noqa for command tasks Subject to change * refactor: use Ubuntu 22.04 Suspect issues with Molecule tests are related to cgroups v2.
This commit is contained in:
parent
0cc1e48902
commit
de1bd094e5
25 changed files with 127 additions and 96 deletions
|
@ -2,3 +2,4 @@
|
||||||
|
|
||||||
skip_list:
|
skip_list:
|
||||||
- role-name
|
- role-name
|
||||||
|
- name[template]
|
||||||
|
|
25
.github/workflows/ci.yml
vendored
25
.github/workflows/ci.yml
vendored
|
@ -16,9 +16,32 @@ defaults:
|
||||||
working-directory: "xanmanning.k3s"
|
working-directory: "xanmanning.k3s"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
ansible-lint:
|
||||||
|
name: Ansible Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout codebase
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: "xanmanning.k3s"
|
||||||
|
|
||||||
|
- name: Set up Python 3
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
|
||||||
|
- name: Install test dependencies
|
||||||
|
run: pip3 install -r molecule/lint-requirements.txt
|
||||||
|
|
||||||
|
- name: Run yamllint
|
||||||
|
run: yamllint -s .
|
||||||
|
|
||||||
|
- name: Run ansible-lint
|
||||||
|
run: ansible-lint --exclude molecule/ --exclude meta/
|
||||||
|
|
||||||
molecule:
|
molecule:
|
||||||
name: Molecule
|
name: Molecule
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
|
|
@ -7,7 +7,6 @@ driver:
|
||||||
scenario:
|
scenario:
|
||||||
test_sequence:
|
test_sequence:
|
||||||
- dependency
|
- dependency
|
||||||
- lint
|
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
- syntax
|
- syntax
|
||||||
|
@ -20,10 +19,6 @@ scenario:
|
||||||
- verify
|
- verify
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
lint: |
|
|
||||||
set -e
|
|
||||||
yamllint -s .
|
|
||||||
ansible-lint --exclude molecule/ --exclude meta/
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: node1
|
- name: node1
|
||||||
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
||||||
|
|
|
@ -7,7 +7,6 @@ driver:
|
||||||
scenario:
|
scenario:
|
||||||
test_sequence:
|
test_sequence:
|
||||||
- dependency
|
- dependency
|
||||||
- lint
|
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
- syntax
|
- syntax
|
||||||
|
@ -20,10 +19,6 @@ scenario:
|
||||||
- verify
|
- verify
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
lint: |
|
|
||||||
set -e
|
|
||||||
yamllint -s .
|
|
||||||
ansible-lint --exclude molecule/ --exclude meta/
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: node1
|
- name: node1
|
||||||
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
||||||
|
|
|
@ -7,7 +7,6 @@ driver:
|
||||||
scenario:
|
scenario:
|
||||||
test_sequence:
|
test_sequence:
|
||||||
- dependency
|
- dependency
|
||||||
- lint
|
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
- syntax
|
- syntax
|
||||||
|
@ -20,10 +19,6 @@ scenario:
|
||||||
- verify
|
- verify
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
lint: |
|
|
||||||
set -e
|
|
||||||
yamllint -s .
|
|
||||||
ansible-lint --exclude molecule/ --exclude meta/
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: node1
|
- name: node1
|
||||||
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
||||||
|
|
|
@ -7,7 +7,6 @@ driver:
|
||||||
scenario:
|
scenario:
|
||||||
test_sequence:
|
test_sequence:
|
||||||
- dependency
|
- dependency
|
||||||
- lint
|
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
- syntax
|
- syntax
|
||||||
|
@ -20,10 +19,6 @@ scenario:
|
||||||
- verify
|
- verify
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
lint: |
|
|
||||||
set -e
|
|
||||||
yamllint -s .
|
|
||||||
ansible-lint --exclude molecule/ --exclude meta/
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: node1
|
- name: node1
|
||||||
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
||||||
|
|
|
@ -7,7 +7,6 @@ driver:
|
||||||
scenario:
|
scenario:
|
||||||
test_sequence:
|
test_sequence:
|
||||||
- dependency
|
- dependency
|
||||||
- lint
|
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
- syntax
|
- syntax
|
||||||
|
@ -20,10 +19,6 @@ scenario:
|
||||||
- verify
|
- verify
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
lint: |
|
|
||||||
set -e
|
|
||||||
yamllint -s .
|
|
||||||
ansible-lint --exclude molecule/ --exclude meta/
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: node1
|
- name: node1
|
||||||
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
||||||
|
|
4
molecule/lint-requirements.txt
Normal file
4
molecule/lint-requirements.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
-r ../requirements.txt
|
||||||
|
|
||||||
|
yamllint>=1.25.0
|
||||||
|
ansible-lint>=4.3.5
|
|
@ -7,7 +7,6 @@ driver:
|
||||||
scenario:
|
scenario:
|
||||||
test_sequence:
|
test_sequence:
|
||||||
- dependency
|
- dependency
|
||||||
- lint
|
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
- syntax
|
- syntax
|
||||||
|
@ -20,10 +19,6 @@ scenario:
|
||||||
- verify
|
- verify
|
||||||
- cleanup
|
- cleanup
|
||||||
- destroy
|
- destroy
|
||||||
lint: |
|
|
||||||
set -e
|
|
||||||
yamllint -s .
|
|
||||||
ansible-lint --exclude molecule/ --exclude meta/
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: node1
|
- name: node1
|
||||||
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
-r ../requirements.txt
|
-r ../requirements.txt
|
||||||
|
|
||||||
molecule[docker]>=3.2
|
molecule-plugins[docker]
|
||||||
docker>=4.3.1
|
docker>=4.3.1
|
||||||
yamllint>=1.25.0
|
|
||||||
ansible-lint>=4.3.5
|
|
||||||
|
|
|
@ -87,12 +87,13 @@
|
||||||
become: "{{ k3s_become }}"
|
become: "{{ k3s_become }}"
|
||||||
|
|
||||||
- name: Ensure secondary controllers are started
|
- name: Ensure secondary controllers are started
|
||||||
include_tasks: ensure_control_plane_started_{{ ansible_service_mgr }}.yml
|
ansible.builtin.include_tasks: ensure_control_plane_started_{{ ansible_service_mgr }}.yml
|
||||||
when:
|
when:
|
||||||
- k3s_control_node
|
- k3s_control_node
|
||||||
- not k3s_primary_control_node
|
- not k3s_primary_control_node
|
||||||
|
|
||||||
- import_tasks: post_checks_control_plane.yml
|
- name: Run control plane post checks
|
||||||
|
ansible.builtin.import_tasks: post_checks_control_plane.yml
|
||||||
when:
|
when:
|
||||||
- not k3s_skip_validation
|
- not k3s_skip_validation
|
||||||
- not k3s_skip_post_checks
|
- not k3s_skip_post_checks
|
||||||
|
@ -100,7 +101,8 @@
|
||||||
- name: Flush Handlers
|
- name: Flush Handlers
|
||||||
ansible.builtin.meta: flush_handlers
|
ansible.builtin.meta: flush_handlers
|
||||||
|
|
||||||
- import_tasks: post_checks_nodes.yml
|
- name: Run node post checks
|
||||||
|
ansible.builtin.import_tasks: post_checks_nodes.yml
|
||||||
when:
|
when:
|
||||||
- not k3s_skip_validation
|
- not k3s_skip_validation
|
||||||
- not k3s_skip_post_checks
|
- not k3s_skip_post_checks
|
||||||
|
|
|
@ -7,8 +7,12 @@
|
||||||
become: "{{ k3s_become }}"
|
become: "{{ k3s_become }}"
|
||||||
|
|
||||||
- name: Clean up nodes that are in an uninstalled state
|
- name: Clean up nodes that are in an uninstalled state
|
||||||
|
when:
|
||||||
|
- k3s_check_kubectl.stat.exists is defined
|
||||||
|
- k3s_check_kubectl.stat.exists
|
||||||
|
- k3s_control_delegate is defined
|
||||||
|
- not ansible_check_mode
|
||||||
block:
|
block:
|
||||||
|
|
||||||
- name: Gather a list of nodes
|
- name: Gather a list of nodes
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "{{ k3s_install_dir }}/kubectl get nodes"
|
cmd: "{{ k3s_install_dir }}/kubectl get nodes"
|
||||||
|
@ -19,7 +23,7 @@
|
||||||
register: kubectl_get_nodes_result
|
register: kubectl_get_nodes_result
|
||||||
become: "{{ k3s_become }}"
|
become: "{{ k3s_become }}"
|
||||||
|
|
||||||
- name: Ensure uninstalled nodes are drained
|
- name: Ensure uninstalled nodes are drained # noqa no-changed-when
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: >-
|
cmd: >-
|
||||||
{{ k3s_install_dir }}/kubectl drain {{ item }}
|
{{ k3s_install_dir }}/kubectl drain {{ item }}
|
||||||
|
@ -36,7 +40,7 @@
|
||||||
loop: "{{ ansible_play_hosts }}"
|
loop: "{{ ansible_play_hosts }}"
|
||||||
become: "{{ k3s_become }}"
|
become: "{{ k3s_become }}"
|
||||||
|
|
||||||
- name: Ensure uninstalled nodes are removed
|
- name: Ensure uninstalled nodes are removed # noqa no-changed-when
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "{{ k3s_install_dir }}/kubectl delete node {{ item }}"
|
cmd: "{{ k3s_install_dir }}/kubectl delete node {{ item }}"
|
||||||
delegate_to: "{{ k3s_control_delegate }}"
|
delegate_to: "{{ k3s_control_delegate }}"
|
||||||
|
@ -48,9 +52,3 @@
|
||||||
- hostvars[item].k3s_state == 'uninstalled'
|
- hostvars[item].k3s_state == 'uninstalled'
|
||||||
loop: "{{ ansible_play_hosts }}"
|
loop: "{{ ansible_play_hosts }}"
|
||||||
become: "{{ k3s_become }}"
|
become: "{{ k3s_become }}"
|
||||||
|
|
||||||
when:
|
|
||||||
- k3s_check_kubectl.stat.exists is defined
|
|
||||||
- k3s_check_kubectl.stat.exists
|
|
||||||
- k3s_control_delegate is defined
|
|
||||||
- not ansible_check_mode
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- include_tasks: ensure_directories.yml
|
- name: Ensure directories exist
|
||||||
|
ansible.builtin.include_tasks: ensure_directories.yml
|
||||||
loop: "{{ k3s_ensure_directories_exist }}"
|
loop: "{{ k3s_ensure_directories_exist }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: directory
|
loop_var: directory
|
||||||
|
|
||||||
- include_tasks: ensure_installed_node.yml
|
- name: Ensure installed node
|
||||||
|
ansible.builtin.include_tasks: ensure_installed_node.yml
|
||||||
when:
|
when:
|
||||||
- ((k3s_control_node and k3s_controller_list | length == 1)
|
- ((k3s_control_node and k3s_controller_list | length == 1)
|
||||||
or (k3s_primary_control_node and k3s_controller_list | length > 1))
|
or (k3s_primary_control_node and k3s_controller_list | length > 1))
|
||||||
|
@ -14,7 +16,8 @@
|
||||||
- name: Flush Handlers
|
- name: Flush Handlers
|
||||||
ansible.builtin.meta: flush_handlers
|
ansible.builtin.meta: flush_handlers
|
||||||
|
|
||||||
- include_tasks: ensure_installed_node.yml
|
- name: Ensure installed node | k3s_build_cluster
|
||||||
|
ansible.builtin.include_tasks: ensure_installed_node.yml
|
||||||
when: k3s_build_cluster
|
when: k3s_build_cluster
|
||||||
|
|
||||||
- name: Determine if the systems are already clustered
|
- name: Determine if the systems are already clustered
|
||||||
|
@ -22,7 +25,8 @@
|
||||||
path: "{{ k3s_token_location }}"
|
path: "{{ k3s_token_location }}"
|
||||||
register: k3s_token_cluster_check
|
register: k3s_token_cluster_check
|
||||||
|
|
||||||
- include_tasks: ensure_control_plane_started_{{ ansible_service_mgr }}.yml
|
- name: Ensure control plane started with {{ ansible_service_mgr }}
|
||||||
|
ansible.builtin.include_tasks: ensure_control_plane_started_{{ ansible_service_mgr }}.yml
|
||||||
when: (k3s_control_node and k3s_controller_list | length == 1)
|
when: (k3s_control_node and k3s_controller_list | length == 1)
|
||||||
or (k3s_primary_control_node and k3s_controller_list | length > 1)
|
or (k3s_primary_control_node and k3s_controller_list | length > 1)
|
||||||
or k3s_token_cluster_check.stat.exists
|
or k3s_token_cluster_check.stat.exists
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
become: "{{ k3s_become }}"
|
become: "{{ k3s_become }}"
|
||||||
|
|
||||||
- name: Ensure cluster token is present when pre-defined
|
- name: Ensure cluster token is present when pre-defined
|
||||||
|
when: k3s_control_token is defined
|
||||||
block:
|
block:
|
||||||
- name: Ensure the cluster token file location exists
|
- name: Ensure the cluster token file location exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
@ -44,7 +45,6 @@
|
||||||
become: "{{ k3s_become }}"
|
become: "{{ k3s_become }}"
|
||||||
notify:
|
notify:
|
||||||
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
|
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
|
||||||
when: k3s_control_token is defined
|
|
||||||
|
|
||||||
- name: Ensure k3s service unit file is present
|
- name: Ensure k3s service unit file is present
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
|
|
@ -37,8 +37,11 @@
|
||||||
loop: "{{ ansible_play_hosts }}"
|
loop: "{{ ansible_play_hosts }}"
|
||||||
|
|
||||||
- name: Ensure a k3s control node is defined if none are found in ansible_play_hosts
|
- name: Ensure a k3s control node is defined if none are found in ansible_play_hosts
|
||||||
|
when:
|
||||||
|
- k3s_controller_list | length < 1
|
||||||
|
- k3s_build_cluster is defined
|
||||||
|
- k3s_build_cluster
|
||||||
block:
|
block:
|
||||||
|
|
||||||
- name: Set the control host
|
- name: Set the control host
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
k3s_control_node: true
|
k3s_control_node: true
|
||||||
|
@ -52,11 +55,6 @@
|
||||||
- hostvars[item].k3s_control_node
|
- hostvars[item].k3s_control_node
|
||||||
loop: "{{ ansible_play_hosts }}"
|
loop: "{{ ansible_play_hosts }}"
|
||||||
|
|
||||||
when:
|
|
||||||
- k3s_controller_list | length < 1
|
|
||||||
- k3s_build_cluster is defined
|
|
||||||
- k3s_build_cluster
|
|
||||||
|
|
||||||
- name: Ensure a primary k3s control node is defined if multiple are found in ansible_play_hosts
|
- name: Ensure a primary k3s control node is defined if multiple are found in ansible_play_hosts
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
k3s_primary_control_node: true
|
k3s_primary_control_node: true
|
||||||
|
@ -88,6 +86,8 @@
|
||||||
when: k3s_control_node is defined
|
when: k3s_control_node is defined
|
||||||
|
|
||||||
- name: Delegate an initializing control plane node
|
- name: Delegate an initializing control plane node
|
||||||
|
when: k3s_registration_address is not defined
|
||||||
|
or k3s_control_delegate is not defined
|
||||||
block:
|
block:
|
||||||
- name: Lookup control node from file
|
- name: Lookup control node from file
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
|
@ -124,6 +124,3 @@
|
||||||
when:
|
when:
|
||||||
- k3s_registration_address is not defined
|
- k3s_registration_address is not defined
|
||||||
- k3s_control_node_address is not defined
|
- k3s_control_node_address is not defined
|
||||||
|
|
||||||
when: k3s_registration_address is not defined
|
|
||||||
or k3s_control_delegate is not defined
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
when: k3s_non_root is not defined or not k3s_non_root
|
when: k3s_non_root is not defined or not k3s_non_root
|
||||||
become: "{{ k3s_become }}"
|
become: "{{ k3s_become }}"
|
||||||
|
|
||||||
- name: Ensure k3s service is started
|
- name: Ensure k3s service is stopped
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: k3s
|
name: k3s
|
||||||
state: stopped
|
state: stopped
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- import_tasks: pre_checks.yml
|
- name: Run pre-checks
|
||||||
|
ansible.builtin.import_tasks: pre_checks.yml
|
||||||
|
|
||||||
- include_tasks: state_{{ (k3s_state | lower) | default('installed') }}.yml
|
- name: Ensure state {{ (k3s_state | lower) | default('installed') }}
|
||||||
|
ansible.builtin.include_tasks: state_{{ (k3s_state | lower) | default('installed') }}.yml
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
- not k3s_skip_validation
|
- not k3s_skip_validation
|
||||||
- not k3s_skip_env_checks
|
- not k3s_skip_env_checks
|
||||||
|
|
||||||
- name: Determing if {{ ansible_service_mgr }} is actually openrc
|
- name: Determining if {{ ansible_service_mgr }} is actually openrc
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: /sbin/openrc-run
|
path: /sbin/openrc-run
|
||||||
register: k3s_check_openrc_run
|
register: k3s_check_openrc_run
|
||||||
|
@ -71,14 +71,16 @@
|
||||||
- not k3s_skip_validation
|
- not k3s_skip_validation
|
||||||
- not k3s_skip_env_checks
|
- not k3s_skip_env_checks
|
||||||
|
|
||||||
- include_tasks: pre_checks_version.yml
|
- name: Run version pre-checks
|
||||||
|
ansible.builtin.include_tasks: pre_checks_version.yml
|
||||||
when:
|
when:
|
||||||
- (k3s_release_version is not defined
|
- (k3s_release_version is not defined
|
||||||
or not k3s_release_version
|
or not k3s_release_version
|
||||||
or k3s_release_version is not regex('\\+k3s[1-9]$'))
|
or k3s_release_version is not regex('\\+k3s[1-9]$'))
|
||||||
- not k3s_airgap
|
- not k3s_airgap
|
||||||
|
|
||||||
- include_tasks: pre_checks_cgroups.yml
|
- name: Run cgroups pre-checks
|
||||||
|
ansible.builtin.include_tasks: pre_checks_cgroups.yml
|
||||||
loop: "{{ k3s_cgroup_subsys }}"
|
loop: "{{ k3s_cgroup_subsys }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: cgroup
|
loop_var: cgroup
|
||||||
|
@ -86,7 +88,8 @@
|
||||||
- not k3s_skip_validation
|
- not k3s_skip_validation
|
||||||
- not k3s_skip_env_checks
|
- not k3s_skip_env_checks
|
||||||
|
|
||||||
- include_tasks: pre_checks_packages.yml
|
- name: Run packages pre-checks
|
||||||
|
ansible.builtin.include_tasks: pre_checks_packages.yml
|
||||||
loop: "{{ k3s_check_packages[k3s_os_distribution_version] }}"
|
loop: "{{ k3s_check_packages[k3s_os_distribution_version] }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: package
|
loop_var: package
|
||||||
|
@ -95,28 +98,34 @@
|
||||||
- not k3s_skip_env_checks
|
- not k3s_skip_env_checks
|
||||||
- k3s_check_packages[k3s_os_distribution_version] is defined
|
- k3s_check_packages[k3s_os_distribution_version] is defined
|
||||||
|
|
||||||
- include_tasks: pre_checks_issue_data.yml
|
- name: Run issue data pre-checks
|
||||||
|
ansible.builtin.include_tasks: pre_checks_issue_data.yml
|
||||||
when:
|
when:
|
||||||
- pyratlabs_issue_controller_dump is defined
|
- pyratlabs_issue_controller_dump is defined
|
||||||
- pyratlabs_issue_controller_dump
|
- pyratlabs_issue_controller_dump
|
||||||
|
|
||||||
- import_tasks: pre_checks_variables.yml
|
- name: Run variables pre-checks
|
||||||
|
ansible.builtin.import_tasks: pre_checks_variables.yml
|
||||||
when:
|
when:
|
||||||
- not k3s_skip_validation
|
- not k3s_skip_validation
|
||||||
|
|
||||||
- import_tasks: pre_checks_experimental_variables.yml
|
- name: Ensure experimental variables pre-checks
|
||||||
|
ansible.builtin.import_tasks: pre_checks_experimental_variables.yml
|
||||||
when:
|
when:
|
||||||
- not k3s_skip_validation
|
- not k3s_skip_validation
|
||||||
|
|
||||||
- import_tasks: pre_checks_unsupported_rootless.yml
|
- name: Run unsupported rootless pre-checks
|
||||||
|
ansible.builtin.import_tasks: pre_checks_unsupported_rootless.yml
|
||||||
when:
|
when:
|
||||||
- k3s_runtime_config.rootless is defined
|
- k3s_runtime_config.rootless is defined
|
||||||
- k3s_runtime_config.rootless
|
- k3s_runtime_config.rootless
|
||||||
- not k3s_skip_validation
|
- not k3s_skip_validation
|
||||||
|
|
||||||
- import_tasks: ensure_pre_configuration.yml
|
- name: Run pre-configuration tasks
|
||||||
|
ansible.builtin.import_tasks: ensure_pre_configuration.yml
|
||||||
|
|
||||||
- import_tasks: pre_checks_control_node_count.yml
|
- name: Run control node count pre-checks
|
||||||
|
ansible.builtin.import_tasks: pre_checks_control_node_count.yml
|
||||||
when:
|
when:
|
||||||
- k3s_build_cluster is defined
|
- k3s_build_cluster is defined
|
||||||
- k3s_build_cluster
|
- k3s_build_cluster
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- import_tasks: pre_checks_version.yml
|
- name: Run version pre-checks
|
||||||
|
ansible.builtin.import_tasks: pre_checks_version.yml
|
||||||
when:
|
when:
|
||||||
- k3s_release_version is not defined or not k3s_release_version
|
- k3s_release_version is not defined or not k3s_release_version
|
||||||
- not k3s_airgap
|
- not k3s_airgap
|
||||||
|
|
||||||
- import_tasks: ensure_downloads.yml
|
- name: Run k3s binary download and install tasks
|
||||||
|
ansible.builtin.import_tasks: ensure_downloads.yml
|
||||||
when: not k3s_airgap
|
when: not k3s_airgap
|
||||||
|
|
||||||
- import_tasks: ensure_uploads.yml
|
- name: Run k3s binary upload tasks | k3s_airgap
|
||||||
|
ansible.builtin.import_tasks: ensure_uploads.yml
|
||||||
when: k3s_airgap
|
when: k3s_airgap
|
||||||
|
|
|
@ -1,37 +1,47 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- import_tasks: ensure_drain_and_remove_nodes.yml
|
- name: Ensure nodes are drained and removed
|
||||||
|
ansible.builtin.import_tasks: ensure_drain_and_remove_nodes.yml
|
||||||
|
|
||||||
- import_tasks: determine_systemd_context.yml
|
- name: Determine systemd context
|
||||||
|
ansible.builtin.import_tasks: determine_systemd_context.yml
|
||||||
|
|
||||||
- name: Flush Handlers
|
- name: Flush Handlers
|
||||||
ansible.builtin.meta: flush_handlers
|
ansible.builtin.meta: flush_handlers
|
||||||
|
|
||||||
- import_tasks: ensure_downloads.yml
|
- name: Run k3s binary download and install tasks
|
||||||
|
ansible.builtin.import_tasks: ensure_downloads.yml
|
||||||
when: not k3s_airgap
|
when: not k3s_airgap
|
||||||
|
|
||||||
- import_tasks: ensure_uploads.yml
|
- name: Run k3s binary upload tasks | k3s_airgap
|
||||||
|
ansible.builtin.import_tasks: ensure_uploads.yml
|
||||||
when: k3s_airgap
|
when: k3s_airgap
|
||||||
|
|
||||||
- import_tasks: ensure_k3s_auto_deploy.yml
|
- name: Run auto-deploy manifests and pod manifests tasks
|
||||||
|
ansible.builtin.import_tasks: ensure_k3s_auto_deploy.yml
|
||||||
when:
|
when:
|
||||||
- k3s_primary_control_node
|
- k3s_primary_control_node
|
||||||
|
|
||||||
- import_tasks: ensure_k3s_config_files.yml
|
- name: Ensure k3s configuration files are copied to controllers and agents
|
||||||
|
ansible.builtin.import_tasks: ensure_k3s_config_files.yml
|
||||||
|
|
||||||
- import_tasks: ensure_installed.yml
|
- name: Run k3s installation tasks
|
||||||
|
ansible.builtin.import_tasks: ensure_installed.yml
|
||||||
|
|
||||||
- include_tasks: ensure_containerd_registries.yml
|
- name: Ensure containerd registries
|
||||||
|
ansible.builtin.include_tasks: ensure_containerd_registries.yml
|
||||||
when:
|
when:
|
||||||
- k3s_registries is defined
|
- k3s_registries is defined
|
||||||
- ('rootless' not in k3s_runtime_config or not k3s_runtime_config.rootless)
|
- ('rootless' not in k3s_runtime_config or not k3s_runtime_config.rootless)
|
||||||
|
|
||||||
- include_tasks: pre_checks_cluster.yml
|
- name: Run cluster pre-checks
|
||||||
|
ansible.builtin.include_tasks: pre_checks_cluster.yml
|
||||||
when:
|
when:
|
||||||
- k3s_control_delegate is defined
|
- k3s_control_delegate is defined
|
||||||
- k3s_control_delegate == inventory_hostname
|
- k3s_control_delegate == inventory_hostname
|
||||||
|
|
||||||
- import_tasks: ensure_cluster.yml
|
- name: Run k3s cluster tasks
|
||||||
|
ansible.builtin.import_tasks: ensure_cluster.yml
|
||||||
when:
|
when:
|
||||||
- k3s_build_cluster is defined
|
- k3s_build_cluster is defined
|
||||||
- k3s_build_cluster
|
- k3s_build_cluster
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- import_tasks: ensure_stopped.yml
|
- name: Ensure k3s is stopped
|
||||||
|
ansible.builtin.import_tasks: ensure_stopped.yml
|
||||||
|
|
||||||
- import_tasks: ensure_started.yml
|
- name: Ensure k3s is started
|
||||||
|
ansible.builtin.import_tasks: ensure_started.yml
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- import_tasks: ensure_started.yml
|
- name: Ensure k3s is started
|
||||||
|
ansible.builtin.import_tasks: ensure_started.yml
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- import_tasks: ensure_stopped.yml
|
- name: Ensure k3s is stopped
|
||||||
|
ansible.builtin.import_tasks: ensure_stopped.yml
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- import_tasks: ensure_pre_configuration.yml
|
- name: Run pre-configuration tasks
|
||||||
|
ansible.builtin.import_tasks: ensure_pre_configuration.yml
|
||||||
|
|
||||||
- import_tasks: ensure_drain_and_remove_nodes.yml
|
- name: Ensure nodes are drained and removed
|
||||||
|
ansible.builtin.import_tasks: ensure_drain_and_remove_nodes.yml
|
||||||
|
|
||||||
- import_tasks: ensure_uninstalled.yml
|
- name: Run uninstall tasks
|
||||||
|
ansible.builtin.import_tasks: ensure_uninstalled.yml
|
||||||
|
|
||||||
- import_tasks: post_checks_uninstalled.yml
|
- name: Run uninstall post checks
|
||||||
|
ansible.builtin.import_tasks: post_checks_uninstalled.yml
|
||||||
when:
|
when:
|
||||||
- not k3s_skip_validation
|
- not k3s_skip_validation
|
||||||
- not k3s_skip_post_checks
|
- not k3s_skip_post_checks
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- import_tasks: post_checks_control_plane.yml
|
- name: Run control plane post checks
|
||||||
|
ansible.builtin.import_tasks: post_checks_control_plane.yml
|
||||||
|
|
||||||
- import_tasks: post_checks_nodes.yml
|
- name: Run node post checks
|
||||||
|
ansible.builtin.import_tasks: post_checks_nodes.yml
|
||||||
|
|
Loading…
Reference in a new issue