Finished postgres role
This commit is contained in:
parent
57353a8fb5
commit
6b518f39f6
|
@ -2,4 +2,4 @@
|
|||
*.retry
|
||||
hosts
|
||||
*_vars.yml
|
||||
|
||||
venv/
|
||||
|
|
|
@ -9,6 +9,7 @@ Technical dependencies on host machine (Python 3.5+):
|
|||
* python3
|
||||
* python3-pip
|
||||
* python3-apt
|
||||
* python3-selinux
|
||||
|
||||
Technical dependencies on managed machines:
|
||||
|
||||
|
@ -27,3 +28,4 @@ update the variable values.
|
|||
All playbooks expect a fresh Uberspace with SSH key set up via
|
||||
management dashboard.
|
||||
|
||||
* postgres setup: ``ansible-playbook -i hosts postgres.yml``
|
||||
|
|
|
@ -5,7 +5,5 @@
|
|||
- general_vars.yml
|
||||
- postgres_vars.yml
|
||||
remote_user: "{{ uberspace_user }}"
|
||||
become: yes
|
||||
become_user: root
|
||||
roles:
|
||||
- postgres
|
||||
|
|
|
@ -9,10 +9,21 @@
|
|||
src: https://download.postgresql.org/pub/source/v{{ postgres_version }}/postgresql-{{ postgres_version }}.tar.gz
|
||||
dest: ~/postgres
|
||||
remote_src: yes
|
||||
creates: ~/postgres/postgresql-{{ postgres_version }}
|
||||
register: postgres_archive
|
||||
- name: configure PostgreSQL
|
||||
command: cd ~/postgres/postgresql-{{ postgres_version }} && ./configure --prefix=$HOME/opt/postgresql/ --with-python PYTHON=/usr/bin/python3
|
||||
command: ./configure --prefix='$HOME/opt/postgresql/' --with-python PYTHON=/usr/bin/python3
|
||||
args:
|
||||
chdir: ~/postgres/postgresql-{{ postgres_version }}
|
||||
creates: '*config.status'
|
||||
- name: make PostgreSQL
|
||||
command: cd ~/postgres/postgresql-{{ postgres_version }} && make world
|
||||
command:
|
||||
chdir: ~/postgres/postgresql-{{ postgres_version }}
|
||||
cmd: make world
|
||||
creates: '*src/backend/access/brin/brin.o'
|
||||
- name: install PostgreSQL
|
||||
command: cd ~/postgres/postgresql-{{ postgres_version }} && make install-world
|
||||
command:
|
||||
chdir: ~/postgres/postgresql-{{ postgres_version }}
|
||||
cmd: make install-world
|
||||
creates: ~/opt/postgresql/
|
||||
|
||||
|
|
|
@ -4,18 +4,22 @@
|
|||
src: postgres_profile.j2
|
||||
dest: ~/.postgres_profile
|
||||
mode: 0644
|
||||
register: postgres_profile
|
||||
- name: include postgres profile in bash_profile
|
||||
lineinfile:
|
||||
path: ~/.bash_profile
|
||||
line: source ~/.postgres_profile
|
||||
insertafter: EOF
|
||||
when: postgres_profile.changed
|
||||
- name: copy environment var file to home dir
|
||||
template:
|
||||
src: postgres_env.j2
|
||||
dest: ~/.postgres_vars
|
||||
mode: 0644
|
||||
register: postgres_env
|
||||
- name: include postgres vars in bashrc
|
||||
lineinfile:
|
||||
path: ~/.bashrc
|
||||
line: source ~/.postgres_vars
|
||||
insertafter: EOF
|
||||
when: postgres_env.changed
|
||||
|
|
|
@ -4,16 +4,19 @@
|
|||
src: pgpass.j2
|
||||
dest: ~/.pgpass
|
||||
mode: 0600
|
||||
register: postgres_pgpass
|
||||
- name: create temporary password file
|
||||
template:
|
||||
src: pgpass_temp.j2
|
||||
dest: ~/.pgpass_temp
|
||||
dest: ~/.pgpass.temp
|
||||
mode: 0600
|
||||
- name: setup database cluster
|
||||
command: initdb --pwfile ~/pgpass.temp --auth=scram-sha-256 -E UTF8 -D ~/opt/postgresql/data/
|
||||
command:
|
||||
cmd: ~/opt/postgresql/bin/initdb --pwfile ~/.pgpass.temp --auth=scram-sha-256 -E UTF8 -D ~/opt/postgresql/data/
|
||||
creates: ~/opt/postgresql/data/
|
||||
- name: delete temporary password file
|
||||
file:
|
||||
path: ~/.pgpass_temp
|
||||
path: ~/.pgpass.temp
|
||||
state: absent
|
||||
- name: update port
|
||||
lineinfile:
|
||||
|
|
Loading…
Reference in New Issue