-
Notifications
You must be signed in to change notification settings - Fork 135
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
Version check fails #115
Comments
hmm... I can reproduce it with 5 different Linuxes:
Therefore I think something is missing, probably on the Ansible Controller. Your requirements only listens Ansible itself. Is there any "special" python lib necessary? Or ist it maybe something in my ansible.cfg? It looks like this:
|
I just came across this: ansible/ansible#70014 (comment) I use Python 3. Are your tests running with Python 2? If I use Python 2 on the Controller, it works:
Tested like this:
Doing so, I'm ending up here:
Which is also a version issue (looks like "stable" should be replaced by the actual version). And for me it looks like the role knows the actual release:
What I tried now was removing the "stable" from the vars: Old:
New:
With the new one it works. But I understood the readme that I can set the version to "stable". Was I wrong? |
Interesting, my testing is all done in Python 3 (v3.9.5): https://github.com/PyratLabs/ansible-role-k3s/runs/2577182899?check_suite_focus=true#step:3:5 Yes, "Stable" should be usable - that is in fact the default (not in defaults, but the default channel that is selected when |
Added some debugs around the task: - debug:
var: k3s_release_version
- debug:
msg: "{{ k3s_release_version | type_debug }}"
#- fail:
- name: "Check that k3s_release_version >= {{ k3s_min_version }}"
ansible.builtin.assert:
that:
- (k3s_release_version | replace('v', '')) is version_compare(k3s_min_version, '>=')
success_msg: "{{ k3s_release_version }} is supported by this role."
fail_msg: "{{ k3s_release_version }} is not supported by this role, please use xanmanning.k3s v1.x."
- fail: Molecule tests pass Vagrant tests fail Stinks of this issue again ansible/ansible#71824 - it meant that facts were not being redefined properly, in some versions you could change the fact version - in others you could not. |
Found it. This is broken (it used to work in earlier Ansible releases!): Playbook ---
- hosts: k3s
become: true
roles:
- { role: xanmanning.k3s, k3s_release_version: stable } This works: Inventory ---
k3s:
vars:
k3s_release_version: stable
# And so on... Playbook ---
- hosts: k3s
become: true
roles:
- { role: xanmanning.k3s } This work as well Playbook ---
- hosts: k3s
become: true
vars:
k3s_release_version: stable
tasks:
- name: Run K3S role
include_role:
name: xanmanning.k3s This also works Playbook ---
- hosts: k3s
become: true
vars:
k3s_release_version: stable
roles:
- role: xanmanning.k3s You can test this works by changing the variable to "latest" and you will get the v1.21 release rather than v1.20 (at time of writing) |
I'll update documentation to use the more "modern" style of defining this, but it looks like changing ways in which roles can be called by Ansible. I'm surprised that this isn't picked up by linting. |
Thanks a lot for your effort! I stumbled (by accident) on another weird issue. In my tests above, I used
The weird thing is: as far as I tested, it only happens if you do multiple hosts at once with the same playbook and use |
Possibly fact caching / gathering ? |
Maybe, yes. I'll figure it out. |
Summary
Version check fails
Issue Type
Controller Environment and Configuration
Error
Role version:
Ansible version:
Issue-Dump (no idea why this shows another error):
Steps to Reproduce
Other vars from group_vars:
Expected Result
Installing latest k3s
Actual Result
The text was updated successfully, but these errors were encountered: