No Description
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 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. ignore_errors: True
  16. - name: Copy fathom binary to /usr/local/bin
  17. shell: cp fathom/fathom /usr/local/bin/fathom chdir=/root
  18. - name: Create fathom working directory
  19. file: state=directory path=/home/{{ main_user_name }}/fathom-stats
  20. - name: Create fathom config file
  21. template:
  22. src=home_user_fathom-stats_env.j2
  23. dest=/home/{{ main_user_name }}/fathom-stats/.env
  24. owner={{ main_user_name }}
  25. group=root
  26. - name: Add fathom postgres user
  27. postgresql_user:
  28. login_host=localhost
  29. login_user={{ db_admin_username }}
  30. login_password="{{ db_admin_password }}"
  31. name={{ fathom_db_username }}
  32. password="{{ fathom_db_password }}"
  33. encrypted=yes
  34. state=present
  35. - name: Create fathom database
  36. postgresql_db:
  37. login_host=localhost
  38. login_user={{ db_admin_username }}
  39. login_password="{{ db_admin_password }}"
  40. name={{ fathom_db_database }}
  41. state=present
  42. owner={{ fathom_db_username }}
  43. - name: Delete old fathom admin user account
  44. become: true
  45. become_user: "{{ main_user_name }}"
  46. shell: fathom user delete --email="{{ fathom_admin_username }}"
  47. args:
  48. chdir: /home/{{ main_user_name }}/fathom-stats
  49. - name: Create fathom admin user account
  50. become: true
  51. become_user: "{{ main_user_name }}"
  52. shell: fathom user add --email="{{ fathom_admin_username }}" --password="{{ fathom_admin_password }}"
  53. args:
  54. chdir: /home/{{ main_user_name }}/fathom-stats
  55. - name: Add systemd service to start fathom automatically
  56. template:
  57. src=etc_systemd_system_fathom-stats.j2
  58. dest=/etc/systemd/system/fathom-stats.service
  59. owner=root
  60. group=root
  61. - name: Register new fathom service
  62. systemd: name=fathom-stats daemon_reload=yes enabled=yes
  63. - name: Start new fathom instance
  64. service: name=fathom-stats state=started
  65. - name: Create the Apache Fathom sites config files
  66. template:
  67. src=etc_apache2_sites-available_fathom.j2
  68. dest=/etc/apache2/sites-available/fathom_{{ item.name }}.conf
  69. owner=root
  70. group=root
  71. with_items: "{{ virtual_domains }}"
  72. - name: Enable Apache sites (creates new sites-enabled symlinks)
  73. command: a2ensite fathom_{{ item }}.conf creates=/etc/apache2/sites-enabled/fathom_{{ item }}.conf
  74. notify: restart apache
  75. with_items: "{{ virtual_domains | json_query('[*].name') }}"