Skip to content

Instantly share code, notes, and snippets.

- 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']
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",
#play.yml
---
- hosts: localhost
connection: local
gather_facts: false
roles:
- test
tasks:
- debug: msg="ran untagged"
_________________
< GATHERING FACTS >
-----------------
\ ,+*^^*+___+++_
\ ,*^^^^ )
\ _+* ^**+_
\ +^ _ _++*+_+++_, )
_+^^*+_ ( ,+*^ ^ \+_ )
{ ) ( ,( ,_+--+--, ^) ^\
{ (@) } f ,( ,+-^ __*_*_ ^^\_ ^\ )
@bcoca
bcoca / gist:5137216
Created March 11, 2013 20:01
rewritten
- 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
@bcoca
bcoca / gist:6470362
Created September 6, 2013 21:43
sample of ansible inventory all
- inventory_dir/
- hosts
- group_vars/
- all
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
 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",
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,
- hosts: locals
gather_facts: false
strategy: free
tasks:
- debug: msg={{wait}}
- wait_for: timeout={{wait}}
- debug: msg={{wait}}