We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I was trying to delete file(s) within debops.swapfile role . I have used suggested format of the variable, here is my playbook :
debops.swapfile
- name: Remove swap files include_role: name: swapfile vars: ansible_system_capabilities_enforced: False swapfile__files: - path: /swap01 state: absent
But I can't do this because that this task in the role was always true, turn on the swap and prevent it from being deleted. Here is the snip :
- name: Enable swap files command: 'swapon -p {{ item.item.priority | d(swapfile__priority) }} {{ item.item.path | d(item.item) }}' # noqa no-handler with_items: '{{ swapfile__register_allocation.results|d([]) }}' when: (item is changed and item.state|d("present") != 'absent' and ((ansible_system_capabilities_enforced|d())|bool and "cap_sys_admin" in ansible_system_capabilities) or not (ansible_system_capabilities_enforced|d(True))|bool)
I guess the problem is in the condition. The right prefix item.item.state is missing. My proposal :
- name: Enable swap files command: 'swapon -p {{ item.item.priority | d(swapfile__priority) }} {{ item.item.path | d(item.item) }}' # noqa no-handler with_items: '{{ swapfile__register_allocation.results|d([]) }}' when: (item is changed and item.item.state|d("present") != 'absent' and ((ansible_system_capabilities_enforced|d())|bool and "cap_sys_admin" in ansible_system_capabilities) or not (ansible_system_capabilities_enforced|d(True))|bool)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I was trying to delete file(s) within
debops.swapfile
role . I have used suggested format of the variable, here is my playbook :But I can't do this because that this task in the role was always true, turn on the swap and prevent it from being deleted. Here is the snip :
I guess the problem is in the condition. The right prefix item.item.state is missing. My proposal :
The text was updated successfully, but these errors were encountered: