ansible-role-sso/tasks/hydra-database.yml

31 lines
748 B
YAML

---
- name: Install local database required packages
ansible.builtin.apt:
name:
- mariadb-server
- python3-pip
update_cache: yes
state: latest
become: true
- name: Install PyMySQL python package
ansible.builtin.pip:
name: PyMySQL
become: true
- name: Create Hydra database
community.mysql.mysql_db:
name: "{{ hydra_database_name }}"
login_unix_socket: /var/run/mysqld/mysqld.sock
state: present
become: true
- name: Create Hydra database user
community.mysql.mysql_user:
name: "{{ hydra_database_user }}"
password: "{{ hydra_database_password }}"
login_unix_socket: /var/run/mysqld/mysqld.sock
priv: '{{ hydra_database_name }}.*:ALL,GRANT'
state: present
become: true