chore: cleanup

master
Sven Ketelsen 4 years ago
parent 622fe5665a
commit f32234edce

@ -1,9 +1,9 @@
- name: Add Postgresql-Group - name: "Adding group postgresql"
group: group:
name: postgres name: postgres
gid: 2001 gid: 2001
- name: Add Postgresql-User - name: "Adding user postgresql"
user: user:
name: postgres name: postgres
uid: 2000 uid: 2000
@ -12,32 +12,32 @@
system: true system: true
shell: /bin/bash shell: /bin/bash
- name: Ensure Repository Meta is installed - name: "Ensuring repository meta is installed"
apt: apt:
name: ["debian-keyring", "debian-archive-keyring", "apt-transport-https"] name: ["debian-keyring", "debian-archive-keyring", "apt-transport-https"]
update_cache: yes update_cache: yes
cache_valid_time: 900 cache_valid_time: 900
state: present state: present
- name: Add an Apt signing key, uses whichever key is at the URL - name: "Adding an apt signing key, uses whichever key is at the url"
ansible.builtin.apt_key: ansible.builtin.apt_key:
url: https://www.postgresql.org/media/keys/ACCC4CF8.asc url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
state: present state: present
validate_certs: false validate_certs: false
- name: Add Postgresql repository into sources list - name: "Adding postgresql repository into sources list"
ansible.builtin.apt_repository: ansible.builtin.apt_repository:
repo: deb http://apt.postgresql.org/pub/repos/apt {{ default_postgres_target_distribution }} main repo: deb http://apt.postgresql.org/pub/repos/apt {{ default_postgres_target_distribution }} main
state: present state: present
- name: Ensure postgres is installed - name: "Ensuring postgres is installed"
apt: apt:
name: "postgresql-{{ default_postgres_version }}" name: "postgresql-{{ default_postgres_version }}"
update_cache: yes update_cache: yes
cache_valid_time: 900 cache_valid_time: 900
state: present state: present
- name: Setup listen interfaces for postgresql instance - name: "Setup listen interfaces for postgresql instance"
lineinfile: lineinfile:
state: present state: present
regex: "^listen_addresses" regex: "^listen_addresses"
@ -45,7 +45,7 @@
path: /etc/postgresql/{{ default_postgres_version }}/main/postgresql.conf path: /etc/postgresql/{{ default_postgres_version }}/main/postgresql.conf
register: listen_addresses register: listen_addresses
- name: Set 'max_connections = {{ default_max_connections }}' - name: "Setting 'max_connections={{ default_max_connections }}'"
lineinfile: lineinfile:
state: present state: present
regex: "^max_connections" regex: "^max_connections"
@ -53,7 +53,7 @@
path: /etc/postgresql/{{ default_postgres_version }}/main/postgresql.conf path: /etc/postgresql/{{ default_postgres_version }}/main/postgresql.conf
register: max_connections register: max_connections
- name: "Set 'shared_buffers = {{ default_shared_buffers }}'" - name: "Setting 'shared_buffers={{ default_shared_buffers }}'"
lineinfile: lineinfile:
state: present state: present
regex: "^shared_buffers" regex: "^shared_buffers"
@ -61,7 +61,7 @@
path: /etc/postgresql/{{ default_postgres_version }}/main/postgresql.conf path: /etc/postgresql/{{ default_postgres_version }}/main/postgresql.conf
register: shared_buffers register: shared_buffers
- name: Create archive directory if necessary - name: "Creating archive directory if necessary"
file: file:
state: directory state: directory
path: /postgresql/replication path: /postgresql/replication
@ -69,7 +69,7 @@
group: postgres group: postgres
mode: "g+s" mode: "g+s"
- name: Create backups directory if necessary - name: "Creating backups directory if necessary"
file: file:
state: directory state: directory
path: /backups path: /backups
@ -77,14 +77,14 @@
group: postgres group: postgres
mode: "g+s" mode: "g+s"
- name: "Install prometheus postgres exporter .." - name: "Installing prometheus postgres exporter"
apt: apt:
name: "prometheus-postgres-exporter" name: "prometheus-postgres-exporter"
update_cache: yes update_cache: yes
cache_valid_time: 900 cache_valid_time: 900
state: present state: present
- name: Restart postgres if necessary - name: "Restarting postgres if necessary"
service: service:
name: postgresql name: postgresql
state: restarted state: restarted

Loading…
Cancel
Save