fix(linting): ensure tests pass

This commit is contained in:
Xan Manning 2022-09-01 20:39:17 +01:00
parent d38f344937
commit 25a17b8511
No known key found for this signature in database
GPG key ID: FEBA410BBAD454FF
14 changed files with 39 additions and 40 deletions

View file

@ -1,17 +1,17 @@
---
- name: reload systemd
- name: Reload systemd
ansible.builtin.systemd:
daemon_reload: true
scope: "{{ k3s_systemd_context }}"
become: "{{ k3s_become }}"
- name: reload service
- name: Reload service
ansible.builtin.set_fact:
k3s_service_reloaded: true
become: "{{ k3s_become }}"
- name: restart k3s systemd
- name: Restart k3s systemd
ansible.builtin.systemd:
name: k3s
state: restarted
@ -25,7 +25,7 @@
- not ansible_check_mode
become: "{{ k3s_become }}"
- name: restart k3s service
- name: Restart k3s service
ansible.builtin.service:
name: k3s
state: restarted

View file

@ -23,7 +23,7 @@ scenario:
lint: |
set -e
yamllint -s .
ansible-lint --exclude molecule/
ansible-lint --exclude molecule/ --exclude meta/
platforms:
- name: node1
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}

View file

@ -23,7 +23,7 @@ scenario:
lint: |
set -e
yamllint -s .
ansible-lint --exclude molecule/
ansible-lint --exclude molecule/ --exclude meta/
platforms:
- name: node1
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}

View file

@ -23,7 +23,7 @@ scenario:
lint: |
set -e
yamllint -s .
ansible-lint --exclude molecule/
ansible-lint --exclude molecule/ --exclude meta/
platforms:
- name: node1
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}

View file

@ -23,7 +23,7 @@ scenario:
lint: |
set -e
yamllint -s .
ansible-lint --exclude molecule/
ansible-lint --exclude molecule/ --exclude meta/
platforms:
- name: node1
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}

View file

@ -23,7 +23,7 @@ scenario:
lint: |
set -e
yamllint -s .
ansible-lint --exclude molecule/
ansible-lint --exclude molecule/ --exclude meta/
platforms:
- name: node1
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}

View file

@ -23,7 +23,7 @@ scenario:
lint: |
set -e
yamllint -s .
ansible-lint --exclude molecule/
ansible-lint --exclude molecule/ --exclude meta/
platforms:
- name: node1
image: ${MOLECULE_DISTRO:-"geerlingguy/docker-rockylinux8-ansible:latest"}

View file

@ -38,7 +38,7 @@
mode: 0600
become: "{{ k3s_become }}"
notify:
- "restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- name: Ensure k3s service unit file is present
ansible.builtin.template:
@ -49,8 +49,8 @@
when:
- k3s_service_handler[ansible_service_mgr] == 'systemd'
notify:
- "reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- "Reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- name: Ensure k3s service file is present
ansible.builtin.template:
@ -60,8 +60,8 @@
when:
- k3s_service_handler[ansible_service_mgr] == 'service'
notify:
- "reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- "Reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
become: "{{ k3s_become }}"
- name: Ensure k3s logrotate file is present
@ -72,8 +72,8 @@
when:
- k3s_service_handler[ansible_service_mgr] == 'service'
notify:
- "reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- "Reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
become: "{{ k3s_become }}"
- name: Ensure k3s config file exists
@ -82,8 +82,8 @@
dest: "{{ k3s_config_file }}"
mode: 0644
notify:
- "reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- "Reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
become: "{{ k3s_become }}"
- name: Ensure secondary controllers are started

View file

@ -6,6 +6,6 @@
dest: "{{ k3s_config_dir }}/registries.yaml"
mode: 0600
notify:
- "reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- "Reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
become: "{{ k3s_become }}"

View file

