Skip to content

Commit 375ed87

Browse files
authored
Merge pull request #19 from ic4f/master
Move hardcoded value 'postgres' into variable 'postgresql_user_name'
2 parents a9446bc + 5734e32 commit 375ed87

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ Role Variables
3333

3434
### All variables are optional ###
3535

36+
- `postgresql_user_name`: System username to be used for PostgreSQL (default:
37+
`postgres`).
38+
3639
- `postgresql_version`: PostgreSQL version to install. On Debian-based
3740
platforms, the default is whatever version is pointed to by the `postgresql`
3841
metapackage). On RedHat-based platforms, the default is `9.4`.

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ postgresql_backup_local_dir: ~postgres/backup
55
postgresql_backup_active_dir: "{{ postgresql_backup_local_dir }}/active"
66
postgresql_backup_mail_recipient: postgres
77
postgresql_backup_rotate: true
8+
postgresql_user_name: postgres
89

910
postgresql_archive_wal_rsync_args: '--ignore-existing -ptg --info=skip1'

tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
when: ansible_os_family == "RedHat"
2727

2828
- name: Create conf.d
29-
file: path={{ postgresql_conf_dir }}/conf.d state=directory owner=postgres group=postgres
29+
file: path={{ postgresql_conf_dir }}/conf.d state=directory owner={{ postgresql_user_name }} group={{ postgresql_user_name }}
3030

3131
- name: Set conf.d include in postgresql.conf
3232
lineinfile: line="include_dir 'conf.d'" dest={{ postgresql_conf_dir }}/postgresql.conf backup=yes
@@ -40,11 +40,11 @@
4040
when: "postgresql_version is version_compare('9.3', '<')"
4141

4242
- name: Set config options
43-
template: src=25ansible_postgresql.conf.j2 dest={{ postgresql_conf_dir }}/conf.d/25ansible_postgresql.conf owner=postgres group=postgres backup=yes
43+
template: src=25ansible_postgresql.conf.j2 dest={{ postgresql_conf_dir }}/conf.d/25ansible_postgresql.conf owner={{ postgresql_user_name }} group={{ postgresql_user_name }} backup=yes
4444
notify: Reload PostgreSQL
4545

4646
- name: Install pg_hba.conf
47-
template: src=pg_hba.conf.{{ ansible_os_family | lower }}.j2 dest={{ postgresql_conf_dir }}/pg_hba.conf owner=postgres group=postgres mode=0400 backup=yes
47+
template: src=pg_hba.conf.{{ ansible_os_family | lower }}.j2 dest={{ postgresql_conf_dir }}/pg_hba.conf owner={{ postgresql_user_name }} group={{ postgresql_user_name }} mode=0400 backup=yes
4848
notify: Reload PostgreSQL
4949

5050
- include: backup.yml

0 commit comments

Comments
 (0)