--- - name: Defined local-path-storage state to present set_fact: storage_localpath_state: present when: - storage_localpath|bool - name: find state of local-path-storage set_fact: storage_localpath_state: absent when: - not storage_localpath|bool - name: local-path-storage need to be {{ storage_localpath_state }} k8s: state: "{{ storage_localpath_state }}" context: "{{ my_context }}" merge_type: merge resource_definition: "{{ lookup('file', item) | from_yaml }}" with_items: - "local/local-path-storage-Namespace.yaml" - "local/local-path-provisioner-service-account-ServiceAccount.yaml" - "local/local-path-provisioner-role-ClusterRole.yaml" - "local/local-path-provisioner-bind-ClusterRoleBinding.yaml" - "local/local-path-provisioner-Deployment.yaml" - "local/local-path-StorageClass.yaml" - "local/local-path-config-ConfigMap.yaml"