123456789101112131415161718192021 |
- - name: Install mysql-server related packages
- apt: pkg={{ item }} state=installed update_cache=yes
- with_items:
- - mysql-server
- - automysqlbackup
- when: with_mysql
- - name: Fix automysqlbackup to handle events properly
- lineinfile:
- dest: /usr/sbin/automysqlbackup
- regexp: "^OPT="
- line: 'OPT="--quote-names --events" # OPT string for use with mysqldump ( see man mysqldump )'
- when: with_mysql
- - name: Change mysql root default password
- raw: if ! echo "SELECT VERSION();" | mysql -u root --password='{{ mysql_root_password }}' >/dev/null 2>&1 ; then echo "UPDATE mysql.user SET Password=PASSWORD('{{ mysql_root_password }}') WHERE User IN ('', 'root'); FLUSH PRIVILEGES;" | mysql --defaults-file=/etc/mysql/debian.cnf ; fi
- when: with_mysql
- - name: Ensure mysql-server is running
- service: name=mysql state=started
- when: with_mysql
|