You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This role can be run in several modes, including validation (installed, started, stopped, restarted, uninstalled, validated)
If you want to run it first in 'installed' and then 'validated' mode in single playbook, there is a problem with k3s_controller_list variable: on second run it contains duplicate entries and consequently validation fails. That's because Ansible - sadly - doesn't scope the variables properly and they're left behind as-is after a role finishes.
It's not a very common use case, however it would be nice if the role was re-entrant. It's also very easy to achieve - e.g. by setting the k3s_controller_list to an empty list
- name: Reset the value of k3s_controller_listansible.builtin.set_fact:
k3s_controller_list: []
- name: Ensure a count of control nodes is generated from ansible_play_hosts
Issue Type
Bug Report
Controller Environment and Configuration
Role version:
v3.4.2
Steps to Reproduce
---
- name: Set up K3s multinode clusterhosts: k3sbecome: truevars:
ansible_become: truetasks:
- name: Include K3s roleansible.builtin.import_role:
name: xanmanning.k3stags:
- k3s
- name: Switch k3s role to validation modeansible.builtin.set_fact:
k3s_state: validatedtags:
- k3s
- name: Validate the k3s installationansible.builtin.import_role:
name: xanmanning.k3stags:
- k3s
Expected Result
Actual Result
TASK [xanmanning.k3s : Check the conditions when embedded etcd is defined] **********************************************************************************************************
skipping: [k3s-agent-1.lab.example.com]
skipping: [k3s-agent-2.lab.example.com]
skipping: [k3s-agent-3.lab.example.com]
fatal: [k3s-server-1.lab.example.com]: FAILED! => changed=false
assertion: (((k3s_controller_list | length) % 2) == 1)
evaluated_to: false
msg: Etcd should have a minimum of 3 defined members and the number of members should be odd. Please see notes about HA in README.md
fatal: [k3s-server-2.lab.example.com]: FAILED! => changed=false
assertion: (((k3s_controller_list | length) % 2) == 1)
evaluated_to: false
msg: Etcd should have a minimum of 3 defined members and the number of members should be odd. Please see notes about HA in README.md
fatal: [k3s-server-3.lab.example.com]: FAILED! => changed=false
assertion: (((k3s_controller_list | length) % 2) == 1)
evaluated_to: false
msg: Etcd should have a minimum of 3 defined members and the number of members should be odd. Please see notes about HA in README.md
After adding an extra debug task to the role just before this one, I discovered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Summary
This role can be run in several modes, including validation (installed, started, stopped, restarted, uninstalled, validated)
If you want to run it first in 'installed' and then 'validated' mode in single playbook, there is a problem with k3s_controller_list variable: on second run it contains duplicate entries and consequently validation fails. That's because Ansible - sadly - doesn't scope the variables properly and they're left behind as-is after a role finishes.
It's not a very common use case, however it would be nice if the role was re-entrant. It's also very easy to achieve - e.g. by setting the
k3s_controller_list
to an empty listjust before it's being appended to in a loop:
ansible-role-k3s/tasks/ensure_pre_configuration.yml
Line 31 in 37fda0a
Issue Type
Controller Environment and Configuration
Role version:
Steps to Reproduce
Expected Result
Actual Result
After adding an extra debug task to the role just before this one, I discovered:
The text was updated successfully, but these errors were encountered: