main.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. - name: Install required packages for osTicket
  2. apt:
  3. pkg: "{{ item }}"
  4. update_cache: no
  5. state: installed
  6. with_items:
  7. - sendmail
  8. - unzip
  9. - name: Create database for osticket
  10. mysql_db: name=osticket state=present
  11. - name: Create database user for osticket
  12. mysql_user: name=osticket host=localhost password=osticket state=present priv=osticket.*:ALL
  13. register: createdbuser
  14. - name: Reload privilege tables
  15. command: 'mysql -ne "{{ item }}"'
  16. with_items:
  17. - FLUSH PRIVILEGES
  18. changed_when: False
  19. when: createdbuser.changed
  20. - name: create directory for osticket
  21. file: name=/opt/osticket state=directory
  22. - name: get osTicket
  23. get_url:
  24. url: "http://osticket.com/sites/default/files/download/osTicket-v1.10.zip"
  25. dest: /opt/osticket/osTicket-v1.10.zip
  26. register: getosticket
  27. - name: unarchive osTicket
  28. unarchive:
  29. src: /opt/osticket/osTicket-v1.10.zip
  30. dest: /opt/osticket/
  31. remote_src: True
  32. when: getosticket.changed
  33. - name: get german language file
  34. get_url:
  35. url: "http://osticket.com/sites/default/files/download/lang/de.phar"
  36. dest: /opt/osticket/upload/include/i18n/de.phar
  37. - name: Adjust permissions of /opt/osticket/upload
  38. file:
  39. path: /opt/osticket/upload
  40. owner: www-data
  41. group: www-data
  42. recurse: yes
  43. - name: copy ost-sampleconfig.php to ost-config.php
  44. shell: cp /opt/osticket/upload/include/ost-sampleconfig.php /opt/osticket/upload/include/ost-config.php
  45. args:
  46. creates: /opt/osticket/upload/include/ost-config.php
  47. - name: Adjust permissions of /opt/osticket/upload/include/ost-config.php
  48. file:
  49. path: /opt/osticket/upload/include/ost-config.php
  50. mode: 0666
  51. - name: get webroot state
  52. stat: path=/var/www/{{inventory_hostname_short}}.{{freifunk.domain}}
  53. register: webroot_stat
  54. - name: remove old webroot directory
  55. file: src=/opt/osticket/upload dest=/var/www/{{inventory_hostname_short}}.{{freifunk.domain}} state=absent
  56. when: webroot_stat.stat.isdir is defined and webroot_stat.stat.isdir
  57. - name: link osticket to webroot
  58. file: src=/opt/osticket/upload dest=/var/www/{{inventory_hostname_short}}.{{freifunk.domain}} state=link
  59. - name: setup already moved?
  60. stat: path=/opt/osticket/upload/setup
  61. register: setup_stat
  62. ##############################################################################################################
  63. - pause:
  64. prompt: "Please execute setup assistent on https://{{inventory_hostname_short}}.{{freifunk.domain}}/setup"
  65. when: setup_stat.stat.exists
  66. ##############################################################################################################
  67. - name: Adjust permissions of /opt/osticket/upload/include/ost-config.php
  68. file:
  69. path: /opt/osticket/upload/include/ost-config.php
  70. mode: 0644
  71. - name: Move folder setup to setup_hidden
  72. command: mv /opt/osticket/upload/setup /opt/osticket/upload/setup_hidden
  73. when: setup_stat.stat.exists
  74. - name: Adjust permissions of /opt/osticket/upload/setup_hidden
  75. file:
  76. path: /opt/osticket/upload/setup_hidden
  77. owner: root
  78. group: root
  79. mode: 0700
  80. recurse: yes
  81. - name: Install cron for osticket
  82. cron:
  83. name: "osTicket"
  84. minute: "*/5"
  85. job: "php /opt/osticket/upload/api/cron.php"