I have a simple test role located in /etc/ansible/roles/test/tasks/main.yml
like this:
---
- roles/common/tasks/facts.yml
- include: test.yml
And I use the example code of Python API 2.0 found in Documentation. Then I’ve encountered a strange problem.
On my develop machine which is a Mac, everything works fine, but when I run it on the production machine whose operating system is CentOS 7, the two included tasks can’t be executed. Here is the output:
PLAY [Test Play] **************************************************************
TASK [setup] *******************************************************************
ok: [10.85.0.20]
TASK [test : include] **********************************************************
included: /etc/ansible/roles/common/tasks/facts.yml for 10.85.0.20
TASK [test : include] **********************************************************
included: /etc/ansible/roles/test/tasks/test.yml for 10.85.0.20
You see, it did including operation, but nothing actually executed.
And the correct output would be:
PLAY [Test Play] **************************************************************
TASK [setup] *******************************************************************
ok: [10.85.0.20]
TASK [test : include] **********************************************************
included: /Users/Jiang/projects/ecs-ansible/roles/common/tasks/facts.yml for 10.85.0.20
TASK [test : facts.d dir] ******************************************************
ok: [10.85.0.20]
TASK [test : facts file] *******************************************************
changed: [10.85.0.20]
TASK [test : get facts from pluto] *********************************************
changed: [10.85.0.20]
TASK [test : setup] ************************************************************
ok: [10.85.0.20]
TASK [test : include] **********************************************************
included: /Users/Jiang/projects/ecs-ansible/roles/test/tasks/test.yml for 10.85.0.20
TASK [test : debug] ************************************************************
ok: [10.85.0.20] => {
"msg": "15.0"
}
Version:
- OSX 10.11.4 beta & ansible 2.1.0 (devel
36aa89a
) last updated 2016/01/18 14:48:31 (GMT +800) - CentOS 7.1.1503 & ansible 2.1.0 (devel
36aa89a
) last updated 2016/01/18 23:05:26 (GMT +800)
Could someone help me to solve this? Thanks.