backup mongodb task initail commit - wip for sure

This commit is contained in:
BSounder 2022-07-07 19:47:17 -07:00
parent c0dd7a9eea
commit bbd93449f9
2 changed files with 27 additions and 6 deletions

View File

@ -1,3 +1,12 @@
--- ---
# harden by default # harden by default
harden_os: true harden_os: true
# latest as of 7/7/2022
rc_version: 4.8.1
# WIP to get to 5.0
mongo_version: 4.4
# backup by default - saves to /home/{{ main_user }}/rocketchat/data/dump/2015-07-09T16:59:26Z" (iso8601 of current date)
backup_db: true

View File

@ -1,9 +1,5 @@
--- ---
- name: Install unzip using apt - name: "Open ports for RocketChat"
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 become: true
ufw: ufw:
rule: allow rule: allow
@ -44,7 +40,7 @@
ansible.builtin.git: ansible.builtin.git:
repo: 'https://github.com/RocketChat/docker-mmap-to-wiredtiger-migration.git' repo: 'https://github.com/RocketChat/docker-mmap-to-wiredtiger-migration.git'
dest: /home/{{ main_user }}/rocketchat/rocketchat-migration dest: /home/{{ main_user }}/rocketchat/rocketchat-migration
update: no update: yes
- name: Copy docker folder from mmap to wiredTiger mongoDB migration repo - name: Copy docker folder from mmap to wiredTiger mongoDB migration repo
ansible.builtin.copy: ansible.builtin.copy:
@ -89,6 +85,18 @@
state: present state: present
register: __rocketchat register: __rocketchat
- 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
- name: debug docker compose down - name: debug docker compose down
debug: debug:
var: __remove_rocketchat var: __remove_rocketchat
@ -96,3 +104,7 @@
- name: debug docker compose up debug - name: debug docker compose up debug
debug: debug:
var: __rocketchat var: __rocketchat
- name: debug mongo backup
debug:
var: __backup_result