Нема описа
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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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: Enable Apache sites (creates new sites-enabled symlinks)
  74. command: a2ensite fathom_{{ item }}.conf creates=/etc/apache2/sites-enabled/fathom_{{ item }}.conf
  75. notify: restart apache
  76. with_items: "{{ virtual_domains | json_query('[*].name') }}"