ansible-mysql/tasks/install/default_mysql.yml

19 lines
784 B
YAML

---
- name: SHELL | Get MySQL target version
shell: LANG=C apt-cache depends mysql-server | awk -F '-' '/Depends/ { print $NF }'
register: apt_mysql_version
changed_when: false
- name: DEBCONF | Prepare MySQL silent installation (root password)
debconf: name='mysql-server-{{ apt_mysql_version.stdout }}' question='mysql-server/root_password' vtype='password' value='{{ mysql_root_password }}'
when: not mysql_exists.stat.exists
- name: DEBCONF | Prepare MySQL silent installation (root password again)
debconf: name='mysql-server-{{ apt_mysql_version.stdout }}' question='mysql-server/root_password_again' vtype='password' value='{{ mysql_root_password }}'
when: not mysql_exists.stat.exists
- name: APT | Install MySQL server
apt: pkg=mysql-server state=latest