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

Command tasks fail for ansible == 2.9.16 #105

Closed
py-t opened this issue Apr 8, 2021 · 4 comments
Closed

Command tasks fail for ansible == 2.9.16 #105

py-t opened this issue Apr 8, 2021 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@py-t
Copy link

py-t commented Apr 8, 2021

Summary

In the newest Release (k3s
Ansible does not seem to handle ansible.builtin.command blocks in the role right

Issue Type

  • Bug Report

Controller Environment and Configuration

  • ansible==2.9.16, no extra config
  • role: 2.8.1

Steps to Reproduce

- hosts: all
  roles:
    - xanmanning.k3s

The following task fails: validate/configuration/unsupported-rootless.yml -> Check if newuidmap is available:

{"reason": "this task 'ansible.builtin.command' has extra params, which is only allowed in the following modules: ansible.legacy.add_host, ansible.legacy.import_tasks, ansible.legacy.include_tasks, set_fact, ansible.builtin.include_vars, include_tasks, ansible.legacy.set_fact, ansible.builtin.include, meta, ansible.legacy.include_vars, ansible.builtin.include_tasks, import_tasks, command, add_host, ansible.legacy.import_role, ansible.builtin.add_host, group_by, ansible.builtin.meta, win_shell, include, ansible.builtin.set_fact, import_role, shell, include_role, ansible.legacy.group_by, ansible.legacy.include_role, ansible.legacy.meta, include_vars, ansible.builtin.group_by, raw, ansible.builtin.import_tasks, ansible.builtin.import_role, win_command, script, ansible.builtin.include_role, ansible.legacy.include\n\nThe error appears to be in '/home/ilya/ng/deployment/k3s-cluster/ansible_roles/xanmanning.k3s/tasks/validate/environment/local/issue-data.yml': line 6, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Ensure Ansible version is captured\n  ^ here\n"}

How to fix

The error is fixed by changing the task into (putting the command into cmd key):

- name: Check if newuidmap is available
  ansible.builtin.command:
    cmd: "which newuidmap"
  failed_when: false
  changed_when: false
  register: k3s_check_newuidmap_installed

Same is valid for other command tasks

@xanmanning xanmanning self-assigned this Apr 8, 2021
@xanmanning xanmanning added the bug Something isn't working label Apr 8, 2021
@samcat116
Copy link

Also happens to me on Ansible 2.10

@xanmanning
Copy link
Member

2.9.16 relates to this bug: ansible/ansible#72958
<=2.10.3 relates to this bug: ansible/ansible#71824

This...

- name: Check if newuidmap is available
  ansible.builtin.command:
    cmd: "which newuidmap"
  failed_when: false
  changed_when: false
  register: k3s_check_newuidmap_installed

Was spotty in terms of whether it worked or not in 2.9 and 2.10 releases until both those bugs were closed, hence why I set this:

https://github.com/PyratLabs/ansible-role-k3s#requirements

and builds pass: https://github.com/PyratLabs/ansible-role-k3s/actions/runs/715024863

I will look into seeing how far back I can implement using "cmd" - however I am tied up in other engagements at the moment...

@xanmanning
Copy link
Member

xanmanning commented Apr 10, 2021

In this WIP PR, it looks like I can add 2.9.16 release to supported releases based on this test script. As you can see, the aforementioned bugs really did a number to screw up the command module when using FQCN!

Version Result
2.10.7 ✔️
2.10.6 ✔️
2.10.5 ✔️
2.10.4 ✔️
2.10.3
2.10.2
2.10.1
2.10.0
2.9.19 ✔️
2.9.18 ✔️
2.9.17 ✔️
2.9.16 ✔️
2.9.15
2.9.14
2.9.13
2.9.12
2.9.11
2.9.10
2.9.9
2.9.8
2.9.7
2.9.6
2.9.5

@xanmanning
Copy link
Member

Closing as 2.9.16 support added. Matrix for supported versions above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants