In the snippet below, if state is absent, then obviously permissions can’t be set on something that is not present. My objective is to run “permissions” only when state is present; else, do nothing.
acl:
name={{secrets_dir}}/{{item.0.file}}
state=“{{‘present’ if item.0.pods is not defined or machine_pod in item.0.pods else ‘absent’}}”
entity=“{{item.1.entity}}”
etype=“{{item.1.etype}}”
permissions=r
default=no
with_subelements:
- “{{ secrets }}”
- ACL
When I run this task, I get the message which is helpful, but I have been unable to use if-else or omit to solve this problem.
“msg”: “‘permissions’ MUST NOT be set when ‘state=absent’.”
Thanks !