Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(tests): Resolve Ansible Lint warnings and fix Molecule tests on GitHub Actions #202

Merged
merged 27 commits into from
May 13, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f7be4a0
fix(ansible-lint): FQDN and `name`
dbrennand Mar 15, 2023
be30ded
fix(ansible-lint): add `name` and FQDN for module call
dbrennand Mar 15, 2023
2b5df13
fix(ansible-lint): add `name` to tasks and FQDN for module
dbrennand Mar 15, 2023
fe5c161
fix(ansible-lint): add task `name` and FQDN for module calls
dbrennand Mar 15, 2023
e629cc4
fix(ansible-lint): last `include_tasks`
dbrennand Mar 15, 2023
eda1405
fix(ansible-lint): add task names and FQDN
dbrennand Mar 15, 2023
47c1e36
refactor: `Ensure` to `Run`
dbrennand May 11, 2023
e99c32c
[skip ci]refactor: add exist and seperate ensure installed node task,…
dbrennand May 12, 2023
4d3ecbb
[skip ci]refactor: Pipe seperator
dbrennand May 12, 2023
a03dea9
[skip ci]refactor: run
dbrennand May 12, 2023
8ae72b0
refactor: remove quotes as other files don't use them
dbrennand May 12, 2023
963a6fb
[skip ci]refactor: task names, use `Run`
dbrennand May 12, 2023
6a0eab9
[skip ci]refactor: use variable name in task name
dbrennand May 12, 2023
2344625
[skip ci]refactor: task names
dbrennand May 12, 2023
7f6ad15
[skip ci]refactor: add service mgr in task name
dbrennand May 12, 2023
0333bdb
[skip ci]refactor: add task names and module FQDNs
dbrennand May 12, 2023
7f3c574
[skip ci]refactor: fix task name
dbrennand May 12, 2023
c186596
[skip ci]refactor: add -
dbrennand May 12, 2023
8d680d4
[skip ci]refactor: include task names and FQDNs
dbrennand May 12, 2023
ae392a3
[skip ci]refactor: add task names and FQDNs
dbrennand May 12, 2023
26fc6e5
[skip ci]: ignore `name[template]`
dbrennand May 12, 2023
38b6edf
refactor: `when` clause for `block` should be before `block`
dbrennand May 12, 2023
976d551
fix: https://github.com/ansible-community/molecule/issues/3883
dbrennand May 12, 2023
f176ea4
refactor: molecule lint command was removed in version `5.0.0`
dbrennand May 12, 2023
b854139
[skip ci]refactor: noqa for command tasks
dbrennand May 12, 2023
3258d30
refactor: use Ubuntu 22.04
dbrennand May 12, 2023
90891d9
Merge branch 'PyratLabs:main' into fix/ansible-lint
dbrennand May 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tasks/ensure_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,22 @@
become: "{{ k3s_become }}"

- 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:
- k3s_control_node
- not k3s_primary_control_node

- import_tasks: post_checks_control_plane.yml
- name: Ensure control plane post checks
ansible.builtin.import_tasks: post_checks_control_plane.yml
when:
- not k3s_skip_validation
- not k3s_skip_post_checks

- name: Flush Handlers
ansible.builtin.meta: flush_handlers

- import_tasks: post_checks_nodes.yml
- name: Ensure node post checks
ansible.builtin.import_tasks: post_checks_nodes.yml
when:
- not k3s_skip_validation
- not k3s_skip_post_checks
12 changes: 8 additions & 4 deletions tasks/ensure_installed.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
---

- include_tasks: ensure_directories.yml
- name: Ensure directories
ansible.builtin.include_tasks: ensure_directories.yml
loop: "{{ k3s_ensure_directories_exist }}"
loop_control:
loop_var: directory

- include_tasks: ensure_installed_node.yml
- name: Ensure installed node
ansible.builtin.include_tasks: ensure_installed_node.yml
when:
- ((k3s_control_node and k3s_controller_list | length == 1)
or (k3s_primary_control_node and k3s_controller_list | length > 1))
Expand All @@ -14,15 +16,17 @@
- name: Flush Handlers
ansible.builtin.meta: flush_handlers

- include_tasks: ensure_installed_node.yml
- name: Ensure installed node
ansible.builtin.include_tasks: ensure_installed_node.yml
when: k3s_build_cluster

- name: Determine if the systems are already clustered
ansible.builtin.stat:
path: "{{ k3s_token_location }}"
register: k3s_token_cluster_check

- include_tasks: ensure_control_plane_started_{{ ansible_service_mgr }}.yml
- name: Ensure control plane started
ansible.builtin.include_tasks: ensure_control_plane_started_{{ ansible_service_mgr }}.yml
when: (k3s_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
6 changes: 4 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---

- import_tasks: pre_checks.yml
- name: Begin 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
29 changes: 19 additions & 10 deletions tasks/pre_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- not k3s_skip_validation
- 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:
path: /sbin/openrc-run
register: k3s_check_openrc_run
Expand All @@ -71,22 +71,25 @@
- not k3s_skip_validation
- not k3s_skip_env_checks

- include_tasks: pre_checks_version.yml
- name: Ensure version pre-checks
dbrennand marked this conversation as resolved.
Show resolved Hide resolved
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

- include_tasks: pre_checks_cgroups.yml
- name: Ensure 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

- include_tasks: pre_checks_packages.yml
- name: Ensure packages pre-checks
ansible.builtin.include_tasks: pre_checks_packages.yml
loop: "{{ k3s_check_packages[k3s_os_distribution_version] }}"
loop_control:
loop_var: package
Expand All @@ -95,28 +98,34 @@
- not k3s_skip_env_checks
- k3s_check_packages[k3s_os_distribution_version] is defined

- include_tasks: pre_checks_issue_data.yml
- name: Ensure issue data pre-checks
ansible.builtin.include_tasks: pre_checks_issue_data.yml
when:
- pyratlabs_issue_controller_dump is defined
- pyratlabs_issue_controller_dump

- import_tasks: pre_checks_variables.yml
- name: Ensure variables pre-checks
ansible.builtin.import_tasks: pre_checks_variables.yml
when:
- 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:
- not k3s_skip_validation

- import_tasks: pre_checks_unsupported_rootless.yml
- name: Ensure 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

- import_tasks: ensure_pre_configuration.yml
- name: Ensure preconfiguration
ansible.builtin.import_tasks: ensure_pre_configuration.yml

- import_tasks: pre_checks_control_node_count.yml
- name: Ensure control node count pre-checks
ansible.builtin.import_tasks: pre_checks_control_node_count.yml
when:
- k3s_build_cluster is defined
- k3s_build_cluster
Expand Down
9 changes: 6 additions & 3 deletions tasks/state_downloaded.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
---

- import_tasks: pre_checks_version.yml
- name: Ensure version pre-checks
ansible.builtin.import_tasks: pre_checks_version.yml
when:
- k3s_release_version is not defined or not k3s_release_version
- not k3s_airgap

- import_tasks: ensure_downloads.yml
- name: Ensure downloads
ansible.builtin.import_tasks: ensure_downloads.yml
when: not k3s_airgap

- import_tasks: ensure_uploads.yml
- name: Ensure uploads
ansible.builtin.import_tasks: ensure_uploads.yml
when: k3s_airgap
6 changes: 4 additions & 2 deletions tasks/state_installed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@

- import_tasks: ensure_installed.yml

- include_tasks: ensure_containerd_registries.yml
- name: Ensure containerd registries
ansible.builtin.include_tasks: ensure_containerd_registries.yml
when:
- k3s_registries is defined
- ('rootless' not in k3s_runtime_config or not k3s_runtime_config.rootless)

- include_tasks: pre_checks_cluster.yml
- name: Ensure cluster pre-checks
ansible.builtin.include_tasks: pre_checks_cluster.yml
when:
- k3s_control_delegate is defined
- k3s_control_delegate == inventory_hostname
Expand Down