You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

63 line
1.6 KiB

  1. ---
  2. - name: Installing required Python mysqldb module for Ansible to manage databases
  3. # apt: name=python-mysqldb
  4. apt: name=python-pymysql
  5. - name: Create .my.cnf
  6. template:
  7. src: "root-my-cnf.j2"
  8. dest: "/root/.my.cnf"
  9. owner: root
  10. group: root
  11. mode: 0600
  12. - name: Set a new root password
  13. mysql_user:
  14. check_implicit_admin: yes
  15. user: root
  16. password: "{{ ispmail_mysql_root_password }}"
  17. login_unix_socket: /var/run/mysqld/mysqld.sock
  18. host: "{{ item }}"
  19. with_items:
  20. - localhost
  21. - 127.0.0.1
  22. - name: creating mailserver MySQL database
  23. #become: true
  24. mysql_db:
  25. name: mailserver
  26. # - name: creating Roundcube MySQL database
  27. # mysql_db:
  28. # name: roundcube
  29. - name: copying MySQL database schema to server
  30. copy:
  31. src: schema.sql
  32. dest: /tmp
  33. - name: setting up SQL schema of mailserver database
  34. mysql_db:
  35. name: mailserver
  36. state: import
  37. target: /tmp/schema.sql
  38. - name: creating MySQL user to read the mailserver database
  39. mysql_user:
  40. name: mailuser
  41. password: "{{ispmail_mysql_mailserver_password}}"
  42. priv: mailserver.*:SELECT,INSERT,UPDATE,DELETE
  43. # - name: creating MySQL user for roundcube
  44. # mysql_user:
  45. # name: roundcube
  46. # password: "{{ispmail_mysql_roundcube_password}}"
  47. # priv: roundcube.*:ALL
  48. - name: copying MySQL test data to server
  49. copy:
  50. src: test.sql
  51. dest: /tmp
  52. when: ispmail_populate_test_data == true
  53. - name: populating the database with test data
  54. mysql_db:
  55. name: mailserver
  56. state: import
  57. target: /tmp/test.sql
  58. when: ispmail_populate_test_data == true