Merge "install rabbitmq-server in serial"

This commit is contained in:
Jenkins 2016-05-10 13:37:54 +00:00 committed by Gerrit Code Review
commit 4ee710c9bf
4 changed files with 74 additions and 49 deletions

View File

@ -13,48 +13,55 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Check rabbitmq is running
command: "pgrep rabbit"
delegate_to: "{{ item }}"
when: ansible_ssh_host == item
with_items:
- 10.100.100.101
- 10.100.100.102
- 10.100.100.103
- name: Open rabbitmq.config
slurp:
src: "/etc/rabbitmq/rabbitmq.config"
register: rabbitmq_config
- name: Open enabled_plugins
slurp:
src: "/etc/rabbitmq/enabled_plugins"
register: enabled_plugins
- name: Read rabbitmq_ssl_cert
stat:
path: "{{ rabbitmq_ssl_cert }}"
register: rabbitmq_ssl_cert_stat
- name: Read rabbitmq_ssl_key
stat:
path: "{{ rabbitmq_ssl_key }}"
register: rabbitmq_ssl_key_stat
- name: Read rabbit files
set_fact:
enabled_plugins_contents: "{{ enabled_plugins.content | b64decode }}"
rabbitmq_config_contents: "{{ rabbitmq_config.content | b64decode }}"
rabbitmq_ssl_cert_checksum: "{{ rabbitmq_ssl_cert_stat.stat.checksum }}"
rabbitmq_ssl_key_checksum: "{{ rabbitmq_ssl_key_stat.stat.checksum }}"
- name: Check files contents
assert:
that:
- "'rabbitmq_management' in enabled_plugins_contents"
- name: Get status of rabbitmq
command: rabbitmqctl status
register: rabbitmqctl_status
- name: Ensure SSL cert/key checksums are identical across cluster
assert:
that:
- hostvars['container1']['rabbitmq_ssl_cert_checksum'] == hostvars['container2']['rabbitmq_ssl_cert_checksum'] == hostvars['container3']['rabbitmq_ssl_cert_checksum']
- hostvars['container1']['rabbitmq_ssl_key_checksum'] == hostvars['container2']['rabbitmq_ssl_key_checksum'] == hostvars['container3']['rabbitmq_ssl_key_checksum']
- name: Ensure expected version of rabbitmq is running
assert:
that: rabbitmqctl_status.stdout | search ("rabbit,\"RabbitMQ\",\"{{ rabbitmq_package_version.split('-')[0] }}\"")
- name: Run functional tests
hosts: rabbitmq_all
user: root
gather_facts: true
vars_files:
- test-vars.yml
tasks:
- name: Check rabbitmq is running
command: "pgrep rabbit"
delegate_to: "{{ item }}"
when: ansible_ssh_host == item
with_items:
- 10.100.100.101
- 10.100.100.102
- 10.100.100.103
- name: Open rabbitmq.config
slurp:
src: "/etc/rabbitmq/rabbitmq.config"
register: rabbitmq_config
- name: Open enabled_plugins
slurp:
src: "/etc/rabbitmq/enabled_plugins"
register: enabled_plugins
- name: Read rabbitmq_ssl_cert
stat:
path: "{{ rabbitmq_ssl_cert }}"
register: rabbitmq_ssl_cert_stat
- name: Read rabbitmq_ssl_key
stat:
path: "{{ rabbitmq_ssl_key }}"
register: rabbitmq_ssl_key_stat
- name: Read rabbit files
set_fact:
enabled_plugins_contents: "{{ enabled_plugins.content | b64decode }}"
rabbitmq_config_contents: "{{ rabbitmq_config.content | b64decode }}"
rabbitmq_ssl_cert_checksum: "{{ rabbitmq_ssl_cert_stat.stat.checksum }}"
rabbitmq_ssl_key_checksum: "{{ rabbitmq_ssl_key_stat.stat.checksum }}"
- name: Check files contents
assert:
that:
- "'rabbitmq_management' in enabled_plugins_contents"
- name: Get status of rabbitmq
command: rabbitmqctl status
register: rabbitmqctl_status
- name: Ensure SSL cert/key checksums are identical across cluster
assert:
that:
- hostvars['container1']['rabbitmq_ssl_cert_checksum'] == hostvars['container2']['rabbitmq_ssl_cert_checksum'] == hostvars['container3']['rabbitmq_ssl_cert_checksum']
- hostvars['container1']['rabbitmq_ssl_key_checksum'] == hostvars['container2']['rabbitmq_ssl_key_checksum'] == hostvars['container3']['rabbitmq_ssl_key_checksum']
- name: Ensure expected version of rabbitmq is running
assert:
that: rabbitmqctl_status.stdout | search ("rabbit,\"RabbitMQ\",\"{{ rabbitmq_package_version.split('-')[0] }}\"")

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE(mancdaz): rabbitmq cannot be upgraded in serial, so when
# rabbitmq_upgrade=True, serial is set to 0, else it is 1 for installs
- name: Install RabbitMQ server
hosts: rabbitmq_all
serial: "{{ rabbitmq_upgrade|default(false) | bool | ternary(0, 1)}}"
user: root
gather_facts: true
roles:
- role: "{{ rolename | basename }}"
rabbitmq_cookie_token: secrete
post_tasks:
- include: test-functional.yml
vars_files:
- test-vars.yml

View File

@ -1 +1,3 @@
rabbitmq_cookie_token: secrete
rabbitmq_ssl_cert: /etc/rabbitmq/rabbitmq.pem
rabbitmq_ssl_key: /etc/rabbitmq/rabbitmq.key

View File

@ -25,6 +25,11 @@
# Install RabbitMQ server
- include: test-install-rabbitmq-server.yml
# Run tests
- include: test-functional.yml
vars:
rabbitmq_package_version: "3.6.1-1"
############################# UPGRADE TESTING #############################
# Run container clean up and build
@ -37,7 +42,18 @@
rabbitmq_package_version: "{{ rabbitmq_package_url.split('/')[-1].split('_')[1] }}"
rabbitmq_package_sha256: "b8a42321c2f2689dc579911fbb583bd9c4d2ce2f20003d7050d5a324a6d2de42"
# Perform upgrade of RabbitMQ server
# Run tests
- include: test-functional.yml
vars:
rabbitmq_package_version: "3.5.7-1"
# Perform upgrade of RabbitMQ server (package_version will come
# from role defaults)
- include: test-install-rabbitmq-server.yml
vars:
rabbitmq_upgrade: true
# Run tests
- include: test-functional.yml
vars:
rabbitmq_package_version: "3.6.1-1"