2022-05-27 23:27:40 +00:00
|
|
|
---
|
2022-07-08 02:47:17 +00:00
|
|
|
- name: "Open ports for RocketChat"
|
2022-07-07 21:03:54 +00:00
|
|
|
become: true
|
2022-05-27 23:27:40 +00:00
|
|
|
ufw:
|
|
|
|
rule: allow
|
|
|
|
proto: tcp
|
|
|
|
port: "{{ item }}"
|
|
|
|
loop:
|
|
|
|
- '3000'
|
|
|
|
- '80'
|
|
|
|
- '443'
|
|
|
|
- '22'
|
|
|
|
|
2022-05-30 04:09:48 +00:00
|
|
|
- name: Creates directory structure for rocketchat data
|
2022-05-27 23:27:40 +00:00
|
|
|
file:
|
2022-05-30 02:03:23 +00:00
|
|
|
path: /home/{{ main_user }}/rocketchat/data
|
2022-05-27 23:27:40 +00:00
|
|
|
state: directory
|
|
|
|
owner: "{{ main_user }}"
|
|
|
|
group: "{{ main_user }}"
|
|
|
|
mode: 0775
|
|
|
|
|
2022-05-30 04:09:48 +00:00
|
|
|
- name: Creates directory structure for nginx data
|
|
|
|
file:
|
|
|
|
path: /home/{{ main_user }}/rocketchat/nginx
|
|
|
|
state: directory
|
|
|
|
owner: "{{ main_user }}"
|
|
|
|
group: "{{ main_user }}"
|
|
|
|
mode: 0775
|
|
|
|
|
2022-07-08 01:33:50 +00:00
|
|
|
- name: Creates directory structure for upload data
|
2022-07-08 01:36:59 +00:00
|
|
|
become: true
|
2022-07-08 01:33:50 +00:00
|
|
|
file:
|
|
|
|
path: /home/{{ main_user }}/rocketchat/uploads
|
|
|
|
state: directory
|
|
|
|
owner: "{{ main_user }}"
|
|
|
|
group: "{{ main_user }}"
|
|
|
|
mode: 0775
|
|
|
|
|
2022-07-08 01:46:37 +00:00
|
|
|
- name: Ensure mmap to wiredTiger mongoDB repo checkout exists
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: 'https://github.com/RocketChat/docker-mmap-to-wiredtiger-migration.git'
|
|
|
|
dest: /home/{{ main_user }}/rocketchat/rocketchat-migration
|
2022-07-08 02:47:17 +00:00
|
|
|
update: yes
|
2022-07-08 01:46:37 +00:00
|
|
|
|
|
|
|
- name: Copy docker folder from mmap to wiredTiger mongoDB migration repo
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /home/{{ main_user }}/rocketchat/rocketchat-migration/docker
|
|
|
|
dest: /home/{{ main_user }}/rocketchat/docker
|
|
|
|
remote_src: yes
|
|
|
|
|
2022-07-08 02:14:35 +00:00
|
|
|
- name: copy docker compose to server (from template)
|
|
|
|
template:
|
|
|
|
src: templates/docker-compose.yml.j2
|
|
|
|
dest: /home/{{ main_user }}/rocketchat/docker-compose.yml
|
2022-05-30 03:52:02 +00:00
|
|
|
|
2022-05-30 02:03:23 +00:00
|
|
|
- name: bring down rocketchat docker-compose
|
2022-05-27 23:27:40 +00:00
|
|
|
become_user: "{{ main_user }}"
|
|
|
|
docker_compose:
|
2022-05-30 02:03:23 +00:00
|
|
|
project_src: /home/{{ main_user }}/rocketchat/
|
2022-05-27 23:27:40 +00:00
|
|
|
state: absent
|
2022-07-08 02:14:35 +00:00
|
|
|
remove_orphans: true
|
2022-05-30 02:03:23 +00:00
|
|
|
register: __remove_rocketchat
|
2022-05-27 23:27:40 +00:00
|
|
|
tags:
|
|
|
|
- bring-down
|
|
|
|
|
|
|
|
- name: update permissions
|
2022-07-07 21:03:54 +00:00
|
|
|
become: true
|
2022-05-27 23:27:40 +00:00
|
|
|
file:
|
|
|
|
path: /home/{{ main_user }}
|
|
|
|
state: directory
|
|
|
|
recurse: yes
|
|
|
|
owner: "{{ main_user }}"
|
|
|
|
group: "{{ main_user }}"
|
|
|
|
mode: 0775
|
|
|
|
|
2022-05-30 02:03:23 +00:00
|
|
|
- name: setup nginx reverse proxy from template
|
|
|
|
template:
|
2022-05-30 04:03:36 +00:00
|
|
|
src: templates/nginx.conf.j2
|
2022-05-30 02:03:23 +00:00
|
|
|
dest: /home/{{ main_user }}/rocketchat/nginx/nginx.conf
|
|
|
|
|
2022-05-27 23:27:40 +00:00
|
|
|
- name: docker compose up
|
|
|
|
become_user: "{{ main_user }}"
|
|
|
|
docker_compose:
|
2022-05-30 02:03:23 +00:00
|
|
|
project_src: /home/{{ main_user }}/rocketchat/
|
2022-05-27 23:27:40 +00:00
|
|
|
state: present
|
2022-05-30 02:03:23 +00:00
|
|
|
register: __rocketchat
|
2022-05-27 23:27:40 +00:00
|
|
|
|
2022-07-08 02:47:17 +00:00
|
|
|
- name: Get the current datetime
|
|
|
|
debug:
|
|
|
|
var: ansible_date_time
|
|
|
|
|
|
|
|
- name: Backup existing RocketChat mongo database
|
|
|
|
when:
|
|
|
|
community.docker.docker_container_exec:
|
|
|
|
container: mongo
|
|
|
|
command: mongodump --archive=/dump/{{ ansible_date_time.iso8601 }} --gzip
|
|
|
|
chdir: /home/{{ main_user }}/rocketchat
|
|
|
|
register: __backup_result
|
|
|
|
|
2022-05-27 23:27:40 +00:00
|
|
|
- name: debug docker compose down
|
|
|
|
debug:
|
2022-05-30 02:03:23 +00:00
|
|
|
var: __remove_rocketchat
|
2022-05-27 23:27:40 +00:00
|
|
|
|
2022-05-30 02:03:23 +00:00
|
|
|
- name: debug docker compose up debug
|
2022-05-27 23:27:40 +00:00
|
|
|
debug:
|
2022-05-30 02:03:23 +00:00
|
|
|
var: __rocketchat
|
2022-07-08 02:47:17 +00:00
|
|
|
|
|
|
|
- name: debug mongo backup
|
|
|
|
debug:
|
|
|
|
var: __backup_result
|