Advertisement
Guest User

Untitled

a guest
Aug 30th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. - name: Add personal .my.cnf to root
  2. template: src=my.cnf-personal.j2 dest=/root/.my.cnf owner=root group=root mode=0600
  3. become: yes
  4.  
  5. - name: Update database root password
  6. mysql_user:
  7. name: 'root'
  8. password: '{{ mysql_root_password }}'
  9. become: yes
  10.  
  11. - name: Reload privilege tables
  12. command: 'mysql -ne "{{ item }}"'
  13. with_items:
  14. - FLUSH PRIVILEGES
  15. changed_when: False
  16. become: yes
  17.  
  18. - name: Delete anonymous database user
  19. mysql_user:
  20. user: ""
  21. state: 'absent'
  22. become: yes
  23.  
  24. - name: Disallow root login remotely
  25. command: 'mysql -ne "{{ item }}"'
  26. with_items:
  27. - DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')
  28. changed_when: False
  29. become: yes
  30.  
  31. - name: Remove test database and access to it
  32. mysql_db:
  33. db: 'test'
  34. state: absent
  35. become: yes
  36.  
  37. - name: Reload privilege tables
  38. command: 'mysql -ne "{{ item }}"'
  39. with_items:
  40. - FLUSH PRIVILEGES
  41. changed_when: False
  42. become: yes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement