library/roles/couchbase: Install a specific version if not explicitly specified that we want the latest package from the repository.

This commit is contained in:
Andrea Dell'Amico 2016-12-13 13:11:27 +01:00
parent 1a096e3b32
commit 7fb43eae37
2 changed files with 56 additions and 27 deletions

View File

@ -1,9 +1,13 @@
--- ---
couchbase_install_packages: True couchbase_install_packages: False
couchbase_start_server: True couchbase_start_server: True
couchbase_install_from_repo: False
couchbase_repo_pkg: couchbase-release-1.0-2-amd64.deb couchbase_repo_pkg: couchbase-release-1.0-2-amd64.deb
couchbase_repo_pkg_url: 'http://packages.couchbase.com/releases/couchbase-release/{{ couchbase_repo_pkg }}' couchbase_repo_pkg_url: 'http://packages.couchbase.com/releases/couchbase-release/{{ couchbase_repo_pkg }}'
couchbase_pkg_file: 'couchbase-server-community_4.0.0-ubuntu14.04_amd64.deb'
couchbase_direct_package_url: 'http://packages.couchbase.com/releases/4.0.0/{{ couchbase_pkg_file }}'
couchbase_default_host: localhost couchbase_default_host: localhost
couchbase_console_port: 8091 couchbase_console_port: 8091
couchbase_xdcr_port: 8092 couchbase_xdcr_port: 8092
@ -37,11 +41,6 @@ couchbase_epmd_port: 4369
couchbase_dataExchangeFirst_port: 21100 couchbase_dataExchangeFirst_port: 21100
couchbase_dataExchangeLast_port: 21299 couchbase_dataExchangeLast_port: 21299
couchbase_allowed_hosts:
- '{{ network.isti }}'
- '{{ network.nmis }}'
- '{{ ansible_default_ipv4.address }}/32'
couchbase_ganglia_plugin_enabled: True couchbase_ganglia_plugin_enabled: True
#couchbase_ganglia_url_username: #couchbase_ganglia_url_username:
#couchbase_ganglia_url_password: #couchbase_ganglia_url_password:

View File

@ -1,29 +1,59 @@
--- ---
- name: Get the meta package for the couchbase repository - block:
get_url: url={{ couchbase_repo_pkg_url }} dest=/root/{{ couchbase_repo_pkg }} - name: Install the package source and the Couchbase public keys
register: couchbase_repository apt: deb={{ couchbase_repo_pkg_url }}
tags: couchbase register: couchbase_repo_pkg
- name: Install the package source and the Couchbase public keys - name: Update the apt cache if needed
shell: /usr/bin/dpkg -i /root/couchbase-release-1.0-2-amd64.deb apt: update_cache=yes
when: ( couchbase_repository | changed ) when: ( couchbase_repo_pkg | changed )
tags: couchbase
- 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
- name: Install the latest version of couchbase community server
apt: pkg={{ item }} state=latest update_cache=yes
with_items:
- couchbase-server-community
when: when:
- couchbase_install_packages - couchbase_install_packages
tags: couchbase - couchbase_install_from_repo
tags: couchbase
- name: Ensure couchbase is started and enabled
service: name=couchbase-server state=started enabled=yes
when: couchbase_start_server
tags: couchbase
- name: Ensure couchbase is stopped and disabled - block:
service: name=couchbase-server state=stopped enabled=no - name: Get and install the specific Couchbase package
when: not couchbase_start_server apt: deb={{ couchbase_direct_package_url }}
tags: couchbase
- 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