Browse Source

database setup

covid-videoplattform
parent
commit
fabfc43fcf
5 changed files with 49 additions and 0 deletions
  1. +4
    -0
      defaults/main.yaml
  2. +16
    -0
      tasks/database.yaml
  3. +16
    -0
      tasks/local_facts.yaml
  4. +7
    -0
      tasks/main.yaml
  5. +6
    -0
      vars/main.yaml

+ 4
- 0
defaults/main.yaml View File

@@ -1 +1,5 @@
--- ---

buildbot_db_name: buildbot
buildbot_db_user: buildbot
buildbot_db_pass: "{{ ansible_local.buildbot.database_password }}"

+ 16
- 0
tasks/database.yaml View File

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

- block:

- name: postgresql user
postgresql_user:
name: "{{buildbot_db_user}}"
password: "{{buildbot_db_pass}}"

- name: postgresql database
postgresql_db:
name: "{{buildbot_db_name}}"
owner: "{{buildbot_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/{{_local_facts_name}}.fact
register: _local_facts_set

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

+ 7
- 0
tasks/main.yaml View File

@@ -1,11 +1,16 @@
--- ---



- import_tasks: local_facts.yaml

- name: debian package requirements for buildbot - name: debian package requirements for buildbot
apt: apt:
pkg: pkg:
- python3-pip - python3-pip
- fish - fish
- git - git
- python-psycopg2
- postgresql


- name: install buildbot - name: install buildbot
pip: pip:
@@ -43,3 +48,5 @@
copy: copy:
src: systemd/buildbot@.service src: systemd/buildbot@.service
dest: /etc/systemd/system/buildbot@.service dest: /etc/systemd/system/buildbot@.service

- import_tasks: database.yaml

+ 6
- 0
vars/main.yaml View File

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

_local_facts_name: buildbot
_local_facts:
database_password: "{% if not ansible_local.buildbot.database_password is defined %}{{ lookup('password', '/dev/null length=16 chars=ascii_letters') }}{% else %}{{ ansible_local.buildbot.database_password }}{% endif %}"

buildbot_database_url: "postgresql://{{buildbot_db_user}}:{{buildbot_db_pass}}@localhost:5432/{{buildbot_db_name}}"

Loading…
Cancel
Save