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.
 
 
 
 
 
 

61 regels
2.0 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 root user password
  6. # become: true
  7. # # If .my.cnf already exists, this will cause an mysql-root-password update.
  8. # mysql_user:
  9. # name: root
  10. # password: "{{ ispmail_mysql_root_password}}"
  11. # login_unix_socket: /var/run/mysqld/mysqld.sock
  12. # check_implicit_admin: true
  13. - name: Set a new root password
  14. mysql_user:
  15. check_implicit_admin: yes
  16. user: root
  17. password: "{{ ispmail_mysql_root_password }}"
  18. login_unix_socket: /var/run/mysqld/mysqld.sock
  19. host: "{{ item }}"
  20. with_items:
  21. - localhost
  22. - 127.0.0.1
  23. - name: Create .my.cnf
  24. template:
  25. src: "root-my-cnf.j2"
  26. dest: "/root/.my.cnf"
  27. owner: root
  28. group: root
  29. mode: 0600
  30. - name: creating mailserver MySQL database
  31. #become: true
  32. mysql_db:
  33. name: mailserver
  34. - name: creating Roundcube MySQL database
  35. mysql_db: name=roundcube
  36. - name: copying MySQL database schema to server
  37. copy: src=schema.sql dest=/tmp
  38. - name: setting up SQL schema of mailserver database
  39. mysql_db: name=mailserver state=import target=/tmp/schema.sql
  40. # - name: set the MySQL root user's password
  41. # mysql_user: name=root password={{ispmail_mysql_root_password}}
  42. - name: creating MySQL user to read the mailserver database
  43. mysql_user: name=mailuser password={{ispmail_mysql_mailuser_password}} priv=mailserver.*:SELECT,INSERT,UPDATE,DELETE
  44. - name: creating MySQL user for roundcube
  45. mysql_user: name=roundcube password={{ispmail_mysql_roundcube_password}} priv=roundcube.*:ALL
  46. - name: copying MySQL test data to server
  47. copy: src=test.sql dest=/tmp
  48. when: ispmail_populate_test_data == true
  49. - name: populating the database with test data
  50. mysql_db: name=mailserver state=import target=/tmp/test.sql
  51. when: ispmail_populate_test_data == true
  52. # - name: set the MySQL root user's password
  53. # mysql_user: name=root password={{ispmail_mysql_root_password}}
  54. # - name: Create root's .my.cnf
  55. # template: src=my-cnf.j2 dest=/root/.my.cnf mode=0600