mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
53 lines
1.9 KiB
YAML
53 lines
1.9 KiB
YAML
---
|
|
# Retrieve the current hostname, because {{ ansible_hostname }} still contains the old name
|
|
- shell: hostname
|
|
register: current_hostname
|
|
|
|
- name: Add MariaDB-Repository
|
|
sudo: yes
|
|
apt_repository: repo='deb http://mirror6.layerjet.com/mariadb/repo/10.1/ubuntu {{ ansible_distribution_release }} main' state=present
|
|
register: mariadb_repository
|
|
|
|
- name: Add Key for MariaDB Repository
|
|
sudo: yes
|
|
apt_key: url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xcbcb082a1bb943db
|
|
|
|
- name: Update apt
|
|
sudo: yes
|
|
apt: update_cache=yes
|
|
when: mariadb_repository.changed
|
|
|
|
- name: mariadb | Install MariaDB Packages
|
|
sudo: yes
|
|
apt: pkg={{ item }} state=latest
|
|
with_items:
|
|
- mariadb-server
|
|
- python-mysqldb
|
|
|
|
- name: mariadb | Update root password for all root accounts
|
|
mysql_user: name=root host={{ item }} check_implicit_admin=yes password={{ mariadb.root_password }} login_user=root login_password={{ mariadb.root_password }}
|
|
with_items:
|
|
- "{{ current_hostname.stdout | lower }}"
|
|
- 127.0.0.1
|
|
- ::1
|
|
- localhost
|
|
|
|
- name: mariadb | Ensure anonymous users are not in the database
|
|
mysql_user: name='' host={{ item }} state=absent login_user=root login_password={{ mariadb.root_password }}
|
|
with_items:
|
|
- localhost
|
|
- "{{ current_hostname.stdout | lower }}"
|
|
|
|
- name: mariadb | Create databases
|
|
mysql_db: name={{ item }} state=present login_user=root login_password={{ mariadb.root_password }}
|
|
with_items:
|
|
- "{{ mariadb.database }}"
|
|
- "{{ mariadb.databox_db }}"
|
|
|
|
- name: mariadb | Import dump
|
|
mysql_db: name={{ mariadb.database }} state=import login_user=root login_password={{ mariadb.root_password }} target=/vagrant/{{ mariadb.dump }}
|
|
when: mariadb.dump
|
|
|
|
- name: mariadb | Create users
|
|
mysql_user: name={{ mariadb.user }} password={{ mariadb.password }} priv=*.*:ALL state=present login_user=root login_password={{ mariadb.root_password }}
|