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 ...@@ -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 \ RUN /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook rabbitmq.yml \
-i '127.0.0.1,' -c local \ -i '127.0.0.1,' -c local \
-t 'install,manage:app-users' \
-e@/ansible_overrides.yml -e@/ansible_overrides.yml
WORKDIR /edx/app WORKDIR /edx/app
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
# Defaults for role rabbitmq # 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 CHECK_RABBIT_VERSION: true
rabbitmq_app_dir: "{{ COMMON_APP_DIR }}/rabbitmq" rabbitmq_app_dir: "{{ COMMON_APP_DIR }}/rabbitmq"
...@@ -51,9 +52,8 @@ RABBITMQ_VERSION: 3.6.9-1 ...@@ -51,9 +52,8 @@ RABBITMQ_VERSION: 3.6.9-1
# option to force deletion of the mnesia dir # option to force deletion of the mnesia dir
rabbitmq_refresh: false rabbitmq_refresh: false
extra_repos: rabbitmq_repo: "deb https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ {{ ansible_distribution_release }} main"
# - {repo: "deb https://www.rabbitmq.com/debian/ testing main", key: "https://www.rabbitmq.com/rabbitmq-signing-key-public.asc"} rabbitmq_repo_key: "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey"
- {repo: "deb https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ {{ ansible_distribution_release }} main", key: "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey " }
rabbitmq_debian_pkgs: rabbitmq_debian_pkgs:
- "apt-transport-https" - "apt-transport-https"
......
...@@ -15,18 +15,22 @@ ...@@ -15,18 +15,22 @@
- install - install
- install:app-requirements - install:app-requirements
- name: trust extra repositories - name: trust rabbit's packagecloud repository
apt_key: apt_key:
url: "{{ item.key }}" url: "{{ rabbitmq_repo_key }}"
state: present state: present
with_items: "{{ extra_repos }}" tags:
- "install"
- "install:app-requirements"
- name: add extra repositories - name: add rabbit's packagecloud repository
apt_repository: apt_repository:
repo: "{{ item.repo }}" repo: "{{ rabbitmq_repo }}"
state: present state: present
update_cache: yes 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 # 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 - name: Check if rabbit is installed
...@@ -36,10 +40,16 @@ ...@@ -36,10 +40,16 @@
args: args:
executable: /bin/bash executable: /bin/bash
register: installed_version register: installed_version
tags:
- "install"
- "install:app-requirements"
- name: Fail if wrong rabbit version is installed - name: Fail if wrong rabbit version is installed
fail: Expected rabbitmq version {{ RABBITMQ_VERSION }}, found {{ installed_version.stdout }} 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'] 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 - name: Install rabbit package
apt: apt:
...@@ -48,16 +58,25 @@ ...@@ -48,16 +58,25 @@
force: yes force: yes
update_cache: yes update_cache: yes
when: installed_version.stdout is defined and installed_version.stdout == "not installed" when: installed_version.stdout is defined and installed_version.stdout == "not installed"
tags:
- "install"
- "install:app-requirements"
- name: Stop rabbit cluster - name: Stop rabbit cluster
service: service:
name: rabbitmq-server name: rabbitmq-server
state: stopped state: stopped
tags:
- "install"
- "install:app-configuration"
# In case there are lingering processes, ignore errors # In case there are lingering processes, ignore errors
# silently # silently
- name: Send sigterm to any running rabbitmq processes - name: Send sigterm to any running rabbitmq processes
shell: "pkill -u rabbitmq || true" shell: "pkill -u rabbitmq || true"
tags:
- "install"
- "install:app-configuration"
- name: Create rabbitmq edx directories - name: Create rabbitmq edx directories
file: file:
...@@ -68,6 +87,9 @@ ...@@ -68,6 +87,9 @@
with_items: with_items:
- "{{ rabbitmq_app_dir }}" - "{{ rabbitmq_app_dir }}"
- "{{ rabbitmq_log_dir }}" - "{{ rabbitmq_log_dir }}"
tags:
- "install"
- "install:app-configuration"
- name: Add queue monitoring script - name: Add queue monitoring script
template: template:
...@@ -77,6 +99,8 @@ ...@@ -77,6 +99,8 @@
group: "{{ rabbitmq_group }}" group: "{{ rabbitmq_group }}"
mode: "0755" mode: "0755"
tags: tags:
- "install"
- "install:app-configuration"
- "monitoring" - "monitoring"
- name: Add RabbitMQ memory usage script - name: Add RabbitMQ memory usage script
...@@ -87,6 +111,8 @@ ...@@ -87,6 +111,8 @@
group: "{{ rabbitmq_group }}" group: "{{ rabbitmq_group }}"
mode: "0775" mode: "0775"
tags: tags:
- "install"
- "install:app-configuration"
- "monitoring" - "monitoring"
- name: Set up a cron job to run queue script - name: Set up a cron job to run queue script
...@@ -94,6 +120,8 @@ ...@@ -94,6 +120,8 @@
name: "log-queue-lenghts" name: "log-queue-lenghts"
job: "{{ rabbitmq_app_dir }}/log-rabbitmq-queues.sh >/dev/null 2>&1" job: "{{ rabbitmq_app_dir }}/log-rabbitmq-queues.sh >/dev/null 2>&1"
tags: tags:
- "install"
- "install:app-configuration"
- "monitoring" - "monitoring"
- name: Set up a cron job to run the script - name: Set up a cron job to run the script
...@@ -101,6 +129,8 @@ ...@@ -101,6 +129,8 @@
name: "log-rabbitmq-memory-usage" name: "log-rabbitmq-memory-usage"
job: "{{ rabbitmq_app_dir }}/log-rabbitmq-memory.sh >/dev/null 2>&1" job: "{{ rabbitmq_app_dir }}/log-rabbitmq-memory.sh >/dev/null 2>&1"
tags: tags:
- "install"
- "install:app-configuration"
- "monitoring" - "monitoring"
- name: install logrotate configuration - name: install logrotate configuration
...@@ -109,7 +139,7 @@ ...@@ -109,7 +139,7 @@
dest: /etc/logrotate.d/rabbitmq dest: /etc/logrotate.d/rabbitmq
tags: tags:
- "install" - "install"
- "install:configuration" - "install:app-configuration"
- "logrotate" - "logrotate"
# Defaulting to /var/lib/rabbitmq # Defaulting to /var/lib/rabbitmq
...@@ -120,6 +150,9 @@ ...@@ -120,6 +150,9 @@
owner: rabbitmq owner: rabbitmq
group: rabbitmq group: rabbitmq
mode: "0755" mode: "0755"
tags:
- "install"
- "install:app-configuration"
- name: Add rabbitmq erlang cookie - name: Add rabbitmq erlang cookie
template: template:
...@@ -129,6 +162,9 @@ ...@@ -129,6 +162,9 @@
group: rabbitmq group: rabbitmq
mode: "0400" mode: "0400"
register: erlang_cookie register: erlang_cookie
tags:
- "install"
- "install:app-configuration"
# Defaulting to /etc/rabbitmq # Defaulting to /etc/rabbitmq
- name: Create rabbitmq config directory - name: Create rabbitmq config directory
...@@ -138,6 +174,9 @@ ...@@ -138,6 +174,9 @@
owner: root owner: root
group: root group: root
mode: "0755" mode: "0755"
tags:
- "install"
- "install:app-configuration"
- name: Add rabbitmq environment configuration - name: Add rabbitmq environment configuration
template: template:
...@@ -146,6 +185,9 @@ ...@@ -146,6 +185,9 @@
owner: root owner: root
group: root group: root
mode: "0644" mode: "0644"
tags:
- "install"
- "install:app-configuration"
- name: Add rabbitmq cluster configuration - name: Add rabbitmq cluster configuration
template: template:
...@@ -155,12 +197,18 @@ ...@@ -155,12 +197,18 @@
group: root group: root
mode: "0644" mode: "0644"
register: cluster_configuration register: cluster_configuration
tags:
- "install"
- "install:app-configuration"
- name: Install plugins - name: Install plugins
rabbitmq_plugin: rabbitmq_plugin:
names: "{{ item }}" names: "{{ item }}"
state: enabled state: enabled
with_items: "{{ rabbitmq_plugins }}" with_items: "{{ rabbitmq_plugins }}"
tags:
- "install"
- "install:app-configuration"
# When rabbitmq starts up it creates a folder of metadata at '/var/lib/rabbitmq/mnesia'. # 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 # This folder should be deleted before clustering is setup because it retains data
...@@ -170,16 +218,25 @@ ...@@ -170,16 +218,25 @@
path: "{{ rabbitmq_mnesia_folder }}" path: "{{ rabbitmq_mnesia_folder }}"
state: absent state: absent
when: erlang_cookie.changed or cluster_configuration.changed or rabbitmq_refresh when: erlang_cookie.changed or cluster_configuration.changed or rabbitmq_refresh
tags:
- "install"
- "install:app-configuration"
- name: Start rabbit nodes - name: Start rabbit nodes
service: service:
name: rabbitmq-server name: rabbitmq-server
state: started state: started
tags:
- "install"
- "install:app-configuration"
- name: Wait for rabbit to start - name: Wait for rabbit to start
wait_for: wait_for:
port: "{{ rabbitmq_management_port }}" port: "{{ rabbitmq_management_port }}"
delay: 2 delay: 2
tags:
- "install"
- "install:app-configuration"
- name: Remove guest user - name: Remove guest user
rabbitmq_user: rabbitmq_user:
...@@ -188,6 +245,8 @@ ...@@ -188,6 +245,8 @@
tags: tags:
- users - users
- maintenance - maintenance
- "manage"
- "manage:app-users"
- name: Add vhosts - name: Add vhosts
rabbitmq_vhost: rabbitmq_vhost:
...@@ -197,6 +256,8 @@ ...@@ -197,6 +256,8 @@
tags: tags:
- vhosts - vhosts
- maintenance - maintenance
- "install"
- "install:app-configuration"
- name: Add admin users - name: Add admin users
rabbitmq_user: rabbitmq_user:
...@@ -215,6 +276,8 @@ ...@@ -215,6 +276,8 @@
tags: tags:
- users - users
- maintenance - maintenance
- "manage"
- "manage:app-users"
- name: Make queues mirrored - name: Make queues mirrored
rabbitmq_policy: rabbitmq_policy:
...@@ -230,6 +293,8 @@ ...@@ -230,6 +293,8 @@
tags: tags:
- ha - ha
- maintenance - maintenance
- "install"
- "install:app-configuration"
# #
# Depends upon the management plugin # Depends upon the management plugin
...@@ -238,6 +303,16 @@ ...@@ -238,6 +303,16 @@
get_url: get_url:
url: "http://localhost:{{ rabbitmq_management_port }}/cli/rabbitmqadmin" url: "http://localhost:{{ rabbitmq_management_port }}/cli/rabbitmqadmin"
dest: "/usr/local/bin/rabbitmqadmin" dest: "/usr/local/bin/rabbitmqadmin"
tags:
- "install"
- "install:app-configuration"
- name: Ensure rabbitmqadmin attributes
file:
path: "/usr/local/bin/rabbitmqadmin"
owner: root owner: root
group: root group: root
mode: "0655" 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