install rabbitmq-server in serial

In order to prevent race conditions with nodes joining the cluster
simultaneously when the cluster is first formed, we move the rabbitmq
installation play to be 'serial: 1'. However, when the nodes are being
upgraded, it cannot be done in serial so in this case we set 'serial: 0'

The tests are removed from a post_task include in the install play, and
moved to their own play as they need to be run after the entire cluster
has been formed. As well as moving a few generic vars into the
test-vars.yml include, we also pass in the specific version of rabbitmq
to be tested against in the test play.

Fixes-Bug: #1573030

Change-Id: Id119ff9f20ddfd8e1f29598c8c5ce862d2e7fab4
This commit is contained in:
Darren Birkett 2016-05-05 22:36:34 +01:00
parent 4da96df136
commit 5dc67955f0
4 changed files with 74 additions and 49 deletions

View File

@ -13,6 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- 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 }}"

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"