55 lines
2.5 KiB
YAML
55 lines
2.5 KiB
YAML
---
|
|
- block:
|
|
- name: Ensure service directory exists
|
|
file:
|
|
path: "{{ droneci_service_directory }}"
|
|
state: directory
|
|
mode: 0755
|
|
|
|
- name: Install required dependencies
|
|
pip:
|
|
name: "{{ item }}"
|
|
state: present
|
|
with_items:
|
|
- docker
|
|
- docker-compose
|
|
become: True
|
|
become_user: root
|
|
|
|
- block:
|
|
- name: Setup postgres db '{{ gitea_postgres_db.name }}'
|
|
postgresql_db:
|
|
name: "{{ gitea_postgres_db.name }}"
|
|
lc_collate: "{{ gitea_postgres_db.lc_collate | default('en_US.UTF-8') }}"
|
|
lc_ctype: "{{ gitea_postgres_db.lc_ctype | default('en_US.UTF-8') }}"
|
|
encoding: "{{ gitea_postgres_db.encoding | default('UTF-8') }}"
|
|
template: "{{ gitea_postgres_db.template | default('template0') }}"
|
|
login_host: "{{ gitea_postgres_db.login_host | default('localhost') }}"
|
|
login_password: "{{ gitea_postgres_db.login_password | default(omit) }}"
|
|
login_user: "{{ gitea_postgres_db.login_user | default(postgresql_user) }}"
|
|
login_unix_socket: "{{ gitea_postgres_db.login_unix_socket | default(omit) }}"
|
|
port: "{{ gitea_postgres_db.port | default(omit) }}"
|
|
owner: "{{ gitea_postgres_db.owner | default(omit) }}"
|
|
state: "{{ gitea_postgres_db.state | default('present') }}"
|
|
no_log: True
|
|
when: gitea_postgres_db is defined
|
|
|
|
- name: Setup postgres user '{{ gitea_postgres_user.name }}'
|
|
postgresql_user:
|
|
name: "{{ gitea_postgres_user.name }}"
|
|
password: "{{ 'md5' + (gitea_postgres_user.password + gitea_postgres_user.name) | hash('md5') }}"
|
|
encrypted: "{{ gitea_postgres_user.encrypted | default('yes') }}"
|
|
priv: "{{ gitea_postgres_user.priv | default(omit) }}"
|
|
role_attr_flags: "{{ gitea_postgres_user.role_attr_flags | default(omit) }}"
|
|
db: "{{ gitea_postgres_user.db | default(omit) }}"
|
|
login_host: "{{ gitea_postgres_user.login_host | default('localhost') }}"
|
|
login_password: "{{ gitea_postgres_user.login_password | default(omit) }}"
|
|
login_user: "{{ gitea_postgres_user.login_user | default(omit) }}"
|
|
login_unix_socket: "{{ gitea_postgres_user.login_unix_socket | default(omit) }}"
|
|
port: "{{ gitea_postgres_user.port | default(omit) }}"
|
|
state: "{{ gitea_postgres_user.state | default('present') }}"
|
|
no_log: True
|
|
when: gitea_postgres_user is defined
|
|
delegate_to: "{{ gitea_postgres_server }}"
|
|
when: droneci_postgres_enabled
|