Kaynağa Gözat

dbconfig by ansible

master
ebeveyn
işleme
0dbdc53de1
3 değiştirilmiş dosya ile 52 ekleme ve 6 silme
  1. +3
    -0
      defaults/main.yml
  2. +31
    -6
      tasks/main.yml
  3. +18
    -0
      templates/dbconfig.inc.php.j2

+ 3
- 0
defaults/main.yml Dosyayı Görüntüle

@@ -0,0 +1,3 @@
postfixadmin_mysql_database: postfixadmin
postfixadmin_mysql_username: postfixadmin
postfixadmin_mysql_password: eehahhoaQuai3oomochep7ca

+ 31
- 6
tasks/main.yml Dosyayı Görüntüle

@@ -1,15 +1,40 @@
---

- name: mysql database
mysql_db:
name: "{{postfixadmin_mysql_database}}"
state: present

- name: mysql user
mysql_user:
name: "{{postfixadmin_mysql_username}}"
password: "{{postfixadmin_mysql_password}}"
priv: "{{postfixadmin_mysql_database}}.*:ALL,GRANT"
state: present

- name: disable dbconfig
debconf:
name: postfixadmin
question: postfixadmin/dbconfig-{{item}}
answer: false
vtype: boolean
with_items:
- install
- reinstall
- remove
- upgrade

- name: install packages
apt:
pkg: postfixadmin
pkg: "{{item}}"
with_items:
- postfixadmin
- ca-certificates

# fix https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857791
- name: change dbtype to mysqli (debian bug \#857791)
lineinfile:
- name: dbconfig
template:
src: dbconfig.inc.php.j2
dest: /etc/postfixadmin/dbconfig.inc.php
regexp: ^\$dbtype\=
line: $dbtype='mysqli';

- name: ensure template_c folder is writable by webserver
file:


+ 18
- 0
templates/dbconfig.inc.php.j2 Dosyayı Görüntüle

@@ -0,0 +1,18 @@
<?php
##
## database access settings in php format
## automatically generated from /etc/dbconfig-common/postfixadmin.conf
## by /usr/sbin/dbconfig-generate-include
##
## by default this file is managed via ucf, so you shouldn't have to
## worry about manual changes being silently discarded. *however*,
## you'll probably also want to edit the configuration file mentioned
## above too.
##
$dbuser='{{postfixadmin_mysql_username}}';
$dbpass='{{postfixadmin_mysql_password}}';
$basepath='';
$dbname='{{postfixadmin_mysql_database}}';
$dbserver='localhost';
$dbport='3306';
$dbtype='mysqli';

Yükleniyor…
İptal
Kaydet