Ei kuvausta
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.

fathom.yml 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. - name: Create temporary fathom directory
  2. file: state=directory path=/root/fathom
  3. - name: Download fathom {{ fathom_version }} release
  4. get_url:
  5. url="{{ fathom_release }}"
  6. dest=/root/fathom/fathom-{{ fathom_version }}.tar.gz
  7. - name: Decompress fathom release
  8. unarchive: src=/root/fathom/fathom-{{ fathom_version }}.tar.gz
  9. dest=/root/fathom copy=no
  10. creates=/root/fathom/fathom
  11. - name: Create /usr/local/bin
  12. file: state=directory path=/usr/local/bin
  13. - name: Stop old fathom instance
  14. service: name=fathom-stats state=stopped
  15. - name: Copy fathom binary to /usr/local/bin
  16. shell: cp fathom/fathom /usr/local/bin/fathom chdir=/root
  17. - name: Remove downloaded temporary fathom files
  18. file: state=absent path=/root/fathom
  19. - name: Create fathom working directory
  20. file: state=directory path=/home/{{ main_user_name }}/fathom-stats
  21. - name: Create fathom config file
  22. template:
  23. src=home_user_fathom-stats_env.j2
  24. dest=/home/{{ main_user_name }}/fathom-stats/.env
  25. owner={{ main_user_name }}
  26. group=root
  27. - name: Add fathom postgres user
  28. postgresql_user:
  29. login_host=localhost
  30. login_user={{ db_admin_username }}
  31. login_password="{{ db_admin_password }}"
  32. name={{ fathom_db_username }}
  33. password="{{ fathom_db_password }}"
  34. encrypted=yes
  35. state=present
  36. - name: Create fathom database
  37. postgresql_db:
  38. login_host=localhost
  39. login_user={{ db_admin_username }}
  40. login_password="{{ db_admin_password }}"
  41. name={{ fathom_db_database }}
  42. state=present
  43. owner={{ fathom_db_username }}
  44. - name: Delete old fathom admin user account
  45. become: true
  46. become_user: "{{ main_user_name }}"
  47. shell: fathom user delete --email="{{ fathom_admin_username }}"
  48. args:
  49. chdir: /home/{{ main_user_name }}/fathom-stats
  50. - name: Create fathom admin user account
  51. become: true
  52. become_user: "{{ main_user_name }}"
  53. shell: fathom user add --email="{{ fathom_admin_username }}" --password="{{ fathom_admin_password }}"
  54. args:
  55. chdir: /home/{{ main_user_name }}/fathom-stats
  56. - name: Add systemd service to start fathom automatically
  57. template:
  58. src=etc_systemd_system_fathom-stats.j2
  59. dest=/etc/systemd/system/fathom-stats.service
  60. owner=root
  61. group=root
  62. - name: Register new fathom service
  63. systemd: name=fathom-stats daemon_reload=yes enabled=yes
  64. - name: Start new fathom instance
  65. service: name=fathom-stats state=started
  66. - name: Create the Apache Fathom sites config files
  67. template:
  68. src=etc_apache2_sites-available_fathom.j2
  69. dest=/etc/apache2/sites-available/fathom_{{ item.name }}.conf
  70. owner=root
  71. group=root
  72. with_items: "{{ virtual_domains }}"
  73. - name: Remove old sites-enabled symlinks (new ones will be created by a2ensite)
  74. file: path=/etc/apache2/sites-enabled/fathom_{{ item }}.conf state=absent
  75. with_items: "{{ virtual_domains | json_query('[*].name') }}"
  76. - name: Enable Apache sites (creates new sites-enabled symlinks)
  77. command: a2ensite fathom_{{ item }}.conf creates=/etc/apache2/sites-enabled/fathom_{{ item }}.conf
  78. notify: restart apache
  79. with_items: "{{ virtual_domains | json_query('[*].name') }}"