This file contains hidden or 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
- name: Link check plugins | |
file: src={{ item.path }} dest={{ item.dest }} state=link | |
with_items: | |
- { path: '/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugins-cpu-checks-0.0.2/bin/check-cpu.rb', dest: '/etc/sensu/plugins/checks/check-cpu.rb' } | |
- { path: '/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugins-cpu-checks-0.0.2/bin/check-cpu.sh', dest: '/etc/sensu/plugins/checks/check-cpu.sh' } | |
notify: restart sensu-client |
This file contains hidden or 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: all | |
tasks: | |
- name: create a temporary inventory group | |
group_by: key=os_{{ansible_os_family}} | |
- hosts: os_Windows | |
tasks: | |
# these tasks only apply to Windows | |
- hosts: all:!os_Windows |
This file contains hidden or 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
- name: test to see if ping works | |
ping: | |
ignore_errors: true | |
register: pingResult | |
- name: install simplejson if needed | |
raw: yum install -y python-simplejson | |
when: pingResult|failed |
This file contains hidden or 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
We set environment variables for the playbook run based on the type of cloud credential, so that the | |
modules can pick them up. If the modules are explicitly passed the keys, that will of course override | |
the cloud credential selection. | |
For AWS: AWS_ACCESS_KEY and AWS_SECRET_KEY | |
For Rackspace: RAX_USERNAME and RAX_API_KEY | |
For Google Compute Engine: GCE_EMAIL, GCE_PROJECT, and GCE_PEM_FILE_PATH |
This file contains hidden or 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
environment: | |
http_proxy: http://proxy.example.com:8080 | |
my_other_var: boo | |
yet_another: argh |
This file contains hidden or 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: all | |
connection: local | |
tasks: | |
- template: src=test-loop.j2 dest=./foo |
This file contains hidden or 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
host-one | |
host-two | |
host-three skip_facts=True | |
host-four |
This file contains hidden or 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 | |
tasks: | |
- name: get the pretty-printed git hash | |
command: "git log --pretty=format:'%h' -n 1" | |
register: githash | |
changed_when: False | |
- debug: msg="Playbook version is {{ githash.stdout }}" |
This file contains hidden or 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
# do you need this? | |
from jinja2 import contextfilter | |
class FilterModule(object): | |
''' Extra filters ''' | |
def filters(self): | |
return { | |
'sort_hosts': self.sort_hosts, | |
} |
This file contains hidden or 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
- authorized_key: user=vagrant key="{{ lookup('file', item) }}" | |
with_first_found: | |
- "{{ security.ssh_key_file }}.pub" |