|
1 | | -# site.yml |
| 1 | +# replication.yml |
2 | 2 | --- |
| 3 | +# vim: set syntax=yaml expandtab shiftwidth=2 tabstop=2 softtabstop=2 autoindent: |
3 | 4 |
|
4 | 5 | - hosts: localhost |
5 | 6 | become: false |
|
13 | 14 | path: "{{ 'images' if 'builded' in image_name else '' }}" |
14 | 15 | force: "{{ force_build_image | default(false) }}" |
15 | 16 |
|
| 17 | + - name: Create docker network |
| 18 | + docker_network: |
| 19 | + name: replication |
| 20 | + |
16 | 21 | - name: Run docker machines for testing PostgreSQL role |
17 | 22 | docker_container: |
18 | 23 | name: "postgresql-10-1" |
| 24 | + hostname: "postgresql-10-1" |
19 | 25 | image: "{{ image_name }}" |
20 | 26 | command: "/sbin/init" |
21 | 27 | state: started |
22 | 28 | privileged: true |
| 29 | + networks: |
| 30 | + - name: replication |
23 | 31 |
|
24 | 32 | - name: Run docker machines for testing PostgreSQL role 2 |
25 | 33 | docker_container: |
26 | 34 | name: "postgresql-10-2" |
| 35 | + hostname: "postgresql-10-2" |
27 | 36 | image: "{{ image_name }}" |
28 | 37 | command: "/sbin/init" |
29 | 38 | state: started |
30 | 39 | privileged: true |
| 40 | + networks: |
| 41 | + - name: replication |
31 | 42 |
|
32 | 43 | - name: Add new machines into postgresql inventory group |
33 | 44 | add_host: |
|
48 | 59 | vars_files: |
49 | 60 | # are these paths relative to the playbook path? |
50 | 61 | - ../../defaults/repmgr.yml |
51 | | - vars: |
52 | | - postgresql_version: 10 |
53 | | - postgresql_ext_install_repmgr: yes |
54 | | - roles: |
55 | | - - ANXS.postgresql |
| 62 | + tasks: |
| 63 | + - name: install ssh |
| 64 | + package: |
| 65 | + name: openssh |
| 66 | + state: present |
| 67 | + - name: install ssh-client |
| 68 | + package: |
| 69 | + name: openssh-clients |
| 70 | + state: present |
| 71 | + - name: install ssh-server |
| 72 | + package: |
| 73 | + name: openssh-server |
| 74 | + state: present |
| 75 | + - name: install cron |
| 76 | + package: |
| 77 | + name: cronie |
| 78 | + state: present |
| 79 | + - name: ensure sshd is running |
| 80 | + systemd: |
| 81 | + name: sshd |
| 82 | + state: started |
| 83 | + - name: ensure cron is running |
| 84 | + systemd: |
| 85 | + name: crond |
| 86 | + state: started |
| 87 | + |
| 88 | + - import_role: |
| 89 | + name: ANXS.postgresql |
| 90 | + vars: |
| 91 | + # see tests/docker/group_vars/postgresql.yml for more configuration |
| 92 | + repmgr_target_group: "postgresql" |
| 93 | + postgresql_version: 10 |
| 94 | + postgresql_ext_install_repmgr: yes |
| 95 | + postgresql_listen_addresses: |
| 96 | + - "*" |
| 97 | + #- "localhost" |
| 98 | + #- "{{ ansible_default_ipv4.address }}" |
| 99 | + postgresql_pg_hba_custom: |
| 100 | + - type: host |
| 101 | + database: repmgr |
| 102 | + user: "repmgr" |
| 103 | + address: "0.0.0.0/0" |
| 104 | + #address: "{{ ansible_default_ipv4['network'] }}/{{ [ansible_default_ipv4['network'], ansible_default_ipv4['netmask']] | join('/') | ipaddr('prefix') }}" |
| 105 | + method: "md5" |
| 106 | + comment: "" |
| 107 | + - type: host |
| 108 | + database: replication |
| 109 | + user: "repmgr" |
| 110 | + address: "0.0.0.0/0" |
| 111 | + method: "md5" |
| 112 | + comment: "" |
0 commit comments