Skip to content

Instantly share code, notes, and snippets.

View drybjed's full-sized avatar

Maciej Delmanowski drybjed

View GitHub Profile
- name: Update default postgres password
postgresql_user:
name: 'postgres'
password: '{{ item.postgres_password | default(postgresql_default_postgres_password) }}'
encrypted: False
port: '{{ item.port }}'
state: 'present'
with_items: postgresql_default_cluster + postgresql_clusters
sudo_user: 'postgres'
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
ok: [tyrion]
TASK: [Create workdir] ********************************************************
ok: [tyrion]
TASK: [Create user homes] *****************************************************
ok: [tyrion] => (item={'owner': 'root'})
@drybjed
drybjed / play
Last active August 29, 2015 14:04
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
ok: [tyrion]
TASK: [group ] ****************************************************************
failed: [tyrion] => (item={'name': 'first_group'}) => {"failed": true, "item": {"name": "first_group"}, "name": "first_group"}
msg: groupadd: invalid group ID ''
failed: [tyrion] => (item={'name': 'second_group', 'system': 'yes'}) => {"failed": true, "item": {"name": "second_group", "system": "yes"}, "name": "second_group"}
---
- hosts: all
vars:
dir_list:
- name: 'directory'
prefix: 'my_'
- name: 'other_directory'
#!/bin/bash
prefix="ginas."
cd playbooks/roles/
for dir in *; do
role=$(echo $dir | cut -d. -s -f2)
if [[ "$role" != "" ]]; then
echo "cd $dir ; git remote add origin git@github.com:drybjed/$role"
---
- hosts: all
vars:
account: 'user.name'
migration:
target:
"user.name":
{#
Abusing Jinja2 templates 101: Postfix local facts
This template manages contents of /etc/ansible/facts.d/postfix.fact
and allows to configure Postfix ba multiple separate roles using
dependency variables. Configuration will be stored and preserved
idempotently between ansible-playbook runs.
Recognized variables:
- postfix_dependency_lists: hash variable which defines lists of values
---
- name: ensure swap file is allocated
command: dd if=/dev/zero of=/swapfile bs=1M count={{ common_swap_size }} creates=/swapfile
when: ansible_swaptotal_mb < 1
register: swapfile_init
- name: ensure swap file is created
command: mkswap /swapfile
when: swapfile_init is defined and swapfile_init.changed
127.0.0.1 localhost
::1 localhost
{% for host in groups['all'] %}
{# {{ hostvars[host]['ansible_default_ipv4'].address }} {{ hostvars[host]['ansible_fqdn'] }} {{ hostvars[host]['ansible_hostname'] }} #}
{{ host }}
{{ hostvars['pyke']['ansible_default_ipv4']['address'] }}
{# {{ hostvars | to_nice_json }} #}
{% endfor %}
- name: Wait until VM is installed
virt: name={{ vm.name }}
command=status
register: virt_status
until: virt_status.status == 'shutdown'
retries: 20
delay: 60
when: {{ vm.state }} == 'running'