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.
 
 
 
 
 
 

49 rivejä
1.7 KiB

  1. ---
  2. - name: Installing required Python mysqldb module for Ansible to manage databases
  3. apt: name=python-pymysql
  4. - name: Set root user password
  5. become: true
  6. # If .my.cnf already exists, this will cause an mysql-root-password update.
  7. mysql_user:
  8. name: root
  9. password: "{{ ispmail_mysql_root_password}}"
  10. login_unix_socket: /var/run/mysqld/mysqld.sock
  11. check_implicit_admin: true
  12. - name: Create .my.cnf
  13. template:
  14. src: "root-my-cnf.j2"
  15. dest: "/root/.my.cnf"
  16. owner: root
  17. group: root
  18. mode: 0600
  19. - name: creating mailserver MySQL database
  20. #become: true
  21. mysql_db:
  22. name: mailserver
  23. - name: creating Roundcube MySQL database
  24. mysql_db: name=roundcube
  25. - name: copying MySQL database schema to server
  26. copy: src=schema.sql dest=/tmp
  27. - name: setting up SQL schema of mailserver database
  28. mysql_db: name=mailserver state=import target=/tmp/schema.sql
  29. # - name: set the MySQL root user's password
  30. # mysql_user: name=root password={{ispmail_mysql_root_password}}
  31. - name: creating MySQL user to read the mailserver database
  32. mysql_user: name=mailuser password={{ispmail_mysql_mailuser_password}} priv=mailserver.*:SELECT,INSERT,UPDATE,DELETE
  33. - name: creating MySQL user for roundcube
  34. mysql_user: name=roundcube password={{ispmail_mysql_roundcube_password}} priv=roundcube.*:ALL
  35. - name: copying MySQL test data to server
  36. copy: src=test.sql dest=/tmp
  37. when: ispmail_populate_test_data == true
  38. - name: populating the database with test data
  39. mysql_db: name=mailserver state=import target=/tmp/test.sql
  40. when: ispmail_populate_test_data == true
  41. # - name: set the MySQL root user's password
  42. # mysql_user: name=root password={{ispmail_mysql_root_password}}
  43. # - name: Create root's .my.cnf
  44. # template: src=my-cnf.j2 dest=/root/.my.cnf mode=0600