File tree Expand file tree Collapse file tree 6 files changed +117
-0
lines changed Expand file tree Collapse file tree 6 files changed +117
-0
lines changed Original file line number Diff line number Diff line change
1
+ Ansible: Opencast PostgreSQL Role
2
+ =================================
3
+
4
+ This Ansible role installs and prepares a PostgreSQL database server for Opencast.
5
+
6
+
7
+ Role Variables
8
+ --------------
9
+
10
+ - ` opencast_postgresql_version `
11
+ - PostgreSQL major version to install (default: `12`)
12
+ - Enables CentOS AppStream
13
+ - ` opencast_postgresql_user: `
14
+ - Database user to create (default: `opencast`)
15
+ - ` opencast_postgresql_password `
16
+ - Databse password for user (_required_)
17
+ - ` opencast_postgresql_database `
18
+ - Database name (default: `opencast`)
19
+ - ` opencast_postgresql_connection_hosts `
20
+ - List of hosts allowed to connect to database (default: `[127.0.0.1/32, ::1/128]`)
21
+
22
+
23
+ Example Playbook
24
+ ----------------
25
+
26
+ Example of how to configure and use the role:
27
+
28
+ ``` yaml
29
+ - hosts : servers
30
+ become : true
31
+ roles :
32
+ - role : lkiesow.opencast_postgresql
33
+ opencast_postgresql_password : secret
34
+ ` ` `
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ opencast_postgresql_version : 12
4
+ opencast_postgresql_user : opencast
5
+ opencast_postgresql_database : opencast
6
+ opencast_postgresql_connection_hosts :
7
+ - 127.0.0.1/32
8
+ - ::1/128
Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : restart postgresql
3
+ service :
4
+ name : postgresql
5
+ state : restarted
Original file line number Diff line number Diff line change
1
+ galaxy_info :
2
+ author : Lars Kiesow
3
+ role_name : opencast_user
4
+ namespace : lkiesow
5
+ description : Install and prepare PostgreSQL for Opencast
6
+ license : BSD-3-Clause
7
+ min_ansible_version : 2.9
8
+ galaxy_tags :
9
+ - opencast
10
+ platforms :
11
+ - name : EL
12
+ versions :
13
+ - 8
14
+ dependencies : []
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : install postgresql
4
+ dnf :
5
+ name :
6
+ - ' @postgresql:{{ opencast_postgresql_version }}/server'
7
+ - ' @postgresql:{{ opencast_postgresql_version }}/client'
8
+ - python3-psycopg2
9
+ state : present
10
+
11
+ - name : initialize database
12
+ command :
13
+ cmd : postgresql-setup --initdb
14
+ creates : /var/lib/pgsql/data/postgresql.conf
15
+
16
+ - name : set auth to scram-sha-256
17
+ lineinfile :
18
+ path : /var/lib/pgsql/data/postgresql.conf
19
+ regexp : ' ^password_encryption'
20
+ line : " password_encryption = 'scram-sha-256'"
21
+ notify : restart postgresql
22
+
23
+ - name : configure postgres access
24
+ template :
25
+ src : pg_hba.conf
26
+ dest : /var/lib/pgsql/data/pg_hba.conf
27
+ owner : postgres
28
+ group : postgres
29
+ mode : ' 0644'
30
+ notify : restart postgresql
31
+
32
+ - name : start and enable postgresql
33
+ service :
34
+ name : postgresql
35
+ state : started
36
+ enabled : true
37
+
38
+ - name : create postgresql user
39
+ become_user : postgres
40
+ community.postgresql.postgresql_user :
41
+ name : ' {{ opencast_postgresql_user }}'
42
+ password : ' {{ opencast_postgresql_password }}'
43
+
44
+ - name : create database
45
+ become : true
46
+ become_user : postgres
47
+ community.postgresql.postgresql_db :
48
+ name : ' {{ opencast_postgresql_database }}'
49
+ owner : ' {{ opencast_postgresql_user }}'
Original file line number Diff line number Diff line change
1
+ # "local" is for Unix domain socket connections only
2
+ local all all peer
3
+
4
+ # allow TCP connections with possword from some hosts:
5
+ {% for host in opencast_postgresql_connection_hosts %}
6
+ host all all {{ host }} scram-sha-256
7
+ {% endfor %}
You can’t perform that action at this time.
0 commit comments