Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix repmgrd service on Ubuntu #2451

Merged
merged 6 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
/bin/systemctl restart {{ pg.service_name[ansible_os_family] }},
/bin/systemctl reload {{ pg.service_name[ansible_os_family] }},
/bin/systemctl start {{ repmgr.service_name[ansible_os_family] }},
/bin/systemctl stop {{ repmgr.service_name[ansible_os_family] }},
{{ repmgr.bin_dir[ansible_os_family] }}/repmgr standby follow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

/bin/systemctl stop {{ repmgr.service_name[ansible_os_family] }}
validate: 'visudo -cf %s'

- name: Extensions | repmgr | Create super user in postgresql
Expand Down Expand Up @@ -94,18 +93,25 @@
group: postgres
when: template_repmgr_conf.dest != '/etc/repmgr.conf'

# For repmgr installed from Ubuntu package additional configuration is required before repmgrd is started as daemon
# For repmgr installed from Ubuntu package additional configuration is required before repmgrd is started as daemon,
# see https://repmgr.org/docs/5.2/repmgrd-daemon.html#REPMGRD-CONFIGURATION-DEBIAN-UBUNTU
- name: Extensions | repmgr | Set repmgr.conf file in /etc/default/repmgrd
replace:
path: /etc/default/repmgrd
regexp: "^#REPMGRD_CONF=\"/path/to/repmgr.conf\""
replace: "REPMGRD_CONF=\"{{ repmgr.config_dir[ansible_os_family] }}/repmgr.conf\""
regexp: ^#REPMGRD_CONF=\"/path/to/repmgr.conf\"
replace: REPMGRD_CONF="{{ repmgr.config_dir[ansible_os_family] }}/repmgr.conf"

- name: Extensions | repmgr | Enable repmgrd in /etc/default/repmgrd
replace:
path: /etc/default/repmgrd
regexp: "^[#]?REPMGRD_ENABLED=no"
replace: "REPMGRD_ENABLED=yes"
regexp: ^[#]?REPMGRD_ENABLED=no
replace: REPMGRD_ENABLED=yes

- name: Extensions | repmgr | Set 'daemonize=false' option in /etc/default/repmgrd
lineinfile:
path: /etc/default/repmgrd
regexp: ^[#]?REPMGRD_OPTS=
line: REPMGRD_OPTS="--daemonize=false"

# --- Configure primary node ---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,28 @@
module_defaults:
yum: { lock_timeout: "{{ yum_lock_timeout }}" }

- name: repmgr for PG {{ pg_version }} | Update postgres user in sudoers file
lineinfile:
path: /etc/sudoers
regexp: "^postgres ALL=\\(ALL:ALL\\) NOPASSWD:"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

line: >-
postgres ALL=(ALL:ALL) NOPASSWD:
/bin/systemctl start {{ upgrade_defaults.pg.service_name[ansible_os_family] }},
/bin/systemctl stop {{ upgrade_defaults.pg.service_name[ansible_os_family] }},
/bin/systemctl restart {{ upgrade_defaults.pg.service_name[ansible_os_family] }},
/bin/systemctl reload {{ upgrade_defaults.pg.service_name[ansible_os_family] }},
/bin/systemctl start {{ upgrade_defaults.repmgr.service_name[ansible_os_family] }},
/bin/systemctl stop {{ upgrade_defaults.repmgr.service_name[ansible_os_family] }}
validate: 'visudo -cf %s'

# Step: Update /etc/default/repmgrd
- name: repmgr for PG {{ pg_version }} | Set 'daemonize=false' option in /etc/default/repmgrd
lineinfile:
path: /etc/default/repmgrd
regexp: ^[#]?REPMGRD_OPTS=
line: REPMGRD_OPTS="--daemonize=false"
when: ansible_os_family == 'Debian'

# Step: systemctl daemon-reload
# Step: Restart PostgreSQL
- name: repmgr for PG {{ pg_version }} | Restart PostgreSQL service
Expand Down
Loading