| --- |
| # This role will run a CouchDB server on the db group |
| |
| - name: check if db credentials are valid for CouchDB |
| fail: msg="The db provider in your {{ inventory_dir }}/group_vars/all is {{ db_provider }}, it has to be CouchDB, pls double check" |
| when: db_provider != "CouchDB" |
| |
| - name: create db pod |
| shell: "kubectl apply -f {{kube_pod_dir}}/db.yml" |
| |
| - name: wait until the CouchDB in this host is up and running |
| wait_for: |
| delay: 2 |
| host: "{{ db_host }}" |
| port: "{{ db_port }}" |
| timeout: 60 |
| |
| - name: create admin user |
| uri: |
| url: "{{ db_protocol }}://{{ db_host }}:{{ db_port }}/_config/admins/{{ db_username }}" |
| method: PUT |
| body: > |
| "{{ db_password }}" |
| body_format: json |
| status_code: 200 |
| |
| - name: disable reduce limit on views |
| uri: |
| url: "{{ db_protocol }}://{{ db_host }}:{{ db_port }}/_config/query_server_config/reduce_limit" |
| method: PUT |
| body: > |
| "false" |
| body_format: json |
| status_code: 200 |
| user: "{{ db_username }}" |
| password: "{{ db_password }}" |
| force_basic_auth: yes |