Finished postgres role
This commit is contained in:
parent
57353a8fb5
commit
6b518f39f6
|
@ -2,4 +2,4 @@
|
||||||
*.retry
|
*.retry
|
||||||
hosts
|
hosts
|
||||||
*_vars.yml
|
*_vars.yml
|
||||||
|
venv/
|
||||||
|
|
|
@ -9,6 +9,7 @@ Technical dependencies on host machine (Python 3.5+):
|
||||||
* python3
|
* python3
|
||||||
* python3-pip
|
* python3-pip
|
||||||
* python3-apt
|
* python3-apt
|
||||||
|
* python3-selinux
|
||||||
|
|
||||||
Technical dependencies on managed machines:
|
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
|
All playbooks expect a fresh Uberspace with SSH key set up via
|
||||||
management dashboard.
|
management dashboard.
|
||||||
|
|
||||||
|
* postgres setup: ``ansible-playbook -i hosts postgres.yml``
|
||||||
|
|
|
@ -5,7 +5,5 @@
|
||||||
- general_vars.yml
|
- general_vars.yml
|
||||||
- postgres_vars.yml
|
- postgres_vars.yml
|
||||||
remote_user: "{{ uberspace_user }}"
|
remote_user: "{{ uberspace_user }}"
|
||||||
become: yes
|
|
||||||
become_user: root
|
|
||||||
roles:
|
roles:
|
||||||
- postgres
|
- postgres
|
||||||
|
|
|
@ -9,10 +9,21 @@
|
||||||
src: https://download.postgresql.org/pub/source/v{{ postgres_version }}/postgresql-{{ postgres_version }}.tar.gz
|
src: https://download.postgresql.org/pub/source/v{{ postgres_version }}/postgresql-{{ postgres_version }}.tar.gz
|
||||||
dest: ~/postgres
|
dest: ~/postgres
|
||||||
remote_src: yes
|
remote_src: yes
|
||||||
|
creates: ~/postgres/postgresql-{{ postgres_version }}
|
||||||
|
register: postgres_archive
|
||||||
- name: configure PostgreSQL
|
- 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
|
- 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
|
- 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
|
src: postgres_profile.j2
|
||||||
dest: ~/.postgres_profile
|
dest: ~/.postgres_profile
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
register: postgres_profile
|
||||||
- name: include postgres profile in bash_profile
|
- name: include postgres profile in bash_profile
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: ~/.bash_profile
|
path: ~/.bash_profile
|
||||||
line: source ~/.postgres_profile
|
line: source ~/.postgres_profile
|
||||||
insertafter: EOF
|
insertafter: EOF
|
||||||
|
when: postgres_profile.changed
|
||||||
- name: copy environment var file to home dir
|
- name: copy environment var file to home dir
|
||||||
template:
|
template:
|
||||||
src: postgres_env.j2
|
src: postgres_env.j2
|
||||||
dest: ~/.postgres_vars
|
dest: ~/.postgres_vars
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
register: postgres_env
|
||||||
- name: include postgres vars in bashrc
|
- name: include postgres vars in bashrc
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: ~/.bashrc
|
path: ~/.bashrc
|
||||||
line: source ~/.postgres_vars
|
line: source ~/.postgres_vars
|
||||||
insertafter: EOF
|
insertafter: EOF
|
||||||
|
when: postgres_env.changed
|
||||||
|
|
|
@ -4,16 +4,19 @@
|
||||||
src: pgpass.j2
|
src: pgpass.j2
|
||||||
dest: ~/.pgpass
|
dest: ~/.pgpass
|
||||||
mode: 0600
|
mode: 0600
|
||||||
|
register: postgres_pgpass
|
||||||
- name: create temporary password file
|
- name: create temporary password file
|
||||||
template:
|
template:
|
||||||
src: pgpass_temp.j2
|
src: pgpass_temp.j2
|
||||||
dest: ~/.pgpass_temp
|
dest: ~/.pgpass.temp
|
||||||
mode: 0600
|
mode: 0600
|
||||||
- name: setup database cluster
|
- 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
|
- name: delete temporary password file
|
||||||
file:
|
file:
|
||||||
path: ~/.pgpass_temp
|
path: ~/.pgpass.temp
|
||||||
state: absent
|
state: absent
|
||||||
- name: update port
|
- name: update port
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
|
Loading…
Reference in New Issue