Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - name: Add personal .my.cnf to root
- template: src=my.cnf-personal.j2 dest=/root/.my.cnf owner=root group=root mode=0600
- become: yes
- - name: Update database root password
- mysql_user:
- name: 'root'
- password: '{{ mysql_root_password }}'
- become: yes
- - name: Reload privilege tables
- command: 'mysql -ne "{{ item }}"'
- with_items:
- - FLUSH PRIVILEGES
- changed_when: False
- become: yes
- - name: Delete anonymous database user
- mysql_user:
- user: ""
- state: 'absent'
- become: yes
- - name: Disallow root login remotely
- command: 'mysql -ne "{{ item }}"'
- with_items:
- - DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')
- changed_when: False
- become: yes
- - name: Remove test database and access to it
- mysql_db:
- db: 'test'
- state: absent
- become: yes
- - name: Reload privilege tables
- command: 'mysql -ne "{{ item }}"'
- with_items:
- - FLUSH PRIVILEGES
- changed_when: False
- become: yes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement