forked from ISTI-ansible-roles/ansible-roles
68 lines
2.6 KiB
YAML
68 lines
2.6 KiB
YAML
|
---
|
||
|
# This is the playbook that installs couchdb 1.x
|
||
|
#
|
||
|
- name: Add the ppa for couchdb
|
||
|
apt_repository: repo='{{ couchdb_ppa }}'
|
||
|
register: update_apt_cache
|
||
|
tags: couchdb
|
||
|
|
||
|
- name: Update the apt cache if needed
|
||
|
apt: update_cache=yes
|
||
|
when: (update_apt_cache|changed)
|
||
|
tags: couchdb
|
||
|
|
||
|
- name: Install the couchdb packages
|
||
|
apt: pkg={{ item }} state={{ couchdb_pkg_state }}
|
||
|
with_items: couchdb_pkgs
|
||
|
tags: couchdb
|
||
|
|
||
|
- name: Change the open files limit
|
||
|
template: src=limits-couchdb.nofiles.j2 dest=/etc/security/limits.d/couchdb.nofiles.conf owner=root group=root mode=0444
|
||
|
tags: couchdb
|
||
|
|
||
|
#
|
||
|
# Couchdb changes the admin password with a hash, so we need to not overwrite the file at each playbook run
|
||
|
- name: Create the admin config file, once
|
||
|
copy: content="[admins]\n" dest={{ couchdb_local_ini_d }}/local.d/admin.ini force=no
|
||
|
when: couchdb_set_admin
|
||
|
register: admin_init
|
||
|
tags: couchdb
|
||
|
|
||
|
- name: Set the admin users
|
||
|
ini_file: dest={{ couchdb_local_ini_d }}/local.d/admin.ini section=admins option={{ item.user }} value={{ item.pwd }} owner=couchdb group=couchdb mode=0640 state={{ item.state }}
|
||
|
with_items: couchdb_admin_users
|
||
|
when:
|
||
|
- couchdb_set_admin
|
||
|
# - admin_init is defined and ( admin_init | changed )
|
||
|
notify: Restart couchdb
|
||
|
tags: [ 'couchdb', 'couch_opts']
|
||
|
|
||
|
- name: Basic couchdb configuration
|
||
|
ini_file: dest={{ couchdb_local_ini_d }}/local.ini section={{ item.section }} option={{ item.option }} value={{ item.value }} owner=couchdb group=couchdb mode=0640 state={{ item.state }}
|
||
|
with_items: couchdb_default_options
|
||
|
notify: Restart couchdb
|
||
|
tags: [ 'couchdb', 'couch_opts']
|
||
|
|
||
|
- name: Replicator couchdb configuration
|
||
|
ini_file: dest={{ couchdb_local_ini_d }}/local.d/replicator.ini section={{ item.section }} option={{ item.option }} value={{ item.value }} owner=couchdb group=couchdb mode=0640 state={{ item.state }}
|
||
|
with_items: couchdb_replicator_options
|
||
|
notify: Restart couchdb
|
||
|
tags: [ 'couchdb', 'couch_opts']
|
||
|
|
||
|
- name: Custom couchdb configuration
|
||
|
ini_file: dest={{ couchdb_local_ini_d }}/local.ini section={{ item.section }} option={{ item.option }} value={{ item.value }} owner=couchdb group=couchdb mode=0640 state={{ item.state }}
|
||
|
with_items: couchdb_custom_options
|
||
|
when: couchdb_custom_options is defined
|
||
|
notify: Restart couchdb
|
||
|
tags: [ 'couchdb', 'couch_opts']
|
||
|
|
||
|
- name: Ensure that couchdb is enabled and running
|
||
|
service: name=couchdb state=started enabled=yes
|
||
|
when: couchdb_enabled
|
||
|
tags: couchdb
|
||
|
|
||
|
- name: Ensure that couchdb is disabled and stopped
|
||
|
service: name=couchdb state=stopped enabled=no
|
||
|
when: not couchdb_enabled
|
||
|
tags: couchdb
|