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.

main.yaml 3.1KB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ---
  2. - import_role:
  3. name: secrets
  4. vars:
  5. secrets_definitions: "{{ hibiscus_server_secrets_definitions }}"
  6. - import_role:
  7. name: adoptopenjdk
  8. - import_role:
  9. name: mysql_server
  10. - name: apt packages
  11. apt:
  12. pkg:
  13. - adoptopenjdk-8-hotspot
  14. - name: hibiscus-server src directory
  15. file:
  16. path: /usr/local/src/hibiscus-server
  17. state: directory
  18. - name: get hibiscus-server archive checksum
  19. uri:
  20. url: https://www.willuhn.de/products/hibiscus-server/releases/hibiscus-server-{{hibiscus_server_version}}.zip.SHA
  21. return_content: true
  22. register: hibiscus_server_archive_checksum_uri
  23. - name: get hibiscus-server archive
  24. get_url:
  25. url: https://www.willuhn.de/products/hibiscus-server/releases/hibiscus-server-{{hibiscus_server_version}}.zip
  26. dest: /usr/local/src/hibiscus-server/hibiscus-server-{{hibiscus_server_version}}.zip
  27. checksum: sha1:{{hibiscus_server_archive_checksum_uri.content.split(" ")[0]}}
  28. - name: extract hibiscus-server archive
  29. unarchive:
  30. src: /usr/local/src/hibiscus-server/hibiscus-server-{{hibiscus_server_version}}.zip
  31. dest: /opt
  32. remote_src: yes
  33. exclude:
  34. - hibiscus-server/cfg/de.willuhn.jameica.hbci.rmi.HBCIDBService.properties
  35. - name: hibiscus-server user
  36. group:
  37. name: hibiscus-server
  38. - name: hibiscus-server user
  39. user:
  40. name: hibiscus-server
  41. group: hibiscus-server
  42. home: /var/lib/hibiscus-server
  43. - name: hibiscus-server home directory
  44. file:
  45. path: /var/lib/hibiscus-server
  46. owner: hibiscus-server
  47. group: hibiscus-server
  48. mode: 0700
  49. state: directory
  50. - name: hibiscus-server systemd service unit
  51. copy:
  52. src: systemd/hibiscus-server.service
  53. dest: /etc/systemd/system/hibiscus-server.service
  54. notify: systemd daemon reload
  55. - name: hibiscus-server etc directory
  56. file:
  57. path: /etc/hibiscus-server
  58. state: directory
  59. - name: hibiscus-server env
  60. template:
  61. src: env.j2
  62. dest: /etc/hibiscus-server/env
  63. mode: 0600
  64. - name: mysql database
  65. mysql_db:
  66. name: "{{hibiscus_server_db_name}}"
  67. state: present
  68. encoding: utf8
  69. collation: utf8_general_ci
  70. login_unix_socket: /run/mysqld/mysqld.sock
  71. register: hibiscus_server_mysql_database
  72. - name: create hibiscus-server mysql database layout
  73. shell:
  74. cat /opt/hibiscus-server/plugins/hibiscus/sql/mysql-create.sql
  75. | mysql "{{hibiscus_server_db_name}}"
  76. when: "{{ hibiscus_server_mysql_database.changed }}"
  77. - name: mysql user
  78. mysql_user:
  79. name: "{{hibiscus_server_db_user}}"
  80. password: "{{hibiscus_server_db_pass}}"
  81. priv: "{{hibiscus_server_db_name}}.*:ALL,GRANT"
  82. host: localhost
  83. state: present
  84. login_unix_socket: /run/mysqld/mysqld.sock
  85. - name: hibiscus-server database config symlink
  86. file:
  87. dest: /opt/hibiscus-server/cfg/de.willuhn.jameica.hbci.rmi.HBCIDBService.properties
  88. src: /etc/hibiscus-server/de.willuhn.jameica.hbci.rmi.HBCIDBService.properties
  89. state: link
  90. force: true
  91. - name: hibiscus-server database config
  92. template:
  93. src: de.willuhn.jameica.hbci.rmi.HBCIDBService.properties.j2
  94. dest: /etc/hibiscus-server/de.willuhn.jameica.hbci.rmi.HBCIDBService.properties
  95. mode: 0640
  96. group: hibiscus-server