2016-07-28 18:31:53 +02:00
|
|
|
---
|
2016-12-13 13:11:27 +01:00
|
|
|
- block:
|
|
|
|
- name: Install the package source and the Couchbase public keys
|
|
|
|
apt: deb={{ couchbase_repo_pkg_url }}
|
|
|
|
register: couchbase_repo_pkg
|
|
|
|
|
|
|
|
- name: Update the apt cache if needed
|
|
|
|
apt: update_cache=yes
|
|
|
|
when: ( couchbase_repo_pkg | changed )
|
|
|
|
|
|
|
|
- name: Install the couchbase community server package
|
|
|
|
apt: pkg={{ item }} update_cache=yes cache_valid_time=3600
|
|
|
|
with_items:
|
|
|
|
- couchbase-server-community
|
|
|
|
|
2016-07-28 18:31:53 +02:00
|
|
|
when:
|
|
|
|
- couchbase_install_packages
|
2016-12-13 13:11:27 +01:00
|
|
|
- couchbase_install_from_repo
|
|
|
|
tags: couchbase
|
|
|
|
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Get and install the specific Couchbase package
|
|
|
|
apt: deb={{ couchbase_direct_package_url }}
|
|
|
|
|
2016-12-13 18:48:58 +01:00
|
|
|
when:
|
|
|
|
- couchbase_install_packages
|
|
|
|
- not couchbase_install_from_repo
|
|
|
|
tags: couchbase
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Install the backup script when needed
|
|
|
|
template: src=couchbase_backup.j2 dest=/usr/local/bin/couchbase_backup owner=root group=root mode=0550
|
|
|
|
when: couchbase_backup_enabled
|
|
|
|
|
2016-12-13 13:11:27 +01:00
|
|
|
- name: Ensure couchbase is started and enabled
|
|
|
|
service: name=couchbase-server state=started enabled=yes
|
|
|
|
when: couchbase_start_server
|
|
|
|
|
|
|
|
- name: Ensure couchbase is stopped and disabled
|
|
|
|
service: name=couchbase-server state=stopped enabled=no
|
|
|
|
when: not couchbase_start_server
|
|
|
|
|
2016-12-13 18:48:58 +01:00
|
|
|
when: couchbase_install_packages
|
|
|
|
tags: [ 'couchbase', 'couchbase_backup' ]
|
|
|
|
|
2016-12-13 13:11:27 +01:00
|
|
|
|
2016-07-28 18:31:53 +02:00
|
|
|
|
2016-12-13 13:11:27 +01:00
|
|
|
- block:
|
|
|
|
- name: Ensure couchbase is stopped and disabled
|
|
|
|
service: name=couchbase-server state=stopped enabled=no
|
2016-07-28 18:31:53 +02:00
|
|
|
|
2016-12-13 13:11:27 +01:00
|
|
|
- name: Remove the couchbase server package
|
|
|
|
apt: pkg={{ item }} state=absent update-cache=yes purge=yes
|
|
|
|
with_items:
|
|
|
|
- 'couchbase-server-community'
|
|
|
|
- 'couchbase-release'
|
2016-07-28 18:31:53 +02:00
|
|
|
|
2016-12-13 18:48:58 +01:00
|
|
|
- name: Remove the couchbase backup script and the couchbase non packaged files
|
|
|
|
file: dest={{ item }} state=absent
|
|
|
|
with_items:
|
|
|
|
- '/usr/local/bin/couchbase_backup'
|
|
|
|
- '/opt/couchbase'
|
|
|
|
|
2016-12-13 13:11:27 +01:00
|
|
|
when: not couchbase_install_packages
|
|
|
|
tags: couchbase
|