forked from ISTI-ansible-roles/ansible-roles
library/roles/couchdb: Work needed to provide both couchdb 1 and couchdb2 installs.
This commit is contained in:
parent
e53c5a3f63
commit
08e3950928
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
#
|
||||
# Note that the Ubuntu package use as data directory /var/lib/couchdb
|
||||
# That path is fixed inside /etc/init/couchdb.conf
|
||||
#
|
||||
# About replication
|
||||
# - couchdb replication is defined per database with a document put in the _replication db
|
||||
# on version 1.6
|
||||
#
|
||||
|
||||
# Set it to true if you want the old 1.6 release
|
||||
couchdb_use_old_package: False
|
||||
|
||||
couchdb_pkg_state: installed
|
||||
couchdb_pkg_version: 1.6.1
|
||||
couchdb_ppa: "ppa:couchdb/stable"
|
||||
couchdb_pkgs:
|
||||
- couchdb={{ couchdb_pkg_version }}
|
||||
- curl
|
||||
|
||||
couchdb_enabled: True
|
||||
couchdb_http_port: 5984
|
||||
couchdb_https_port: 6984
|
||||
couchdb_bind_address: 127.0.0.1
|
||||
couchdb_local_ini_d: /etc/couchdb
|
||||
couchdb_open_files: 4096
|
||||
|
||||
couchdb_set_admin: False
|
||||
#couchdb_admin_pwd: Put it in a vault file
|
||||
couchdb_admin_users:
|
||||
- { user: 'admin', pwd: '{{ couchdb_admin_pwd }}', state: 'present' }
|
||||
|
||||
couchdb_default_options:
|
||||
- { section: 'httpd', option: 'bind_address', value: '{{ couchdb_bind_address }}', state: 'present' }
|
||||
- { section: 'couch_httpd_auth', option: 'require_valid_user', value: 'true', state: 'present' }
|
||||
# - { section: 'httpd', option: 'config_whitelist', value: '"[{httpd,config_whitelist},{log,level}]"', state: 'present' }
|
||||
- { section: 'log', option: 'include_sasl', value: 'true', state: 'present' }
|
||||
|
||||
couchdb_replicator_options:
|
||||
- { section: 'replicator', option: 'db', value: '_replicator', state: 'present' }
|
||||
- { section: 'replicator', option: 'use_checkpoints', value: 'true', state: 'present' }
|
||||
- { section: 'replicator', option: 'worker_processes', value: '2', state: 'present' }
|
||||
- { section: 'replicator', option: 'http_connections', value: '15', state: 'present' }
|
||||
|
||||
# Use this to set your options
|
||||
#couchdb_custom_options:
|
||||
# - { section: 'httpd', option: 'bind_address', value: '{{ couchdb_bind_address }}', state: 'present' }
|
||||
# - { section: 'httpd', option: 'config_whitelist', value: '[{httpd,config_whitelist}, {log,level}]', state: 'present' }
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- name: Restart couchdb
|
||||
service: name=couchdb state=restarted
|
||||
when: couchdb_enabled
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
- name: Remove the couchdb package if it is installed
|
||||
apt: pkg=couchdb* state=absent purge=true
|
||||
tags: couchdb
|
||||
|
||||
- name: Remove the couchdb ppa
|
||||
apt_repository: repo='{{ couchdb_ppa }}' state=absent
|
||||
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: 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
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
---
|
||||
# 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
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- include: couchdb-old-package.yml
|
||||
when: couchdb_use_old_package
|
||||
- include: couchdb-2.yml
|
||||
when: not couchdb_use_old_package
|
|
@ -0,0 +1,4 @@
|
|||
#
|
||||
couchdb hard nofile {{ couchdb_open_files }}
|
||||
couchdb soft nofile {{ couchdb_open_files }}
|
||||
|
|
@ -31,6 +31,7 @@ katerina_iatropoulou: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA29WTITAKDhIE4lYt41hEtL
|
|||
farah_karim: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzKSQSk3ntKGUW2Cy8lt/44BTK2+UxMM4W2XO4CrcwgUxxlgIfpL4UjyuSKIygRdU/lL/4xHJdRNzA7PSEiHnBhIeLiF9QWw1mO2GVdJ4/1G5J/XEZ3sL7zyEdwwks7FsnT4U9PO9drNDZ1AmIK8eDKtX9EJcOFflulOknbIHjIq29gXcXbrhQaV3rNHS8vGDkv3fkpJT9Wi8BEUMeMFYsa3k3pc3nPysCQR+xsVJ1Ht+1gpU71W7fACaI1ltYaCToPAJasU19Tz6xE3edl9/Dz6HIL5FcVNSbLFEiyQhd5oL1ITCXJOwzyqobrUUdRK/30iIBRRFW00AIGQCDV0S3 hadoop@karim-ThinkPad-S1-Yoga
|
||||
luca_frosini: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDlTQulSJFayTJyOOecgsct35u7uvVQGX/Da11UZVxvJzw2sQKOMSCMBBGF9zUlcMoP/qvF425jVMM71S8kamCcqgSN528fp9W/Nhw7s15NbCE3H9tJ3B+u5ESOYsRfgogeTIyL26aIY/2rke0DoKDIMU3YlOtN/1ipt5cY9uV3ootxTM126y2WChICGo0h77M/Ta1pIccUE0XbuaA1HwlJBkfDzQ2kh5tkaC7mjeETstOQzpEoPFoVr0qwSPz1Y6l8uiedpDZejrq64Z2zRcSxjEQ1wuA9r8uO7TJQttUKK8m/dHMe6q3WAiFc9sOYe4tf/GEmziB8VloMTNCPJQiz lucafrosini@pc-frosini
|
||||
francesco_mangiacrapa: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDa0NzwaCcauxAFlsupU2xG2eff9nzep9bnb8pISbX2lk+K4yoJvJOAz9W9klJtpPX/IUJx18YR4jjDNcdiYWNh4Y+5jKT2EhSPNkj7Vw2MhA/ZeOrfHx7JNtL8gdxa8XxYB0ZoZqutRppmaRwWmGGwdVh0wyUzWR/v0OT01IuQGYVneLKIjUtx+BcWGsosWISaOQzVbv9iTFbSwgjbkKFHzHasxwKsrK4t1wvbzuxwhVC+5/VKghBJWN219m/PO+itww/fSes0KpI5X/7q8jrYzUgYwrKwt290U41Fx8syDQ6101YnRzMXZRyZwuVNh2S7WosGWebg5nPS4IjKho/F francesco-mangiacrapa@ubuntu-francesco-i24
|
||||
#lucia_vadicamo:
|
||||
sahar_vahdati: ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIB38nRuOy6g0UEkYLZ5v+VGQIbZAFjylEtbmZJAN3OMm+wcgoCTIBvytZ6Ajp8ZTT1tTqo2rsAVb8O5pv08Qaunl5VBfvEUyqNdYX9SY1kB5PzKtBZBbkkUI4AE7BNJKKuki0nYvOHP5p07FdobC2OjILGxci4zn37X+CGEykNrXQ== rsa-key-20150605
|
||||
|
||||
# Use the list when you want to give access to non root users
|
||||
|
|
Loading…
Reference in New Issue