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
- name: Collect public key | |
slurp: src="/var/lib/postgresql/.ssh/id_rsa.pub" | |
register: mykey | |
- | |
- name: Setup ssh keys | |
authorized_key: key="{{mykey.content.decode('base64')}}" user="backup" | |
delegate_to: "{{item}}" | |
with_items: groups['backup'] |
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 -m getent -a 'database=passwd key=bcoca' -i 'localhost,' all -c local | |
localhost | success >> { | |
"ansible_facts": { | |
"getent_passwd": { | |
"bcoca": [ | |
"x", | |
"1000", | |
"1000", | |
"", | |
"/home/bcoca", |
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
#play.yml | |
--- | |
- hosts: localhost | |
connection: local | |
gather_facts: false | |
roles: | |
- test | |
tasks: | |
- debug: msg="ran untagged" |
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
_________________ | |
< GATHERING FACTS > | |
----------------- | |
\ ,+*^^*+___+++_ | |
\ ,*^^^^ ) | |
\ _+* ^**+_ | |
\ +^ _ _++*+_+++_, ) | |
_+^^*+_ ( ,+*^ ^ \+_ ) | |
{ ) ( ,( ,_+--+--, ^) ^\ | |
{ (@) } f ,( ,+-^ __*_*_ ^^\_ ^\ ) |
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: | |
- karen.dragonfear | |
- paola.dragonfear | |
- mathilda.dragonfear | |
user: root | |
vars: | |
backupserver: mathilda.dragonfear | |
tasks: | |
- name: get zpool data | |
action: shell zpool list -H -o name |
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
- inventory_dir/ | |
- hosts | |
- group_vars/ | |
- all |
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
Github workflow | |
=============== | |
Fork a repo using github GUI, now there are 2 repos you are going to deal with, 1 the repo under your user bcoca/ansible and the main project ansible/ansible | |
* Clone the ansible repo (this is now 'origin'), the following assumes youre ssh keys are setup. | |
There are several ways of doing this and organizing your workflow, this is just 'my way' and it can be used with several variations. | |
Those with direct commit access might want to reverse this, you cannot count on direct pushes being rejected. | |
#>git clone git@github.com:ansible/ansible |
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 -m stat -a 'path=/home/bcoca/work/ansible/tmp' localhost | |
localhost | SUCCESS => { | |
"changed": false, | |
"stat": { | |
"atime": 1460579289.7836845, | |
"ctime": 1460579289.7836845, | |
"dev": 2083, | |
"exists": true, | |
"gid": 1000, | |
"gr_name": "bcoca", |
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
bcoca@erebos:~/work/ansible-modules-core(devel) $ ansible -m setup -a 'filter=ansible_python' localhost | |
localhost | SUCCESS => { | |
"ansible_facts": { | |
"ansible_python": { | |
"executable": "/usr/lib/python-exec/python2.7/python", | |
"has_sslcontext": true, | |
"type": "CPython", | |
"version": { | |
"major": 2, | |
"micro": 11, |
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: locals | |
gather_facts: false | |
strategy: free | |
tasks: | |
- debug: msg={{wait}} | |
- wait_for: timeout={{wait}} | |
- debug: msg={{wait}} |