Browse Source

rework users and also take care that the databases exists

master
Markus Bergholz 2 years ago
parent
commit
973712e781
1 changed files with 16 additions and 11 deletions
  1. +16
    -11
      ansible/mariadb_users.yml

+ 16
- 11
ansible/mariadb_users.yml View File

@ -2,26 +2,31 @@
- hosts: osuv
vars:
NC_TOKEN: "{{ lookup('env', 'NC_TOKEN') }}"
MARIADB_PASSWORD: "{{ lookup('nc_password', 'root_mariadb_password' , host='home.osuv.de', user='m', token=NC_TOKEN) }}"
list:
- nextcloud
- gitea
tasks:
- name: add or update gitea user
- name: "add or update user"
mysql_user:
login_host: 127.0.0.1
login_password: "{{ lookup('nc_password', 'root_mariadb_password' , host='home.osuv.de', user='m', token=NC_TOKEN) }}"
login_password: "{{ MARIADB_PASSWORD }}"
login_port: 3307
login_user: m
name: gitea
password: "{{ lookup('nc_password', 'gitea_mariadb_password' , host='home.osuv.de', user='m', token=NC_TOKEN) }}"
priv: "gitea.*:ALL"
name: "{{ item }}"
password: "{{ lookup('nc_password', item + '_mariadb_password' , host='home.osuv.de', user='m', token=NC_TOKEN) }}"
priv: "{{ item }}.*:ALL"
state: present
with_items: "{{ list }}"
- name: add or update nextcloud user
mysql_user:
- name: "databases must be present"
mysql_db:
login_host: 127.0.0.1
login_password: "{{ lookup('nc_password', 'root_mariadb_password' , host='home.osuv.de', user='m', token=NC_TOKEN) }}"
login_password: "{{ MARIADB_PASSWORD }}"
login_port: 3307
login_user: m
name: nextcloud
password: "{{ lookup('nc_password', 'nextcloud_mariadb_password' , host='home.osuv.de', user='m', token=NC_TOKEN) }}"
priv: "nextcloud.*:ALL"
name: "{{ item }}"
state: present
encoding: utf8mb4
with_items: "{{ list }}"

Loading…
Cancel
Save