Procházet zdrojové kódy

database setup

covid-videoplattform
rodič
revize
fabfc43fcf
5 změnil soubory, kde provedl 49 přidání a 0 odebrání
  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 Zobrazit soubor

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

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

+ 16
- 0
tasks/database.yaml Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

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


- import_tasks: local_facts.yaml

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

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

- import_tasks: database.yaml

+ 6
- 0
vars/main.yaml Zobrazit soubor

@@ -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}}"

Načítá se…
Zrušit
Uložit