homelab/roles/mariadb/tasks/main.yml

23 lines
651 B
YAML
Raw 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
2023-10-20 17:56:55 +00:00
- name: Regather facts for the potentially new docker0 interface
ansible.builtin.setup:
- name: Change the bind-address to allow from docker0
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"
2023-10-20 17:56:55 +00:00
line: "bind-address = {{ ansible_facts.docker0.ipv4.address }}"
notify: restart_mariadb
2022-08-12 01:04:07 +00:00
2023-10-20 17:56:55 +00:00
- name: Allow database connections from Docker
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 }}"
2023-10-20 17:56:55 +00:00
loop: "{{ mariadb_trust | default(['172.16.0.0/12']) }}"