Created
February 10, 2014 09:37
-
-
Save willthames/8912987 to your computer and use it in GitHub Desktop.
Ansible library path merging example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import json | |
print json.dumps({'hello': 'world'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: 127.0.0.1 | |
connection: local | |
tasks: | |
- name: test local module inclusion | |
action: dummy | |
- name: test standard module inclusion | |
action: debug msg="got here" | |
- name: fail and print module path | |
action: madeup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[will@cheetah ansible]$ echo $ANSIBLE_LIBRARY | |
/Users/will/src/ansible/library | |
[will@cheetah ansible]$ echo $ANSIBLE_CONFIG | |
/Users/will/.ansible/config | |
[will@cheetah ansible]$ grep library $ANSIBLE_CONFIG | |
# location of ansible library, eliminates need to specify --module-path | |
library = ~/src/library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[will@cheetah ansible]$ ansible-playbook -M ~/src/library dummy.yml | |
PLAY [127.0.0.1] ************************************************************** | |
GATHERING FACTS *************************************************************** | |
ok: [127.0.0.1] | |
TASK: [dummy] ***************************************************************** | |
ok: [127.0.0.1] | |
TASK: [debug msg="got here"] ************************************************** | |
ok: [127.0.0.1] => { | |
"msg": "got here" | |
} | |
TASK: [madeup] **************************************************************** | |
fatal: [127.0.0.1] => module madeup not found in /Users/will/src/library:/Users/will/src/ansible/library/cloud:/Users/will/src/ansible/library/commands:/Users/will/src/ansible/library/database:/Users/will/src/ansible/library/files:/Users/will/src/ansible/library/internal:/Users/will/src/ansible/library/inventory:/Users/will/src/ansible/library/messaging:/Users/will/src/ansible/library/monitoring:/Users/will/src/ansible/library/net_infrastructure:/Users/will/src/ansible/library/network:/Users/will/src/ansible/library/notification:/Users/will/src/ansible/library/packaging:/Users/will/src/ansible/library/source_control:/Users/will/src/ansible/library/system:/Users/will/src/ansible/library/testing:/Users/will/src/ansible/library/utilities:/Users/will/src/ansible/library/web_infrastructure:/Users/will/src/ansible/library | |
FATAL: all hosts have already failed -- aborting | |
PLAY RECAP ******************************************************************** | |
to retry, use: --limit @/Users/will/dummy.retry | |
127.0.0.1 : ok=3 changed=0 unreachable=1 failed=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
will@cheetah ansible]$ ansible-playbook dummy.yml | |
PLAY [127.0.0.1] ************************************************************** | |
GATHERING FACTS *************************************************************** | |
ok: [127.0.0.1] | |
TASK: [dummy] ***************************************************************** | |
fatal: [127.0.0.1] => module dummy not found in /Users/will/src/ansible/library/cloud:/Users/will/src/ansible/library/commands:/Users/will/src/ansible/library/database:/Users/will/src/ansible/library/files:/Users/will/src/ansible/library/internal:/Users/will/src/ansible/library/inventory:/Users/will/src/ansible/library/messaging:/Users/will/src/ansible/library/monitoring:/Users/will/src/ansible/library/net_infrastructure:/Users/will/src/ansible/library/network:/Users/will/src/ansible/library/notification:/Users/will/src/ansible/library/packaging:/Users/will/src/ansible/library/source_control:/Users/will/src/ansible/library/system:/Users/will/src/ansible/library/testing:/Users/will/src/ansible/library/utilities:/Users/will/src/ansible/library/web_infrastructure:/Users/will/src/ansible/library | |
FATAL: all hosts have already failed -- aborting | |
PLAY RECAP ******************************************************************** | |
to retry, use: --limit @/Users/will/dummy.retry | |
127.0.0.1 : ok=1 changed=0 unreachable=1 failed=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment