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
# Copyright (c) 2017 Ansible Project | |
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | |
from __future__ import (absolute_import, division, print_function) | |
__metaclass__ = type | |
DOCUMENTATION = ''' | |
name: generator | |
plugin_type: inventory | |
version_added: "2.5" |
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
ANSIBLE_DEBUG=1 ansible-inventory --list -i inventory/cluster.config | |
13396 1509411881.86061: starting run | |
13396 1509411881.94683: Added group all to inventory | |
13396 1509411881.94690: Added group ungrouped to inventory | |
13396 1509411881.94695: Group all now contains ungrouped | |
13396 1509411881.94806: Loading InventoryModule 'host_list' from /home/will/src/ansible/lib/ansible/plugins/inventory/host_list.py (searched paths: /home/will/src/ansible/lib/ansible/plugins/inventory:/home/will/src/errcd-ansible/plugins/inventory) | |
13396 1509411881.94827: Loading InventoryModule 'script' from /home/will/src/ansible/lib/ansible/plugins/inventory/script.py (searched paths: /home/will/src/ansible/lib/ansible/plugins/inventory:/home/will/src/errcd-ansible/plugins/inventory) | |
13396 1509411881.94845: Loading InventoryModule 'yaml' from /home/will/src/ansible/lib/ansible/plugins/inventory/yaml.py (searched paths: /home/will/src/ansible/lib/ansible/plugins/inventory:/home/will/src/errcd-ansible/plugins/inventory) | |
13396 150 |
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
$ ansible-playbook playbook.yml -i testlocal -e remote_host=testlocal | |
PLAY [localhost] *************************************************************** | |
TASK [setup] ******************************************************************* | |
ok: [localhost] | |
TASK [command] ***************************************************************** | |
fatal: [localhost -> testlocal]: FAILED! => {"changed": false, "failed": true, "module_stderr": "/bin/sh: {{: command not found\n", "module_stdout": "", "msg": "MODULE FAILURE"} | |
to retry, use: --limit @/home/will/tmp/ansible/playbook.retry |
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/env python | |
import collections | |
import json | |
import os | |
import sys | |
''' location returns the location portion of the hostname ''' | |
def location(host): |
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
ansible-playbook hostname.yml -e hosts=some_ansible_group -vv |
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
git checkout branch_containing_your_commit | |
git rebase f35ed8a6c0dc81 # last commit before the removal of library modules | |
git format-patch f35ed8a6c0dc81 --stdout > /tmp/patchname.patch | |
git checkout devel | |
cd lib/ansible/modules/core/ | |
git checkout -b branch_for_new_pull_request 417309a626 # this is before the module renames | |
git am -p2 /tmp/patchname.patch # -p2 here strips off the leading directory (in most cases, library) | |
git rebase devel | |
git push your_remote_for_your_fork branch_for_new_pull_request |
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@fedora pkilldemo]$ ansible-playbook pkilldemo.yml | |
PLAY [localhost] ************************************************************** | |
GATHERING FACTS *************************************************************** | |
ok: [127.0.0.1] | |
TASK: [generate random process string] **************************************** | |
changed: [127.0.0.1] |
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: localhost | |
connection: local | |
tasks: | |
- npm: name="{{item}}" path="{{installdir}}/A" global=no | |
with_items: | |
- hubot | |
- coffee-script | |
- npm: name="{{item}}" path="{{installdir}}/B" global=no |
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
[group-a:children] | |
group-b | |
# here group-c is actually a host because of the missing :children | |
[group-b] | |
group-c | |
# as a result, host-c is also a host, but doesn't belong to group-b (or group-a) | |
[group-c] | |
host-c |
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'}) |