homelab/roles/mariadb/tasks/main.yml

26 lines
599 B
YAML
Raw Permalink Normal View History

2022-08-12 01:04:07 +00:00
- name: Install MariaDB
2023-05-04 03:42:55 +00:00
ansible.builtin.apt:
2022-08-12 01:04:07 +00:00
name: mariadb-server
state: present
- name: Change the bind-address to allow Docker
2023-05-04 03:42:55 +00:00
ansible.builtin.lineinfile:
2022-08-12 01:04:07 +00:00
path: /etc/mysql/mariadb.conf.d/50-server.cnf
regex: "^bind-address"
line: "bind-address = 0.0.0.0"
register: mariadb_conf
- name: Restart MariaDB
2023-05-04 03:42:55 +00:00
ansible.builtin.service:
2022-08-12 01:04:07 +00:00
name: mariadb
state: restarted
when: mariadb_conf.changed
- name: Allow database connections
2023-05-04 03:42:55 +00:00
community.general.ufw:
2022-08-12 01:04:07 +00:00
rule: allow
port: "3306"
proto: tcp
src: "{{ item }}"
loop: "{{ mariadb_trust }}"