xoxys.freshrss_docker/tasks/prepare.yml

45 lines
2.4 KiB
YAML
Raw Normal View History

2019-10-02 13:48:03 +00:00
---
- name: Ensure service directory exists
file:
path: "{{ freshrss_service_directory }}"
state: directory
mode: 0755
become: True
become_user: root
- block:
- name: Setup postgres db '{{ freshrss_postgres_db.name }}'
postgresql_db:
name: "{{ freshrss_postgres_db.name }}"
lc_collate: "{{ freshrss_postgres_db.lc_collate | default('en_US.UTF-8') }}"
lc_ctype: "{{ freshrss_postgres_db.lc_ctype | default('en_US.UTF-8') }}"
encoding: "{{ freshrss_postgres_db.encoding | default('UTF-8') }}"
template: "{{ freshrss_postgres_db.template | default('template0') }}"
login_host: "{{ freshrss_postgres_db.login_host | default('localhost') }}"
login_password: "{{ freshrss_postgres_db.login_password | default(omit) }}"
login_user: "{{ freshrss_postgres_db.login_user | default(omit) }}"
login_unix_socket: "{{ freshrss_postgres_db.login_unix_socket | default(omit) }}"
port: "{{ freshrss_postgres_db.port | default(omit) }}"
owner: "{{ freshrss_postgres_db.owner | default(omit) }}"
state: "{{ freshrss_postgres_db.state | default('present') }}"
no_log: "{{ False if freshrss_ansible_debug | default(False) else True }}"
when: freshrss_postgres_db is defined
- name: Setup postgres user '{{ freshrss_postgres_user.name }}'
postgresql_user:
name: "{{ freshrss_postgres_user.name }}"
password: "{{ 'md5' + (freshrss_postgres_user.password + freshrss_postgres_user.name) | hash('md5') }}"
encrypted: "{{ freshrss_postgres_user.encrypted | default('yes') }}"
priv: "{{ freshrss_postgres_user.priv | default(omit) }}"
role_attr_flags: "{{ freshrss_postgres_user.role_attr_flags | default(omit) }}"
db: "{{ freshrss_postgres_user.db | default(omit) }}"
login_host: "{{ freshrss_postgres_user.login_host | default('localhost') }}"
login_password: "{{ freshrss_postgres_user.login_password | default(omit) }}"
login_user: "{{ freshrss_postgres_user.login_user | default(omit) }}"
login_unix_socket: "{{ freshrss_postgres_user.login_unix_socket | default(omit) }}"
port: "{{ freshrss_postgres_user.port | default(omit) }}"
state: "{{ freshrss_postgres_user.state | default('present') }}"
no_log: "{{ False if freshrss_ansible_debug | default(False) else True }}"
when: freshrss_postgres_user is defined
delegate_to: "{{ freshrss_postgres_server }}"