diff --git a/defaults/main.yml b/defaults/main.yml index be18b32..12fcc6e 100755 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,5 +8,8 @@ rc_version: 4.8.1 # WIP to get to 5.0 mongo_version: 4.4 +# WIP to get to 5.0 - if same as mongo_version or false, feature compatibility version will not be set +prev_mongo_version: 4.2 + # backup by default - saves to /home/{{ main_user }}/rocketchat/data/dump/2015-07-09T16:59:26Z" (iso8601 of current date) backup_db: true \ No newline at end of file diff --git a/tasks/rocketchat.yml b/tasks/rocketchat.yml index 43605f4..063e777 100644 --- a/tasks/rocketchat.yml +++ b/tasks/rocketchat.yml @@ -122,9 +122,22 @@ dest: "{{ local_backup_dir }}" tags: mongodump +- name: Set feature compability version if we are upgrading mongoDB + when: prev_mongo_version and prev_mongo_version != mongo_version + community.docker.docker_container_exec: + container: rocketchat_mongo_1 + command: > + bash -c 'mongo --eval "db.adminCommand( { setFeatureCompatibilityVersion: \"{{ prev_mongo_version }}\" } )"' + # chdir: /home/{{ main_user }}/rocketchat + # chdir: / + #docker-compose exec mongo + register: __set_feature_compability_version_mongo + tags: mongoupgrade + - name: debug docker compose down debug: var: __remove_rocketchat + tags: bring-down - name: debug docker compose up debug debug: @@ -135,3 +148,10 @@ debug: var: __backup_result tags: mongodump + + +- name: debug mongo upgrade set feature compatability version + when: prev_mongo_version and prev_mongo_version != mongo_version + debug: + var: __set_feature_compability_version_mongo + tags: mongoupgrade \ No newline at end of file