Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. - name: Ensure repository key for MongoDB is in place for Rocket.Chat
  2. apt_key: url=https://www.mongodb.org/static/pgp/server-4.4.asc state=present
  3. tags:
  4. - dependencies
  5. - name: Add MongoDB repository for Rocket.Chat
  6. apt_repository: repo="deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.4 main"
  7. tags:
  8. - dependencies
  9. when: ansible_distribution_version == '9'
  10. - name: Add MongoDB repository for Rocket.Chat
  11. apt_repository: repo="deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main"
  12. tags:
  13. - dependencies
  14. when: ansible_distribution_version == '10'
  15. - name: Check if Node.js is installed
  16. command: dpkg-query -l nodejs
  17. register: nodejs_deb_check
  18. - name: Add Node.js repository for Rocket.Chat
  19. shell: curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash -
  20. when: nodejs_deb_check.stdout.find('no packages found') != -1
  21. - name: Install MongoDB and other Rocket.Chat dependencies
  22. apt:
  23. name: "{{ packages }}"
  24. state: present
  25. update_cache: yes
  26. vars:
  27. packages:
  28. - build-essential
  29. - mongodb-org
  30. - nodejs
  31. - fontconfig
  32. - graphicsmagick
  33. tags:
  34. - dependencies
  35. - name: Install proper Node.js version and dependencies for Rocket.Chat
  36. shell: sudo npm install -g inherits n && sudo n 12.18.4
  37. - name: Create temporary Rocket.Chat directory
  38. file: state=directory path=/root/rocketchat
  39. - name: Download Rocket.Chat {{ rocketchat_version }} release
  40. get_url:
  41. url="{{ rocketchat_release }}"
  42. dest=/root/rocketchat/rocketchat-{{ rocketchat_version }}.tar.gz
  43. - name: Check if temporary Rocket.Chat {{ rocketchat_version }} directory already exists
  44. stat:
  45. path: /root/rocketchat/{{ rocketchat_version }}
  46. register: rocketchat_unpack_check
  47. - name: Create temporary Rocket.Chat {{ rocketchat_version }} directory
  48. file: state=directory path=/root/rocketchat/{{ rocketchat_version }}
  49. - name: Unpack Rocket.Chat {{ rocketchat_version }} source
  50. shell: tar xzvf /root/rocketchat/rocketchat-{{ rocketchat_version }}.tar.gz -C /root/rocketchat/{{ rocketchat_version }}
  51. args:
  52. chdir: /root/rocketchat
  53. creates: /root/rocketchat/{{ rocketchat_version }}/bundle
  54. - name: Install Rocket.Chat {{ rocketchat_version }} source
  55. shell: cd /root/rocketchat/{{ rocketchat_version }}/bundle/programs/server && npm install --unsafe-perm
  56. when: not rocketchat_unpack_check.stat.exists
  57. - name: Create /usr/local/bin/Rocket.Chat
  58. file: state=directory path=/usr/local/bin/Rocket.Chat
  59. - name: Stop old Rocket.Chat instance
  60. service: name=rocketchat state=stopped
  61. ignore_errors: True
  62. - name: Copy Rocket.Chat to /usr/local/bin/Rocket.Chat
  63. shell: cp -R /root/rocketchat/{{ rocketchat_version }}/bundle/. /usr/local/bin/Rocket.Chat/
  64. - name: Add rocketchat group
  65. group:
  66. name: rocketchat
  67. state: present
  68. - name: Add rocketchat user
  69. user:
  70. name: rocketchat
  71. create_home: no
  72. shell: /bin/bash
  73. password_lock: yes
  74. state: present
  75. system: yes
  76. group: rocketchat
  77. - name: Fix Rocket.Chat permissions
  78. shell: sudo chown -R rocketchat:rocketchat /usr/local/bin/Rocket.Chat
  79. - name: Create the Rocket.Chat service file
  80. template:
  81. src=lib_systemd_system_rocketchat.j2
  82. dest=/lib/systemd/system/rocketchat.service
  83. owner=root
  84. group=root
  85. - name: Add modified MongoDB config file for Rocket.Chat
  86. copy:
  87. src=etc_mongod.conf
  88. dest=/etc/mongod.conf
  89. owner=root
  90. group=root
  91. notify: restart mongod
  92. - name: Register new MongoDB service for Rocket.Chat
  93. systemd: name=mongod daemon_reload=yes enabled=yes
  94. - name: Start new MongoDB instance for Rocket.Chat
  95. service: name=mongod state=restarted
  96. - name: Initiate MongoDB replication set for Rocket.Chat
  97. shell: sudo mongo --eval "if (rs.status().codeName == \"NotYetInitialized\") printjson(rs.initiate())"
  98. - name: Register new Rocket.Chat service
  99. systemd: name=rocketchat daemon_reload=yes enabled=yes
  100. - name: Start new Rocket.Chat instance
  101. service: name=rocketchat state=started
  102. - name: Create the Apache Rocket.Chat sites config files
  103. template:
  104. src=etc_apache2_sites-available_rocketchat.j2
  105. dest=/etc/apache2/sites-available/rocketchat_{{ item.name }}.conf
  106. owner=root
  107. group=root
  108. notify: restart apache
  109. with_items: "{{ virtual_domains }}"
  110. - name: Enable Apache sites (creates new sites-enabled symlinks)
  111. command: a2ensite rocketchat_{{ item }}.conf creates=/etc/apache2/sites-enabled/rocketchat_{{ item }}.conf
  112. notify: restart apache
  113. with_items: "{{ virtual_domains | json_query('[*].name') }}"