Hi,
I'm using ansible version 2.7.17 and combining multiple playbooks in one file.
One of my playbooks I'm running conditionally with when and a condition.
My problem is when my condition is false, I want ansible to completely ignore my playbook and not load anything related to this playbook.
I tried using both import_playbook and include, which seems to have similar results.
The call to the playbook looks like that:
- name: Include kubespray tasks
include: ../kubespray/cluster.yml
when: cluster_installation
in my output you can see ansible run the handlers inside the ignored playbook (keeping for 2 more minutes):
PLAYBOOK: cluster.yml *******************************************************************************************************************************************************************************************
16 plays in cluster.yml
PLAY [localhost] ************************************************************************************************************************************************************************************************
META: ran handlers
Tuesday 31 March 2020 18:55:46 +0000 (0:00:00.043) 0:00:00.043 *********
META: ran handlers
META: ran handlers
[WARNING]: Could not match supplied host pattern, ignoring: bastion
PLAY [bastion[0]] ***********************************************************************************************************************************************************************************************
skipping: no hosts matched
PLAY [k8s-cluster:etcd] *****************************************************************************************************************************************************************************************
META: ran handlers
Tuesday 31 March 2020 18:55:46 +0000 (0:00:00.037) 0:00:00.081 *********
Tuesday 31 March 2020 18:55:46 +0000 (0:00:00.049) 0:00:00.130 *********
Tuesday 31 March 2020 18:55:46 +0000 (0:00:00.048) 0:00:00.178 *********
Tuesday 31 March 2020 18:55:46 +0000 (0:00:00.051) 0:00:00.230 *********
Tuesday 31 March 2020 18:55:46 +0000 (0:00:00.024) 0:00:00.254 *********
Tuesday 31 March 2020 18:55:46 +0000 (0:00:00.021) 0:00:00.275 *********
Thanks for the help,
Ronen