99 lines
2.5 KiB
YAML
99 lines
2.5 KiB
YAML
---
|
|
- name: Install unzip using apt
|
|
become: true
|
|
apt: name=unzip state=latest update_cache=yes force_apt_get=yes
|
|
|
|
- name: "NOTSCORED | 3.5.1.6 | PATCH | Ensure firewall rules exist for all open ports"
|
|
become: true
|
|
ufw:
|
|
rule: allow
|
|
proto: tcp
|
|
port: "{{ item }}"
|
|
loop:
|
|
- '3000'
|
|
- '80'
|
|
- '443'
|
|
- '22'
|
|
|
|
- name: Creates directory structure for rocketchat data
|
|
file:
|
|
path: /home/{{ main_user }}/rocketchat/data
|
|
state: directory
|
|
owner: "{{ main_user }}"
|
|
group: "{{ main_user }}"
|
|
mode: 0775
|
|
|
|
- name: Creates directory structure for nginx data
|
|
file:
|
|
path: /home/{{ main_user }}/rocketchat/nginx
|
|
state: directory
|
|
owner: "{{ main_user }}"
|
|
group: "{{ main_user }}"
|
|
mode: 0775
|
|
|
|
- name: Creates directory structure for upload data
|
|
become: true
|
|
file:
|
|
path: /home/{{ main_user }}/rocketchat/uploads
|
|
state: directory
|
|
owner: "{{ main_user }}"
|
|
group: "{{ main_user }}"
|
|
mode: 0775
|
|
|
|
- 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
|
|
update: no
|
|
|
|
- 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
|
|
|
|
- name: copy docker compose to server (from template)
|
|
template:
|
|
src: templates/docker-compose.yml.j2
|
|
dest: /home/{{ main_user }}/rocketchat/docker-compose.yml
|
|
|
|
- name: bring down rocketchat docker-compose
|
|
become_user: "{{ main_user }}"
|
|
docker_compose:
|
|
project_src: /home/{{ main_user }}/rocketchat/
|
|
state: absent
|
|
remove_orphans: true
|
|
register: __remove_rocketchat
|
|
tags:
|
|
- bring-down
|
|
|
|
- name: update permissions
|
|
become: true
|
|
file:
|
|
path: /home/{{ main_user }}
|
|
state: directory
|
|
recurse: yes
|
|
owner: "{{ main_user }}"
|
|
group: "{{ main_user }}"
|
|
mode: 0775
|
|
|
|
- name: setup nginx reverse proxy from template
|
|
template:
|
|
src: templates/nginx.conf.j2
|
|
dest: /home/{{ main_user }}/rocketchat/nginx/nginx.conf
|
|
|
|
- name: docker compose up
|
|
become_user: "{{ main_user }}"
|
|
docker_compose:
|
|
project_src: /home/{{ main_user }}/rocketchat/
|
|
state: present
|
|
register: __rocketchat
|
|
|
|
- name: debug docker compose down
|
|
debug:
|
|
var: __remove_rocketchat
|
|
|
|
- name: debug docker compose up debug
|
|
debug:
|
|
var: __rocketchat
|