mirror of
https://github.com/PyratLabs/ansible-role-k3s.git
synced 2024-11-25 12:15:51 +01:00
de1bd094e5
* 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.
133 lines
4.2 KiB
YAML
133 lines
4.2 KiB
YAML
---
|
|
|
|
- name: Check that k3s_state is a supported value
|
|
ansible.builtin.assert:
|
|
that:
|
|
- k3s_state in k3s_valid_states
|
|
fail_msg: "k3s_state not valid. Check README.md for details."
|
|
success_msg: "k3s_state is valid."
|
|
when: k3s_state is defined
|
|
|
|
- name: Check that Ansible v{{ ansible_version.string }} is supported by this role
|
|
ansible.builtin.assert:
|
|
that:
|
|
- ansible_version.string is version_compare(k3s_ansible_min_version, '>=')
|
|
fail_msg: >-
|
|
Ansible v{{ ansible_version.string }} is not supported by this role.
|
|
Please install >= v{{ k3s_ansible_min_version }}.
|
|
success_msg: "Ansible v{{ ansible_version.string }} is supported."
|
|
become: false
|
|
delegate_to: localhost
|
|
run_once: true
|
|
when:
|
|
- not k3s_skip_validation
|
|
- not k3s_skip_env_checks
|
|
|
|
- name: Check that Python v{{ ansible_python_version }} is supported by this role
|
|
ansible.builtin.assert:
|
|
that:
|
|
- ansible_python_version is version_compare(k3s_python_min_version, '>=')
|
|
fail_msg: >-
|
|
Python v{{ ansible_python_version }} is not supported by this role.
|
|
Please install >= v{{ k3s_python_min_version }}.
|
|
success_msg: "Python v{{ ansible_python_version }} is supported."
|
|
become: false
|
|
delegate_to: localhost
|
|
run_once: true
|
|
when:
|
|
- not k3s_skip_validation
|
|
- not k3s_skip_env_checks
|
|
|
|
- name: Check that the target init system is supported by this role
|
|
ansible.builtin.assert:
|
|
that:
|
|
- ansible_service_mgr in k3s_supported_init
|
|
fail_msg: >-
|
|
{{ ansible_service_mgr }} is not supported by this role.
|
|
Supported init systems: {{ k3s_supported_init | join(', ') }}
|
|
success_msg: "{{ ansible_service_mgr }} is supported"
|
|
when:
|
|
- not k3s_skip_validation
|
|
- not k3s_skip_env_checks
|
|
|
|
- name: Determining if {{ ansible_service_mgr }} is actually openrc
|
|
ansible.builtin.stat:
|
|
path: /sbin/openrc-run
|
|
register: k3s_check_openrc_run
|
|
when:
|
|
- k3s_service_handler[ansible_service_mgr] == 'service'
|
|
- not k3s_skip_validation
|
|
- not k3s_skip_env_checks
|
|
|
|
- name: Check that {{ ansible_service_mgr }} is actually openrc
|
|
ansible.builtin.assert:
|
|
that:
|
|
- k3s_check_openrc_run.stat.exists
|
|
fail_msg: >-
|
|
openrc was not found, cannot install to {{ ansible_service_mgr }}
|
|
success_msg: "openrc found"
|
|
when:
|
|
- k3s_service_handler[ansible_service_mgr] == 'service'
|
|
- not k3s_skip_validation
|
|
- not k3s_skip_env_checks
|
|
|
|
- name: Run version pre-checks
|
|
ansible.builtin.include_tasks: pre_checks_version.yml
|
|
when:
|
|
- (k3s_release_version is not defined
|
|
or not k3s_release_version
|
|
or k3s_release_version is not regex('\\+k3s[1-9]$'))
|
|
- not k3s_airgap
|
|
|
|
- name: Run cgroups pre-checks
|
|
ansible.builtin.include_tasks: pre_checks_cgroups.yml
|
|
loop: "{{ k3s_cgroup_subsys }}"
|
|
loop_control:
|
|
loop_var: cgroup
|
|
when:
|
|
- not k3s_skip_validation
|
|
- not k3s_skip_env_checks
|
|
|
|
- name: Run packages pre-checks
|
|
ansible.builtin.include_tasks: pre_checks_packages.yml
|
|
loop: "{{ k3s_check_packages[k3s_os_distribution_version] }}"
|
|
loop_control:
|
|
loop_var: package
|
|
when:
|
|
- not k3s_skip_validation
|
|
- not k3s_skip_env_checks
|
|
- k3s_check_packages[k3s_os_distribution_version] is defined
|
|
|
|
- name: Run issue data pre-checks
|
|
ansible.builtin.include_tasks: pre_checks_issue_data.yml
|
|
when:
|
|
- pyratlabs_issue_controller_dump is defined
|
|
- pyratlabs_issue_controller_dump
|
|
|
|
- name: Run variables pre-checks
|
|
ansible.builtin.import_tasks: pre_checks_variables.yml
|
|
when:
|
|
- not k3s_skip_validation
|
|
|
|
- name: Ensure experimental variables pre-checks
|
|
ansible.builtin.import_tasks: pre_checks_experimental_variables.yml
|
|
when:
|
|
- not k3s_skip_validation
|
|
|
|
- name: Run unsupported rootless pre-checks
|
|
ansible.builtin.import_tasks: pre_checks_unsupported_rootless.yml
|
|
when:
|
|
- k3s_runtime_config.rootless is defined
|
|
- k3s_runtime_config.rootless
|
|
- not k3s_skip_validation
|
|
|
|
- name: Run pre-configuration tasks
|
|
ansible.builtin.import_tasks: ensure_pre_configuration.yml
|
|
|
|
- name: Run control node count pre-checks
|
|
ansible.builtin.import_tasks: pre_checks_control_node_count.yml
|
|
when:
|
|
- k3s_build_cluster is defined
|
|
- k3s_build_cluster
|
|
- not k3s_skip_validation
|