@ -14,7 +14,7 @@
- ctr
when: not ansible_check_mode
notify:
- "restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
become: "{{ k3s_become }}"
- name: Ensure k3s config file exists
@ -23,8 +23,8 @@
dest: "{{ k3s_config_file }}"
mode: 0644
notify:
- "reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- "Reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
become: "{{ k3s_become }}"
- name: Ensure cluster token is present when pre-defined
@ -43,7 +43,7 @@
mode: 0600
become: "{{ k3s_become }}"
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
@ -54,8 +54,8 @@
when:
- k3s_service_handler[ansible_service_mgr] == 'systemd'
notify:
- "reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- "Reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
become: "{{ k3s_become }}"
- name: Ensure k3s service file is present
@ -66,8 +66,8 @@
when:
- k3s_service_handler[ansible_service_mgr] == 'service'
notify:
- "reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- "Reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
become: "{{ k3s_become }}"
- name: Ensure k3s logrotate file is present
@ -78,8 +78,8 @@
when:
- k3s_service_handler[ansible_service_mgr] == 'service'
notify:
- "reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
- "Reload {{ k3s_service_handler[ansible_service_mgr] }}"
- "Restart k3s {{ k3s_service_handler[ansible_service_mgr] }}"
become: "{{ k3s_become }}"
- name: Ensure k3s killall script is present

View file

@ -24,7 +24,7 @@
- name: Ensure auto-deploying manifests are copied to the primary controller
ansible.builtin.template:
src: "{{ item }}"
dest: "{{ k3s_server_manifests_dir }}/{{ item | basename | replace('.j2','') }}"
dest: "{{ k3s_server_manifests_dir }}/{{ item | basename | replace('.j2', '') }}"
mode: 0644
loop: "{{ k3s_server_manifests_templates }}"
become: "{{ k3s_become }}"
@ -46,7 +46,7 @@
- name: Ensure static pod manifests are copied to controllers
ansible.builtin.template:
src: "{{ item }}"
dest: "{{ k3s_server_pod_manifests_dir }}/{{ item | basename | replace('.j2','') }}"
dest: "{{ k3s_server_pod_manifests_dir }}/{{ item | basename | replace('.j2', '') }}"
mode: 0644
loop: "{{ k3s_server_pod_manifests_templates }}"
become: "{{ k3s_become }}"

View file

@ -14,7 +14,7 @@
- name: Ensure configuration files are copied to controllers
ansible.builtin.template:
src: "{{ item }}"
dest: "{{ k3s_config_yaml_d_dir }}/{{ item | basename | replace('.j2','') }}"
dest: "{{ k3s_config_yaml_d_dir }}/{{ item | basename | replace('.j2', '') }}"
mode: 0644
loop: "{{ k3s_server_config_yaml_d_files }}"
become: "{{ k3s_become }}"
@ -24,7 +24,7 @@
- name: Ensure configuration files are copied to agents
ansible.builtin.template:
src: "{{ item }}"
dest: "{{ k3s_config_yaml_d_dir }}/{{ item | basename | replace('.j2','') }}"
dest: "{{ k3s_config_yaml_d_dir }}/{{ item | basename | replace('.j2', '') }}"
mode: 0644
loop: "{{ k3s_agent_config_yaml_d_files }}"
become: "{{ k3s_become }}"

View file

@ -30,7 +30,7 @@
- name: Ensure a count of control nodes is generated from ansible_play_hosts
ansible.builtin.set_fact:
k3s_controller_list: "{{ k3s_controller_list + [ item ] }}"
k3s_controller_list: "{{ k3s_controller_list + [item] }}"
when:
- hostvars[item].k3s_control_node is defined
- hostvars[item].k3s_control_node
@ -46,7 +46,7 @@
- name: Ensure a count of control nodes is generated
ansible.builtin.set_fact:
k3s_controller_list: "{{ k3s_controller_list + [ item ] }}"
k3s_controller_list: "{{ k3s_controller_list + [item] }}"
when:
- hostvars[item].k3s_control_node is defined
- hostvars[item].k3s_control_node

View file

@ -64,10 +64,9 @@ k3s_github_download_url: "{{ k3s_github_url }}/releases/download"
# Generate a runtime config dictionary
k3s_runtime_config: "{{
(k3s_control_node is defined and k3s_control_node)
| ternary(
(k3s_server | default({})) | combine (k3s_agent | default({})),
| ternary((k3s_server | default({})) | combine(k3s_agent | default({})),
(k3s_agent | default({})),
(k3s_server | default({})) | combine (k3s_agent | default({})))
(k3s_server | default({})) | combine(k3s_agent | default({})))
}}"
# Determine if a cluster should be built