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

v2.9.1: The conditional check 'k3s_check_cgroup_option.rc == 0' failed. The error was: error while evaluating conditional (k3s_check_cgroup_option.rc == 0): 'dict object' has no attribute 'rc' #116

Closed
cawolf opened this issue May 17, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@cawolf
Copy link

cawolf commented May 17, 2021

Summary

On version 2.9.1, the task xanmanning.k3s : Fail if memory cgroup is not enabled fails with 'dict object' has no attribute 'rc'. This issue first seemed to be a regression of #111 , but I experienced the same error on 2.8.3 and up. I also downgraded down to 2.7.0 and the error persisted, so maybe there is a user error here?

Issue Type

  • Bug Report

Controller Environment and Configuration

role version: v2.9.1
host: Ubuntu 20.04.2 (64 bit)
targets: Debian GNU/Linux 10 (64 bit) on Raspberry Pi 4

Steps to Reproduce

execute this playbook:

- name: Build a cluster with a single control node
  hosts: k3s_cluster
  vars:
    k3s_become_for_all: true
    k3s_server:
      disable:
        - traefik
        - servicelb
        - local-storage
    k3_agent:
      kubelet-arg: "--authentication-token-webhook=true --authorization-mode=Webhook"
  roles:
    - xanmanning.k3s

Expected Result

The playbook runs and succeeds as usual. It worked in versions 2.2.0 and

Actual Result

TASK [xanmanning.k3s : Check if memory cgroup is enabled] ******************************************************************************************************************************************************************************
ok: [k3s-2]
ok: [k3s-1]

TASK [xanmanning.k3s : Fail if memory cgroup is not enabled] ***************************************************************************************************************************************************************************
fatal: [k3s-1]: FAILED! => {"msg": "The conditional check 'k3s_check_cgroup_option.rc == 0' failed. The error was: error while evaluating conditional (k3s_check_cgroup_option.rc == 0): 'dict object' has no attribute 'rc'"}
fatal: [k3s-2]: FAILED! => {"msg": "The conditional check 'k3s_check_cgroup_option.rc == 0' failed. The error was: error while evaluating conditional (k3s_check_cgroup_option.rc == 0): 'dict object' has no attribute 'rc'"}

@xanmanning xanmanning self-assigned this May 19, 2021
@xanmanning xanmanning added the bug Something isn't working label May 23, 2021
@xanmanning
Copy link
Member

Hi.

Not sure how to recreate this. What version of Ansible are you running, and on what version of Python?

The reason why I ask is the command module ALWAYS returns an .rc (see ansible.builtin.command) and the command will always run (even in check mode which was fixed in #111)

@cawolf
Copy link
Author

cawolf commented May 25, 2021

Hey,
this is the output on my contrlling machine:

ansible 2.10.3
  config file = None
  configured module search path = ['/home/cwolf/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/cwolf/.local/lib/python3.8/site-packages/ansible
  executable location = /home/cwolf/.local/bin/ansible
  python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
ansible-playbook 2.10.3
  config file = None
  configured module search path = ['/home/cwolf/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/cwolf/.local/lib/python3.8/site-packages/ansible
  executable location = /home/cwolf/.local/bin/ansible-playbook
  python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]

It worked when I initially set up the ansible playbook (role was on 2.2.0), but no other role version is working for me. Do you know of any role cache or python cache I could get rid of?

Or do you have a very basic playbook that I could test locally?

@sergeyshaykhullin
Copy link

sergeyshaykhullin commented May 25, 2021

@xanmanning I am facing with the same problem. I am using GitHub Actions runner (Ubuntu 20.04.2 LTS) with arillso action

ansible 2.10.3
  config file = /github/workspace/ansible.cfg
  configured module search path = ['/github/home/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Jul 20 2020, 23:11:29) [GCC 9.3.0]
TASK [xanmanning.k3s : Fail if memory cgroup is not enabled] *******************
fatal: [node1]: FAILED! => {"msg": "The conditional check 'k3s_check_cgroup_option.rc == 0' failed. The error was: error while evaluating conditional (k3s_check_cgroup_option.rc == 0): 'dict object' has no attribute 'rc'"}
fatal: [node2]: FAILED! => {"msg": "The conditional check 'k3s_check_cgroup_option.rc == 0' failed. The error was: error while evaluating conditional (k3s_check_cgroup_option.rc == 0): 'dict object' has no attribute 'rc'"}
fatal: [node3]: FAILED! => {"msg": "The conditional check 'k3s_check_cgroup_option.rc == 0' failed. The error was: error while evaluating conditional (k3s_check_cgroup_option.rc == 0): 'dict object' has no attribute 'rc'"}
fatal: [node4]: FAILED! => {"msg": "The conditional check 'k3s_check_cgroup_option.rc == 0' failed. The error was: error while evaluating conditional (k3s_check_cgroup_option.rc == 0): 'dict object' has no attribute 'rc'"}

Debug output

ok: [node1] => {
    "k3s_check_cgroup_option": {
        "changed": false,
        "failed": false,
        "failed_when_result": false,
        "msg": "Unsupported parameters for (ansible.legacy.command) module: cmd Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends, warn"
    }
}
ok: [node2] => {
    "k3s_check_cgroup_option": {
        "changed": false,
        "failed": false,
        "failed_when_result": false,
        "msg": "Unsupported parameters for (ansible.legacy.command) module: cmd Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends, warn"
    }
}
ok: [node3] => {
    "k3s_check_cgroup_option": {
        "changed": false,
        "failed": false,
        "failed_when_result": false,
        "msg": "Unsupported parameters for (ansible.legacy.command) module: cmd Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends, warn"
    }
}
ok: [node4] => {
    "k3s_check_cgroup_option": {
        "changed": false,
        "failed": false,
        "failed_when_result": false,
        "msg": "Unsupported parameters for (ansible.legacy.command) module: cmd Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends, warn"
    }
}

@sergeyshaykhullin
Copy link

sergeyshaykhullin commented May 25, 2021

I found that issue in 2.10.3, but now i can't do anything about it =(

arillso/docker.ansible#48

Does this role can handle this error somehow?

@xanmanning
Copy link
Member

I was asked to change the call to the command module to add 2.9.16 support: #105 (comment)

The role requirements were updated to reflect this: https://github.com/PyratLabs/ansible-role-k3s#requirements

Unfortunately the move to FQCN means I am targeting ansible.builtin.command - however it looks like (from your output) 2.10.4 is calling ansible.legacy.command which doesn't have the command argument.

In a nutshell to avoid occasionally banjaxed calls to modules and collections in Ansible (as a whole):

For the 2.9 release, you need >= 2.9.16
For the 2.10 release, you need >= 2.10.4

@cawolf
Copy link
Author

cawolf commented May 26, 2021

This solved it for me. Upgrading ansible via pip installed versions 2.10.10 (ansible-base) and 2.10.7 (ansible) on my machine. With this versions and the role version 2.9.1, everything works like a charm. Thank you for your time :)

@cawolf cawolf closed this as completed May 26, 2021
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

3 participants