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

View File

@ -1 +1,3 @@
rabbitmq_cookie_token: secrete 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 # Install RabbitMQ server
- include: test-install-rabbitmq-server.yml - include: test-install-rabbitmq-server.yml
# Run tests
- include: test-functional.yml
vars:
rabbitmq_package_version: "3.6.1-1"
############################# UPGRADE TESTING ############################# ############################# UPGRADE TESTING #############################
# Run container clean up and build # Run container clean up and build
@ -37,7 +42,18 @@
rabbitmq_package_version: "{{ rabbitmq_package_url.split('/')[-1].split('_')[1] }}" rabbitmq_package_version: "{{ rabbitmq_package_url.split('/')[-1].split('_')[1] }}"
rabbitmq_package_sha256: "b8a42321c2f2689dc579911fbb583bd9c4d2ce2f20003d7050d5a324a6d2de42" 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 - include: test-install-rabbitmq-server.yml
vars: vars:
rabbitmq_upgrade: true rabbitmq_upgrade: true
# Run tests
- include: test-functional.yml
vars:
rabbitmq_package_version: "3.6.1-1"