[root@8a98ab1d7dea include]# ansible --version
ansible 2.4.3.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible-2.4.3.0-py2.7.egg/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
[root@8a98ab1d7dea include]# ansible-playbook -i hosts.info include_with_vars.yaml -e condition=false
PLAY [docker] ***************************************************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************************
ok: [docker1]
TASK [include_tasks] ********************************************************************************************************************************************************************************
included: /opt/include/docker1.yaml for docker1
TASK [debug] ****************************************************************************************************************************************************************************************
ok: [docker1] => {
"msg": "Tasks 1 Host 1"
}
PLAY RECAP ******************************************************************************************************************************************************************************************
docker1 : ok=3 changed=0 unreachable=0 failed=0
[root@8a98ab1d7dea include]# ansible-playbook -i hosts.info include_with_vars.yaml -e condition=true
PLAY [docker] ***************************************************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************************
ok: [docker1]
TASK [include_tasks] ********************************************************************************************************************************************************************************
included: /opt/include/docker1.yaml for docker1
TASK [debug] ****************************************************************************************************************************************************************************************
ok: [docker1] => {
"msg": "Tasks 1 Host 1"
}
PLAY RECAP ******************************************************************************************************************************************************************************************
docker1 : ok=3 changed=0 unreachable=0 failed=0
[root@8a98ab1d7dea include]# ansible-playbook -i hosts.info import_with_vars.yaml -e condition=false
PLAY [docker] ***************************************************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************************
ok: [docker1]
TASK [debug] ****************************************************************************************************************************************************************************************
ok: [docker1] => {
"msg": "Tasks 1 Host 1"
}
PLAY RECAP ******************************************************************************************************************************************************************************************
docker1 : ok=2 changed=0 unreachable=0 failed=0
[root@8a98ab1d7dea include]# ansible-playbook -i hosts.info import_with_vars.yaml -e condition=true
PLAY [docker] ***************************************************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************************
ok: [docker1]
TASK [debug] ****************************************************************************************************************************************************************************************
ok: [docker1] => {
"msg": "Tasks 1 Host 1"
}
PLAY RECAP ******************************************************************************************************************************************************************************************
docker1 : ok=2 changed=0 unreachable=0 failed=0