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: 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' |
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 [all] ******************************************************************** | |
GATHERING FACTS *************************************************************** | |
ok: [tyrion] | |
TASK: [Create workdir] ******************************************************** | |
ok: [tyrion] | |
TASK: [Create user homes] ***************************************************** | |
ok: [tyrion] => (item={'owner': 'root'}) |
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 [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"} |
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: all | |
vars: | |
dir_list: | |
- name: 'directory' | |
prefix: 'my_' | |
- name: 'other_directory' |
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
#!/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" |
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: all | |
vars: | |
account: 'user.name' | |
migration: | |
target: | |
"user.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
{# | |
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 |
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: 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 |
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
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 %} |
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: 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' |