Browse Source

Install postgresql 9.4, 9.3 or 9.1 if available

(on Debian Jessie, Ubuntu Trusty or older distributions such as
Debian Wheezy and Ubuntu Precise).
Sven Neuhaus 10 years ago
parent
commit
c898aa98d6
2 changed files with 21 additions and 24 deletions
  1. 9
    9
      roles/mailserver/tasks/dovecot.yml
  2. 12
    15
      roles/mailserver/tasks/postfix.yml

+ 9
- 9
roles/mailserver/tasks/dovecot.yml View File

24
     - dovecot-pop3d
24
     - dovecot-pop3d
25
   when: ansible_distribution_release != 'wheezy'
25
   when: ansible_distribution_release != 'wheezy'
26
 
26
 
27
-- name: Install Dovecot Postgres dependency for distributions other than Ubuntu Trusty
28
-  apt: pkg={{ item }} state=installed
29
-  with_items:
30
-    - postgresql-9.1
31
-  when: ansible_distribution_release != 'trusty'
27
+- name: Install Postgres 9.1 for Dovecot on older distributions
28
+  apt: pkg=postgresql-9.1 state=present
29
+  when: ansible_distribution_release != 'trusty' and ansible_distribution_release != 'jessie'
32
 
30
 
33
-- name: Install Dovecot Postgres dependency for Ubuntu trusty
34
-  apt: pkg={{ item }} state=installed
35
-  with_items:
36
-    - postgresql-9.3
31
+- name: Install Postgres 9.3 for Dovecot on Ubuntu Trusty
32
+  apt: pkg=postgresql-9.3 state=present
37
   when: ansible_distribution_release == 'trusty'
33
   when: ansible_distribution_release == 'trusty'
38
 
34
 
35
+- name: Install Postgres 9.4 for Dovecot on Debian Jessie
36
+  apt: pkg=postgresql-9.4 state=present
37
+  when: ansible_distribution_release == 'jessie'
38
+
39
 - name: Create vmail group
39
 - name: Create vmail group
40
   group: name=vmail state=present gid=5000
40
   group: name=vmail state=present gid=5000
41
 
41
 

+ 12
- 15
roles/mailserver/tasks/postfix.yml View File

1
-- name: Install Postfix 9.1 and related packages for distributions other than Ubuntu Trusty
2
-  apt: pkg={{ item }} state=installed
3
-  with_items:
4
-    - libsasl2-modules
5
-    - postfix
6
-    - postfix-pcre
7
-    - postfix-pgsql
8
-    - postgresql-9.1
9
-    - postgrey
10
-    - python-psycopg2
11
-    - sasl2-bin
12
-  when: ansible_distribution_release != 'trusty'
1
+- name: Install Postgres 9.1 on older distributions
2
+  apt: pkg=postgresql-9.1 state=present
3
+  when: ansible_distribution_release != 'trusty' and ansible_distribution_release != 'jessie'
4
+
5
+- name: Install Postgres 9.3 on Ubuntu Trusty
6
+  apt: pkg=postgresql-9.3 state=present
7
+  when: ansible_distribution_release == 'trusty'
8
+
9
+- name: Install Postgres 9.4 on Debian Jessie
10
+  apt: pkg=postgresql-9.4 state=present
11
+  when: ansible_distribution_release == 'jessie'
13
 
12
 
14
-- name: Install Postfix 9.3 and related packages for Ubuntu Trusty
13
+- name: Install Postfix and related packages
15
   apt: pkg={{ item }} state=installed
14
   apt: pkg={{ item }} state=installed
16
   with_items:
15
   with_items:
17
     - libsasl2-modules
16
     - libsasl2-modules
18
     - postfix
17
     - postfix
19
     - postfix-pcre
18
     - postfix-pcre
20
     - postfix-pgsql
19
     - postfix-pgsql
21
-    - postgresql-9.3
22
     - postgrey
20
     - postgrey
23
     - python-psycopg2
21
     - python-psycopg2
24
     - sasl2-bin
22
     - sasl2-bin
25
-  when: ansible_distribution_release == 'trusty'
26
 
23
 
27
 - name: Set postgres password
24
 - name: Set postgres password
28
   command: sudo -u {{ db_admin_username }} psql -d {{ db_admin_username }} -c "ALTER USER postgres with  password '{{ db_admin_password }}';"
25
   command: sudo -u {{ db_admin_username }} psql -d {{ db_admin_username }} -c "ALTER USER postgres with  password '{{ db_admin_password }}';"

Loading…
Cancel
Save