Added a common tag to the common tasks

This change adds a tag to all of the common tasks which may be useful
in situations where only these common tasks may need to be rerun.

Example scenario:
  RabbitMQ has failed and was re-built, in order to recreate the
  rabbitmq vhosts the user can now use the "common-rabbitmq" tag
  to recovery the cluster.

Change-Id: I973d2f5269e911256825249f86dc2985790e6880
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2017-03-02 10:04:06 -06:00
parent 2b3ad52ff6
commit d7c57113b1
No known key found for this signature in database
GPG Key ID: 69FEFFC5E2D9273F
11 changed files with 64 additions and 1 deletions

View File

@ -37,6 +37,7 @@
{{ ansible_host }}
{%- endif -%}
tags:
- common-address
- always
# NOTE(cloudnull):
@ -46,4 +47,5 @@
- name: Set address fact
set_fact: "{{ network_address }}={{ _lookup_address }}"
tags:
- common-address
- always

View File

@ -20,3 +20,5 @@
with_items: "{{ groups[src_group] }}"
when:
- "{{ groups[src_group] is defined }}"
tags:
- common-grouping

View File

@ -26,3 +26,5 @@
weight: "{{ haproxy_weight | default(omit) }}"
delegate_to: "{{ item }}"
with_items: "{{ groups['haproxy'] }}"
tags:
- common-haproxy

View File

@ -21,6 +21,8 @@
name: "{{ db_name }}"
state: "present"
delegate_to: "{{ groups['galera_all'][0] }}"
tags:
- common-mysql
- name: Grant access to the DB for the service
mysql_user:
@ -35,3 +37,5 @@
append_privs: "{{ db_append_privs | default(omit) }}"
delegate_to: "{{ groups['galera_all'][0] }}"
with_items: "{{ grant_list | default(['localhost', '%']) }}"
tags:
- common-mysql

View File

@ -29,6 +29,8 @@
state: directory
with_items: "{{ log_dirs }}"
when: is_metal | bool
tags:
- common-log
- name: Create log aggregation links
file:
@ -40,3 +42,5 @@
force: "yes"
with_items: "{{ log_dirs }}"
when: is_metal | bool
tags:
- common-log

View File

@ -32,6 +32,8 @@
lxc_default_bind_mounts: '{{ lxc_default_bind_mounts | default([{"bind_dir_path": "/var/log", "mount_path": "/openstack/log/{{ inventory_hostname }}"}]) }}'
when:
- default_bind_mount_logs | bool
tags:
- common-lxc
- name: Ensure mount directories exists
file:
@ -43,6 +45,8 @@
delegate_to: "{{ physical_host }}"
when:
- not is_metal | bool
tags:
- common-lxc
- name: Add bind mount configuration to container
lineinfile:
@ -56,6 +60,8 @@
when:
- not is_metal | bool
register: _mc
tags:
- common-lxc
- name: Extra lxc config
lineinfile:
@ -67,6 +73,8 @@
delegate_to: "{{ physical_host }}"
register: _ec
when: not is_metal | bool
tags:
- common-lxc
- name: Extra lxc config no restart
lineinfile:
@ -77,6 +85,8 @@
with_items: "{{ extra_container_config_no_restart | default([]) }}"
delegate_to: "{{ physical_host }}"
when: not is_metal | bool
tags:
- common-lxc
# Due to https://github.com/ansible/ansible-modules-extras/issues/2691
# this uses the LXC CLI tools to ensure that we get logging.
@ -93,6 +103,8 @@
when:
- not is_metal | bool
- (_mc is defined and _mc | changed) or (_ec is defined and _ec | changed)
tags:
- common-lxc
# Due to https://github.com/ansible/ansible-modules-extras/issues/2691
# this uses the LXC CLI tools to ensure that we get logging.
@ -109,6 +121,8 @@
when:
- not is_metal | bool
- (_mc is defined and _mc | changed) or (_ec is defined and _ec | changed)
tags:
- common-lxc
- name: Wait for container ssh
wait_for:
@ -123,3 +137,5 @@
when:
- (_mc is defined and _mc | changed) or (_ec is defined and _ec | changed)
- not is_metal | bool
tags:
- common-lxc

View File

@ -19,6 +19,8 @@
method: "HEAD"
register: proxy_check
failed_when: false
tags:
- common-proxy
- name: Drop apt package manager proxy
copy:
@ -29,6 +31,8 @@
- proxy_check.status == 200
- ansible_os_family == 'Debian'
- repo_pkg_cache_enabled | bool
tags:
- common-proxy
- name: Update apt when proxy is added
apt:
@ -37,6 +41,8 @@
delay: 2
when:
- apt_proxy_dropped | changed
tags:
- common-proxy
- name: Remove apt package manager proxy
file:
@ -46,6 +52,8 @@
- proxy_check.status != 200
- ansible_os_family == 'Debian'
- repo_pkg_cache_enabled | bool
tags:
- common-proxy
- name: Drop yum package manager proxy
lineinfile:
@ -55,4 +63,5 @@
when:
- ansible_os_family == 'RedHat'
- repo_pkg_cache_enabled | bool
tags:
- common-proxy

View File

@ -23,6 +23,8 @@
name: "{{ vhost }}"
state: "present"
delegate_to: "{{ groups[_rabbitmq_host_group][0] }}"
tags:
- common-rabbitmq
- name: Ensure rabbitmq user
rabbitmq_user:
@ -34,3 +36,6 @@
write_priv: ".*"
state: "present"
delegate_to: "{{ groups[_rabbitmq_host_group][0] }}"
tags:
- common-rabbitmq

View File

@ -24,6 +24,8 @@
register: _repo_data_check
failed_when: false
when: pip_upstream_url != "https://bootstrap.pypa.io/get-pip.py"
tags:
- common-pip
- name: Set pip upstream URL
set_fact:
@ -31,3 +33,5 @@
when:
- pip_upstream_url != "https://bootstrap.pypa.io/get-pip.py"
- (_repo_data_check.status | default(503)) != 200
tags:
- common-pip

View File

@ -24,24 +24,32 @@
method: "HEAD"
register: upper_constraints_check
failed_when: false
tags:
- common-constraints
- name: Remove global requirement pins file from host
file:
path: "/opt/global-requirement-pins.txt"
state: absent
when: (upper_constraints_check.status | default(503)) == 200
tags:
- common-constraints
- name: Copy global requirement pins file to host
copy:
src: "../global-requirement-pins.txt"
dest: "/opt/global-requirement-pins.txt"
when: (upper_constraints_check.status | default(503)) != 200
tags:
- common-constraints
# Use https when Python with native SNI support is available
- name: Set pip install upper constraints protocol
set_fact:
pip_install_upper_constraints_proto: "{{ ansible_python_version | version_compare('2.7.9', '>=') | ternary('https','http') }}"
when: (upper_constraints_check.status | default(503)) != 200
tags:
- common-constraints
- name: Set pip install upper constraints
set_fact:
@ -49,3 +57,5 @@
/opt/global-requirement-pins.txt
--constraint {{ pip_install_upper_constraints_proto }}://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?id={{ requirements_git_install_branch | regex_replace(' #.*$','') }}
when: (upper_constraints_check.status | default(503)) != 200
tags:
- common-constraints

View File

@ -0,0 +1,5 @@
---
features:
- Tags have been added to all of the common tags with the prefix "common-".
This has been done to allow a deployer to rapidly run any of the common
on a need basis without having to rerun an entire playbook.