ansible-roles/couchbase/tasks/couchbase.yml

60 lines
1.7 KiB
YAML
Raw Normal View History

---
- 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
- 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
when:
- couchbase_install_packages
- couchbase_install_from_repo
tags: couchbase
- block:
- name: Get and install the specific Couchbase package
apt: deb={{ couchbase_direct_package_url }}
- 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
when:
- couchbase_install_packages
- not couchbase_install_from_repo
tags: couchbase
- block:
- name: Ensure couchbase is stopped and disabled
service: name=couchbase-server state=stopped enabled=no
- name: Remove the couchbase server package
apt: pkg={{ item }} state=absent update-cache=yes purge=yes
with_items:
- 'couchbase-server-community'
- 'couchbase-release'
when: not couchbase_install_packages
tags: couchbase