浏览代码

Add support of PostgreSQL

Emmanuel Bouthenot 10 年之前
父节点
当前提交
26991c18e8
共有 3 个文件被更改,包括 18 次插入0 次删除
  1. 3 0
      roles/dbserver/defaults/main.yml
  2. 1 0
      roles/dbserver/tasks/main.yml
  3. 14 0
      roles/dbserver/tasks/postgresql.yml

+ 3 - 0
roles/dbserver/defaults/main.yml

@@ -6,4 +6,7 @@ with_mysql: False
 with_mysql_backup: True
 mysql_root_password: Null
 
+with_postgresql: False
+with_postgresql_backup: True
+
 # vim: ft=yaml

+ 1 - 0
roles/dbserver/tasks/main.yml

@@ -1 +1,2 @@
 - include: mysql.yml
+- include: postgresql.yml

+ 14 - 0
roles/dbserver/tasks/postgresql.yml

@@ -0,0 +1,14 @@
+- name: Install PostgreSQL server related packages
+  apt: pkg={{ item }} state=installed update_cache=yes
+  with_items:
+    - postgresql
+    - postgresql-client
+  when: with_postgresql
+
+- name: Install PostgreSQL backup related packages (autopostgresqlbackup)
+  apt: pkg=autopostgresqlbackup state=installed update_cache=yes
+  when: with_postgresql and with_postgresql_backup
+
+- name: Ensure PostgreSQL server is running
+  service: name=postgresql state=started
+  when: with_postgresql