-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Task 'Disable swap' fails when there is no swap configured on a node #6642
Comments
@neuliuyin could you put the entire log ? and if possible add (between line 15 and 16)
I'm trying to reproduce but can't seem to be able to have a commands without stdout attribute. |
@floryut here is debug output: TASK [debug] ***********************************************************************************************************************************
ok: [master1] => {
"msg": {
"changed": false,
"cmd": [
"/sbin/swapon",
"-s"
],
"delta": "0:00:00.004486",
"end": "2020-09-10 06:45:08.465100",
"failed": false,
"rc": 0,
"start": "2020-09-10 06:45:08.460614",
"stderr": "",
"stderr_lines": [],
"stdout": "",
"stdout_lines": []
}
} |
Wahou... That's what I got..I really don't understand how the ansible task report the |
Maybe check whether swapon.stdout is null or its length. |
shouldn't need it, the code is quite simple:
this takes the output of
It's using the |
@EppO I'm sure I checked again and found that the issue is caused by the |
Interesting, will check that and maybe put a |
I've submit a PR, WDYT ? |
We only care to disable it (the "swapon" registered variable is not used anywhere else. This allows to get rid of the ignore_errors, since this was added because swapon.stdout does not exist in check_mode (see issue kubernetes-sigs#6642).
We only care to disable it (the "swapon" registered variable is not used anywhere else. This allows to get rid of the ignore_errors, since this was added because swapon.stdout does not exist in check_mode (see issue kubernetes-sigs#6642).
We only care to disable it (the "swapon" registered variable is not used anywhere else. This allows to get rid of the ignore_errors, since this was added because swapon.stdout does not exist in check_mode (see issue kubernetes-sigs#6642).
We only care to disable it (the "swapon" registered variable is not used anywhere else. This allows to get rid of the ignore_errors, since this was added because swapon.stdout does not exist in check_mode (see issue kubernetes-sigs#6642).
We only care to disable it (the "swapon" registered variable is not used anywhere else. This allows to get rid of the ignore_errors, since this was added because swapon.stdout does not exist in check_mode (see issue kubernetes-sigs#6642).
* Mask systemd swap.target do disable swap This is a more generic way to disable swap, since it pulls .swap units in systemd distributions; fstab is only one way to generate .swap units. * Unconditionally disable swap We only care to disable it (the "swapon" registered variable is not used anywhere else. This allows to get rid of the ignore_errors, since this was added because swapon.stdout does not exist in check_mode (see issue #6642). * Don't explicitly disable swapOnZram We're already masking the swap.target, which would pull the zram unit, hence no need to handle zram-generator specifically.
* Mask systemd swap.target do disable swap This is a more generic way to disable swap, since it pulls .swap units in systemd distributions; fstab is only one way to generate .swap units. * Unconditionally disable swap We only care to disable it (the "swapon" registered variable is not used anywhere else. This allows to get rid of the ignore_errors, since this was added because swapon.stdout does not exist in check_mode (see issue kubernetes-sigs#6642). * Don't explicitly disable swapOnZram We're already masking the swap.target, which would pull the zram unit, hence no need to handle zram-generator specifically.
Environment:
OS (
printf "$(uname -srm)\n$(cat /etc/os-release)\n"
):Linux 3.10.0-1127.el7.x86_64 x86_64
NAME="CentOS Linux"
VERSION="7 (Core)"
Version of Ansible (
ansible --version
):ansible 2.9.6
Version of Python (
python --version
):python version = 3.7.3 (default, Aug 4 2020, 19:30:55) [Clang 11.0.3 (clang-1103.0.32.62)]
Kubespray version (commit) (
git rev-parse --short HEAD
):kubespray-2.13.3
Command used to invoke ansible:
ansible-playbook -i contrib/inventory_builder/k8s_hosts.yaml cluster.yml --user centos -b --check
Output of ansible run:
fatal: [master1]: FAILED! => {"msg": "The conditional check 'swapon.stdout' failed. The error was: error while evaluating conditional (swapon.stdout): 'dict object' has no attribute 'stdout'\n\nThe error appears to be in '/Users/lyin/Downloads/kubespray-2.13.3/roles/kubernetes/preinstall/tasks/0010-swapoff.yml': line 16, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n changed_when: no\n- name: Disable swap\n ^ here\n"}
Anything else do we need to know:
The text was updated successfully, but these errors were encountered: