Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow persisted couchdb directory mount. #4250

Merged
merged 1 commit into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ansible/group_vars/all
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ db:
protocol: "{{ db_protocol | default(lookup('ini', 'db_protocol section=db_creds file={{ playbook_dir }}/db_local.ini')) }}"
port: "{{ db_port | default(lookup('ini', 'db_port section=db_creds file={{ playbook_dir }}/db_local.ini')) }}"
host: "{{ db_host | default(lookup('ini', 'db_host section=db_creds file={{ playbook_dir }}/db_local.ini')) }}"
persist_path: "{{ db_persist_path | default(false) }}"
instances: "{{ groups['db'] | length }}"
authkeys:
- guest
Expand Down
16 changes: 16 additions & 0 deletions ansible/roles/couchdb/tasks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@
fail: msg="The db provider in your {{ hosts_dir }}/group_vars/all is {{ db.provider }}, it has to be CouchDB, pls double check"
when: db.provider != "CouchDB"

- name: ensure directory for persisting db exists
stat:
path: "{{ db.persist_path }}"
register: db_persist_path_exists
when: db.persist_path

- name: fail if path to persist db does not exist
fail:
msg: directory for persisting db does not exist '{{ db.persist_path }}'
when: db.persist_path and not (db_persist_path_exists.stat.exists and db_persist_path_exists.stat.isdir)

- name: "mount directory for persisting dbs"
set_fact:
volumes: "{{ volumes }} + [ '{{ db.persist_path }}:/opt/couchdb/data' ]"
when: db.persist_path

- include_tasks: gen_erl_cookie.yml
when: (db.instances|int >= 2)

Expand Down