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.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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: Create fathom admin user account
  44. become: true
  45. become_user: "{{ main_user_name }}"
  46. shell: fathom user add --email="{{ fathom_admin_username }}" --password="{{ fathom_admin_password }}"
  47. args:
  48. chdir: /home/{{ main_user_name }}/fathom-stats
  49. ignore_errors: True
  50. - name: Add systemd service to start fathom automatically
  51. template:
  52. src=etc_systemd_system_fathom-stats.j2
  53. dest=/etc/systemd/system/fathom-stats.service
  54. owner=root
  55. group=root
  56. - name: Register new fathom service
  57. systemd: name=fathom-stats daemon_reload=yes enabled=yes
  58. - name: Start new fathom instance
  59. service: name=fathom-stats state=started
  60. - name: Create the Apache Fathom sites config files
  61. template:
  62. src=etc_apache2_sites-available_fathom.j2
  63. dest=/etc/apache2/sites-available/fathom_{{ item.name }}.conf
  64. owner=root
  65. group=root
  66. notify: restart apache
  67. with_items: "{{ virtual_domains }}"
  68. - name: Enable Apache sites (creates new sites-enabled symlinks)
  69. command: a2ensite fathom_{{ item }}.conf creates=/etc/apache2/sites-enabled/fathom_{{ item }}.conf
  70. notify: restart apache
  71. with_items: "{{ virtual_domains | json_query('[*].name') }}"