From d7c57113b1660693dd47d47bfd807510d634383a Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 2 Mar 2017 10:04:06 -0600 Subject: [PATCH] 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 --- playbooks/common-tasks/dynamic-address-fact.yml | 2 ++ playbooks/common-tasks/dynamic-grouping.yml | 2 ++ .../common-tasks/haproxy-endpoint-manage.yml | 2 ++ playbooks/common-tasks/mysql-db-user.yml | 4 ++++ playbooks/common-tasks/os-log-dir-setup.yml | 4 ++++ .../common-tasks/os-lxc-container-setup.yml | 16 ++++++++++++++++ playbooks/common-tasks/package-cache-proxy.yml | 11 ++++++++++- playbooks/common-tasks/rabbitmq-vhost-user.yml | 5 +++++ playbooks/common-tasks/set-pip-upstream-url.yml | 4 ++++ playbooks/common-tasks/set-upper-constraints.yml | 10 ++++++++++ .../notes/common-tags-9763f578ea5fe5b6.yaml | 5 +++++ 11 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/common-tags-9763f578ea5fe5b6.yaml diff --git a/playbooks/common-tasks/dynamic-address-fact.yml b/playbooks/common-tasks/dynamic-address-fact.yml index 8a5a50d483..33007fc87e 100644 --- a/playbooks/common-tasks/dynamic-address-fact.yml +++ b/playbooks/common-tasks/dynamic-address-fact.yml @@ -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 diff --git a/playbooks/common-tasks/dynamic-grouping.yml b/playbooks/common-tasks/dynamic-grouping.yml index 7f6c43bb2a..206042b6ec 100644 --- a/playbooks/common-tasks/dynamic-grouping.yml +++ b/playbooks/common-tasks/dynamic-grouping.yml @@ -20,3 +20,5 @@ with_items: "{{ groups[src_group] }}" when: - "{{ groups[src_group] is defined }}" + tags: + - common-grouping diff --git a/playbooks/common-tasks/haproxy-endpoint-manage.yml b/playbooks/common-tasks/haproxy-endpoint-manage.yml index b88e66e305..95143a7536 100644 --- a/playbooks/common-tasks/haproxy-endpoint-manage.yml +++ b/playbooks/common-tasks/haproxy-endpoint-manage.yml @@ -26,3 +26,5 @@ weight: "{{ haproxy_weight | default(omit) }}" delegate_to: "{{ item }}" with_items: "{{ groups['haproxy'] }}" + tags: + - common-haproxy diff --git a/playbooks/common-tasks/mysql-db-user.yml b/playbooks/common-tasks/mysql-db-user.yml index d453e66651..237140f347 100644 --- a/playbooks/common-tasks/mysql-db-user.yml +++ b/playbooks/common-tasks/mysql-db-user.yml @@ -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 diff --git a/playbooks/common-tasks/os-log-dir-setup.yml b/playbooks/common-tasks/os-log-dir-setup.yml index f392ce14b7..4065c4a166 100644 --- a/playbooks/common-tasks/os-log-dir-setup.yml +++ b/playbooks/common-tasks/os-log-dir-setup.yml @@ -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 diff --git a/playbooks/common-tasks/os-lxc-container-setup.yml b/playbooks/common-tasks/os-lxc-container-setup.yml index aed672eafe..2c05b23d5b 100644 --- a/playbooks/common-tasks/os-lxc-container-setup.yml +++ b/playbooks/common-tasks/os-lxc-container-setup.yml @@ -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 diff --git a/playbooks/common-tasks/package-cache-proxy.yml b/playbooks/common-tasks/package-cache-proxy.yml index f8c468ca16..b943624d5a 100644 --- a/playbooks/common-tasks/package-cache-proxy.yml +++ b/playbooks/common-tasks/package-cache-proxy.yml @@ -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 diff --git a/playbooks/common-tasks/rabbitmq-vhost-user.yml b/playbooks/common-tasks/rabbitmq-vhost-user.yml index 357f9ba7ab..86e2b38710 100644 --- a/playbooks/common-tasks/rabbitmq-vhost-user.yml +++ b/playbooks/common-tasks/rabbitmq-vhost-user.yml @@ -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 + diff --git a/playbooks/common-tasks/set-pip-upstream-url.yml b/playbooks/common-tasks/set-pip-upstream-url.yml index 04c9b49a1a..1fde835fcc 100644 --- a/playbooks/common-tasks/set-pip-upstream-url.yml +++ b/playbooks/common-tasks/set-pip-upstream-url.yml @@ -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 diff --git a/playbooks/common-tasks/set-upper-constraints.yml b/playbooks/common-tasks/set-upper-constraints.yml index 329b8f869c..c039e29887 100644 --- a/playbooks/common-tasks/set-upper-constraints.yml +++ b/playbooks/common-tasks/set-upper-constraints.yml @@ -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 diff --git a/releasenotes/notes/common-tags-9763f578ea5fe5b6.yaml b/releasenotes/notes/common-tags-9763f578ea5fe5b6.yaml new file mode 100644 index 0000000000..ba30476e57 --- /dev/null +++ b/releasenotes/notes/common-tags-9763f578ea5fe5b6.yaml @@ -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.