Initial commit
[ta/infra-ansible.git] / conflicts-with-openstack-ansible / rabbitmq-install.yml
1 ---
2 # Copyright 2014, Rackspace US, Inc.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 # cmframework.requires: memcached-install.yml,galera-install.yml,rabbitmq-remove-reinitialized.yml
16
17 - name: Create and configure rabbitmq container
18   hosts: "{{ rabbitmq_host_group | default('rabbitmq_all') }}"
19   serial: 1
20   gather_facts: "{{ osa_gather_facts | default(True) }}"
21   pre_tasks:
22     - include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml"
23       static:
24       vars:
25         extra_container_config_no_restart:
26           - "lxc.start.order=19"
27     - include: common-tasks/unbound-clients.yml
28       static: no
29       when:
30         - hostvars['localhost']['resolvconf_enabled'] | bool
31   roles:
32     - role: "system_crontab_coordination"
33   environment: "{{ deployment_environment_variables | default({}) }}"
34   tags:
35     - rabbitmq
36
37 # The cluster must be stopped when doing major/minor upgrades
38 # http://www.rabbitmq.com/clustering.html#upgrading
39 - name: Stop RabbitMQ nodes that are not the upgrader
40   hosts: "{{ rabbitmq_host_group | default('rabbitmq_all') }}[1:]"
41   tasks:
42     - name: "Stop RabbitMQ"
43       service:
44         name: "rabbitmq-server"
45         state: "stopped"
46       when: rabbitmq_upgrade | default(false) | bool
47
48 - name: Install rabbitmq server
49   hosts: "{{ rabbitmq_host_group | default('rabbitmq_all') }}"
50   serial: 20%
51   roles:
52     - role: "rabbitmq_server"
53     - role: "rsyslog_client"
54       rsyslog_client_log_rotate_file: rabbitmq_log_rotate
55       rsyslog_client_log_dir: "/var/log/rabbitmq"
56       rsyslog_client_config_name: "99-rabbitmq-rsyslog-client.conf"
57       tags:
58         - rsyslog
59   environment: "{{ deployment_environment_variables | default({}) }}"
60   tags:
61     - rabbitmq
62
63 - name: Ensure rabbitmq user for monitoring GUI
64   hosts: "{{ rabbitmq_host_group | default('rabbitmq_all') }}[0]"
65   tasks:
66     - name: Create rabbitmq user for monitoring GUI
67       rabbitmq_user:
68          user: "{{ rabbitmq_monitoring_userid|default('monitoring') }}"
69          password: "{{ rabbitmq_monitoring_password }}"
70          tags: "monitoring"
71          state: "present"
72       when: rabbitmq_monitoring_password is defined
73   environment: "{{ deployment_environment_variables | default({}) }}"
74   tags:
75     - rabbitmq-config
76     - rabbitmq