Преглед изворни кода

setup posgres within the common role

Postgres is used by several roles, but the setup is currently part of the 'mailserver' role. By moving it to 'common', it's possible to disable the mailserver without breaking the others.
Wolfgang Steitz пре 7 година
родитељ
комит
3a42d15850
3 измењених фајлова са 16 додато и 11 уклоњено
  1. 1
    0
      roles/common/tasks/main.yml
  2. 15
    0
      roles/common/tasks/postgres.yml
  3. 0
    11
      roles/mailserver/tasks/postfix.yml

+ 1
- 0
roles/common/tasks/main.yml Прегледај датотеку

@@ -68,3 +68,4 @@
68 68
 - include: security.yml tags=security
69 69
 - include: ntp.yml tags=ntp
70 70
 - include: google_auth.yml tags=google_auth
71
+- include: postgres.yml

+ 15
- 0
roles/common/tasks/postgres.yml Прегледај датотеку

@@ -0,0 +1,15 @@
1
+---
2
+# Defines tasks applicable for postgreSQL
3
+
4
+- name: Install Postgres
5
+  apt: pkg={{ item }} state=installed
6
+  with_items:
7
+    - postgresql
8
+    - python-psycopg2
9
+  tags:
10
+    - dependencies
11
+
12
+- name: Set password for PostgreSQL admin user
13
+  become: true
14
+  become_user: postgres
15
+  postgresql_user: name={{ db_admin_username }} password={{ db_admin_password }} encrypted=yes

+ 0
- 11
roles/mailserver/tasks/postfix.yml Прегледај датотеку

@@ -1,8 +1,3 @@
1
-- name: Install Postgres
2
-  apt: pkg=postgresql state=present
3
-  tags:
4
-    - dependencies
5
-
6 1
 - name: Install Postfix and related packages
7 2
   apt: pkg={{ item }} state=installed
8 3
   with_items:
@@ -16,12 +11,6 @@
16 11
   tags:
17 12
     - dependencies
18 13
 
19
-- name: Set password for PostgreSQL admin user
20
-  become: true
21
-  become_user: postgres
22
-  postgresql_user: name={{ db_admin_username }} password={{ db_admin_password }} encrypted=yes
23
-  notify: import sql postfix
24
-
25 14
 - name: Create database user for mail server
26 15
   postgresql_user: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ mail_db_username }} password="{{ mail_db_password }}" encrypted=yes state=present
27 16
   notify: import sql postfix

Loading…
Откажи
Сачувај