Commit e2ae08ad by Kevin Falcone

Tag tasks

We're stopping rabbit, but it's part of the configuration the service,
so I didn't use manage:.  We may need to re-discuss the tags (mongo_3_0
works similarly when stopping mongo to manage config).
parent 4f6b565a
......@@ -10,6 +10,7 @@ WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays
RUN /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook rabbitmq.yml \
-i '127.0.0.1,' -c local \
-t 'install,manage:app-users' \
-e@/ansible_overrides.yml
WORKDIR /edx/app
......
......@@ -11,7 +11,8 @@
# Defaults for role rabbitmq
#
#Setting this to false ensures rabbit will never be upgraded if the wrong version is installed
#Setting this to false means we will not check your rabbit version.
#It is not safe to upgrade rabbit in place except for certain minor versions.
CHECK_RABBIT_VERSION: true
rabbitmq_app_dir: "{{ COMMON_APP_DIR }}/rabbitmq"
......@@ -51,9 +52,8 @@ RABBITMQ_VERSION: 3.6.9-1
# option to force deletion of the mnesia dir
rabbitmq_refresh: false
extra_repos:
# - {repo: "deb https://www.rabbitmq.com/debian/ testing main", key: "https://www.rabbitmq.com/rabbitmq-signing-key-public.asc"}
- {repo: "deb https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ {{ ansible_distribution_release }} main", key: "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey " }
rabbitmq_repo: "deb https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ {{ ansible_distribution_release }} main"
rabbitmq_repo_key: "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey"
rabbitmq_debian_pkgs:
- "apt-transport-https"
......
......@@ -15,18 +15,22 @@
- install
- install:app-requirements
- name: trust extra repositories
- name: trust rabbit's packagecloud repository
apt_key:
url: "{{ item.key }}"
url: "{{ rabbitmq_repo_key }}"
state: present
with_items: "{{ extra_repos }}"
tags:
- "install"
- "install:app-requirements"
- name: add extra repositories
- name: add rabbit's packagecloud repository
apt_repository:
repo: "{{ item.repo }}"
repo: "{{ rabbitmq_repo }}"
state: present
update_cache: yes
with_items: "{{ extra_repos }}"
tags:
- "install"
- "install:app-requirements"
# If we don't set pipefail first, `||` will be looking at the exit code of the last command in the pipe
- name: Check if rabbit is installed
......@@ -36,10 +40,16 @@
args:
executable: /bin/bash
register: installed_version
tags:
- "install"
- "install:app-requirements"
- name: Fail if wrong rabbit version is installed
fail: Expected rabbitmq version {{ RABBITMQ_VERSION }}, found {{ installed_version.stdout }}
when: CHECK_RABBIT_VERSION and installed_version.stdout is defined and installed_version.stdout not in [RABBITMQ_VERSION, 'not installed']
tags:
- "install"
- "install:app-requirements"
- name: Install rabbit package
apt:
......@@ -48,16 +58,25 @@
force: yes
update_cache: yes
when: installed_version.stdout is defined and installed_version.stdout == "not installed"
tags:
- "install"
- "install:app-requirements"
- name: Stop rabbit cluster
service:
name: rabbitmq-server
state: stopped
tags:
- "install"
- "install:app-configuration"
# In case there are lingering processes, ignore errors
# silently
- name: Send sigterm to any running rabbitmq processes
shell: "pkill -u rabbitmq || true"
tags:
- "install"
- "install:app-configuration"
- name: Create rabbitmq edx directories
file:
......@@ -68,6 +87,9 @@
with_items:
- "{{ rabbitmq_app_dir }}"
- "{{ rabbitmq_log_dir }}"
tags:
- "install"
- "install:app-configuration"
- name: Add queue monitoring script
template:
......@@ -77,6 +99,8 @@
group: "{{ rabbitmq_group }}"
mode: "0755"
tags:
- "install"
- "install:app-configuration"
- "monitoring"
- name: Add RabbitMQ memory usage script
......@@ -87,6 +111,8 @@
group: "{{ rabbitmq_group }}"
mode: "0775"
tags:
- "install"
- "install:app-configuration"
- "monitoring"
- name: Set up a cron job to run queue script
......@@ -94,6 +120,8 @@
name: "log-queue-lenghts"
job: "{{ rabbitmq_app_dir }}/log-rabbitmq-queues.sh >/dev/null 2>&1"
tags:
- "install"
- "install:app-configuration"
- "monitoring"
- name: Set up a cron job to run the script
......@@ -101,6 +129,8 @@
name: "log-rabbitmq-memory-usage"
job: "{{ rabbitmq_app_dir }}/log-rabbitmq-memory.sh >/dev/null 2>&1"
tags:
- "install"
- "install:app-configuration"
- "monitoring"
- name: install logrotate configuration
......@@ -109,7 +139,7 @@
dest: /etc/logrotate.d/rabbitmq
tags:
- "install"
- "install:configuration"
- "install:app-configuration"
- "logrotate"
# Defaulting to /var/lib/rabbitmq
......@@ -120,6 +150,9 @@
owner: rabbitmq
group: rabbitmq
mode: "0755"
tags:
- "install"
- "install:app-configuration"
- name: Add rabbitmq erlang cookie
template:
......@@ -129,6 +162,9 @@
group: rabbitmq
mode: "0400"
register: erlang_cookie
tags:
- "install"
- "install:app-configuration"
# Defaulting to /etc/rabbitmq
- name: Create rabbitmq config directory
......@@ -138,6 +174,9 @@
owner: root
group: root
mode: "0755"
tags:
- "install"
- "install:app-configuration"
- name: Add rabbitmq environment configuration
template:
......@@ -146,6 +185,9 @@
owner: root
group: root
mode: "0644"
tags:
- "install"
- "install:app-configuration"
- name: Add rabbitmq cluster configuration
template:
......@@ -155,12 +197,18 @@
group: root
mode: "0644"
register: cluster_configuration
tags:
- "install"
- "install:app-configuration"
- name: Install plugins
rabbitmq_plugin:
names: "{{ item }}"
state: enabled
with_items: "{{ rabbitmq_plugins }}"
tags:
- "install"
- "install:app-configuration"
# When rabbitmq starts up it creates a folder of metadata at '/var/lib/rabbitmq/mnesia'.
# This folder should be deleted before clustering is setup because it retains data
......@@ -170,16 +218,25 @@
path: "{{ rabbitmq_mnesia_folder }}"
state: absent
when: erlang_cookie.changed or cluster_configuration.changed or rabbitmq_refresh
tags:
- "install"
- "install:app-configuration"
- name: Start rabbit nodes
service:
name: rabbitmq-server
state: started
tags:
- "install"
- "install:app-configuration"
- name: Wait for rabbit to start
wait_for:
port: "{{ rabbitmq_management_port }}"
delay: 2
tags:
- "install"
- "install:app-configuration"
- name: Remove guest user
rabbitmq_user:
......@@ -188,6 +245,8 @@
tags:
- users
- maintenance
- "manage"
- "manage:app-users"
- name: Add vhosts
rabbitmq_vhost:
......@@ -197,6 +256,8 @@
tags:
- vhosts
- maintenance
- "install"
- "install:app-configuration"
- name: Add admin users
rabbitmq_user:
......@@ -215,6 +276,8 @@
tags:
- users
- maintenance
- "manage"
- "manage:app-users"
- name: Make queues mirrored
rabbitmq_policy:
......@@ -230,6 +293,8 @@
tags:
- ha
- maintenance
- "install"
- "install:app-configuration"
#
# Depends upon the management plugin
......@@ -238,6 +303,16 @@
get_url:
url: "http://localhost:{{ rabbitmq_management_port }}/cli/rabbitmqadmin"
dest: "/usr/local/bin/rabbitmqadmin"
tags:
- "install"
- "install:app-configuration"
- name: Ensure rabbitmqadmin attributes
file:
path: "/usr/local/bin/rabbitmqadmin"
owner: root
group: root
mode: "0655"
tags:
- "install"
- "install:app-configuration"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment