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.

95 lines
2.2KB

  1. ---
  2. - name: mysql database
  3. mysql_db:
  4. name: "{{postfixadmin_mysql_database}}"
  5. state: present
  6. delegate_to: "{{(postfixadmin_mysql_host=='localhost')|ternary(inventory_hostname,postfixadmin_mysql_host)}}"
  7. - name: mysql user
  8. mysql_user:
  9. name: "{{postfixadmin_mysql_username}}"
  10. password: "{{postfixadmin_mysql_password}}"
  11. priv: "{{postfixadmin_mysql_database}}.*:ALL,GRANT"
  12. host: "{{postfixadmin_mysql_host}}"
  13. state: present
  14. delegate_to: "{{(postfixadmin_mysql_host=='localhost')|ternary(inventory_hostname,postfixadmin_mysql_host)}}"
  15. - name: disable dbconfig
  16. debconf:
  17. name: postfixadmin
  18. question: postfixadmin/dbconfig-{{item}}
  19. answer: 'false'
  20. vtype: boolean
  21. with_items:
  22. - install
  23. - reinstall
  24. - remove
  25. - upgrade
  26. - name: install packages
  27. apt:
  28. pkg:
  29. - postfixadmin
  30. - ca-certificates
  31. - ssl-cert
  32. install_recommends: no
  33. - name: dbconfig
  34. template:
  35. src: dbconfig.inc.php.j2
  36. dest: /etc/postfixadmin/dbconfig.inc.php
  37. - name: ensure template_c folder is writable by webserver
  38. file:
  39. path: /usr/share/postfixadmin/templates_c
  40. owner: www-data
  41. group: www-data
  42. state: directory
  43. - name: make postfixadmin-cli executable
  44. file:
  45. path: /usr/share/postfixadmin/scripts/postfixadmin-cli
  46. mode: "u=rwx,g=rx,o=rx"
  47. - name: symlink for postfixadmin-cli
  48. file:
  49. src: /usr/share/postfixadmin/scripts/postfixadmin-cli
  50. dest: /usr/local/bin/postfixadmin-cli
  51. state: link
  52. #- name: setup postfixadmin
  53. # get_url:
  54. # url: http://localhost/postfixadmin/setup.php
  55. # dest: /var/www/html/postfixadmin-setup-report.html
  56. - name: apache2 vhost config
  57. template:
  58. src: apache2-vhost.conf.j2
  59. dest: /etc/apache2/sites-available/postfixadmin.conf
  60. notify:
  61. - apache2 reload
  62. - name: apache2 vhost enable
  63. file:
  64. src: ../sites-available/postfixadmin.conf
  65. dest: /etc/apache2/sites-enabled/postfixadmin.conf
  66. state: link
  67. notify:
  68. - apache2 reload
  69. - name: apache2 ssl module enable
  70. apache2_module:
  71. name: ssl
  72. state: present
  73. notify:
  74. - apache2 reload
  75. - name: disable postfixadmin apache2 config
  76. file:
  77. path: /etc/apache2/conf-enabled/postfixadmin.conf
  78. state: absent
  79. - name: flush handlers
  80. meta: flush_handlers