Browse Source

postgresql

master
parent
commit
2121846b6c
7 changed files with 65 additions and 0 deletions
  1. +3
    -0
      defaults/main.yaml
  2. +6
    -0
      tasks/config.yaml
  3. +24
    -0
      tasks/database.yaml
  4. +16
    -0
      tasks/local_facts.yaml
  5. +4
    -0
      tasks/main.yaml
  6. +10
    -0
      templates/config.php.j2
  7. +2
    -0
      vars/main.yaml

+ 3
- 0
defaults/main.yaml View File

@@ -1,2 +1,5 @@
---
kanboard_server_name: "{{ inventory_hostname }}"
kanboard_db_name: kanboard
kanboard_db_user: kanboard
kanboard_db_pass: "{{ ansible_local[role_name].database_password }}"

+ 6
- 0
tasks/config.yaml View File

@@ -0,0 +1,6 @@
---

- name: kanboard configuration
template:
src: config.php.j2
dest: /var/www/kanboard/config.php

+ 24
- 0
tasks/database.yaml View File

@@ -0,0 +1,24 @@
---

- name: install postgresql debian packages
apt:
pkg:
- python-psycopg2
- python3-psycopg2
- postgresql
- autopostgresqlbackup

- block:

- name: postgresql user
postgresql_user:
name: "{{kanboard_db_user}}"
password: "{{kanboard_db_pass}}"

- name: postgresql database
postgresql_db:
name: "{{kanboard_db_name}}"
owner: "{{kanboard_db_user}}"

become: true
become_user: postgres

+ 16
- 0
tasks/local_facts.yaml View File

@@ -0,0 +1,16 @@
---

- name: ansible local facts directory
file:
path: /etc/ansible/facts.d
state: directory

- name: set ansible local fact
copy:
content: "{{_local_facts|to_json}}"
dest: /etc/ansible/facts.d/{{role_name}}.fact
register: _local_facts_set

- name: Gathering Facts
setup:
when: _local_facts_set.changed

+ 4
- 0
tasks/main.yaml View File

@@ -1,7 +1,11 @@
---

- import_tasks: local_facts.yaml
- import_tasks: database.yaml

- import_tasks: setup.yaml
- import_tasks: source.yaml
- import_tasks: config.yaml
- import_tasks: access.yaml
- import_tasks: certificate.yaml
- import_tasks: vhost.yaml

+ 10
- 0
templates/config.php.j2 View File

@@ -0,0 +1,10 @@
<?php

// We choose to use Postgresql instead of Sqlite
define('DB_DRIVER', 'postgres');

// Mysql parameters
define('DB_USERNAME', '{{kanboard_db_user}}');
define('DB_PASSWORD', '{{kanboard_db_pass}}');
define('DB_HOSTNAME', 'localhost');
define('DB_NAME', '{{kanboard_db_name}}');

+ 2
- 0
vars/main.yaml View File

@@ -1 +1,3 @@
---
_local_facts:
database_password: "{% if not ansible_local[role_name].database_password is defined %}{{ lookup('password', '/dev/null length=16 chars=ascii_letters') }}{% else %}{{ ansible_local[role_name].database_password }}{% endif %}"

Loading…
Cancel
Save