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 regels
1.5 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: Set a new root password
  6. mysql_user:
  7. check_implicit_admin: yes
  8. user: root
  9. password: "{{ ispmail_mysql_root_password }}"
  10. login_unix_socket: /var/run/mysqld/mysqld.sock
  11. host: "{{ item }}"
  12. with_items:
  13. - localhost
  14. - 127.0.0.1
  15. - name: Create .my.cnf
  16. template:
  17. src: "root-my-cnf.j2"
  18. dest: "/root/.my.cnf"
  19. owner: root
  20. group: root
  21. mode: 0600
  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_mailuser_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