Cleanup/standardize usage of tags

The numerous tags within the role have been condensed
to two tags: horizon-install and horizon-config

These tags have been chosen as they are namespaced
and cover the two major functions of the role.

Documentation has been updated to inform how each tag
influences the function of the role.

Change-Id: I02e5ee7c2975325bfa479f23ae1001095f664dcb
This commit is contained in:
Travis Truman 2016-07-11 12:04:29 -04:00
parent 30f0d599f7
commit 605f1765c9
13 changed files with 30 additions and 134 deletions

View File

@ -65,3 +65,12 @@ Example Playbook
openrc_os_domain_name: "Default" openrc_os_domain_name: "Default"
memcached_servers: 10.100.100.101 memcached_servers: 10.100.100.101
memcached_encryption_key: "secrete" memcached_encryption_key: "secrete"
Tags
====
This role supports two tags: ``horizon-install`` and ``horizon-config``
The ``horizon-install`` tag can be used to install and upgrade.
The ``horizon-config`` tag can be used to manage configuration.

View File

@ -23,10 +23,6 @@
- { src: "horizon_apache_ports.conf.j2", dest: "/etc/apache2/ports.conf", owner: "root", group: "root" } - { src: "horizon_apache_ports.conf.j2", dest: "/etc/apache2/ports.conf", owner: "root", group: "root" }
- { src: "openstack_dashboard.conf.j2", dest: "/etc/apache2/sites-available/openstack-dashboard.conf" } - { src: "openstack_dashboard.conf.j2", dest: "/etc/apache2/sites-available/openstack-dashboard.conf" }
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-apache-config
- horizon-apache-ports
- horizon-apache-vhost
- name: Enable Horizon Site - name: Enable Horizon Site
file: file:
@ -37,9 +33,6 @@
- { state: link, name: openstack-dashboard.conf } - { state: link, name: openstack-dashboard.conf }
- { state: absent, name: 000-default.conf } - { state: absent, name: 000-default.conf }
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-apache-config
- horizon-apache-sites-enabled
- name: Enable apache2 modules - name: Enable apache2 modules
apache2_module: apache2_module:
@ -53,17 +46,12 @@
- { state: present, name: rewrite } - { state: present, name: rewrite }
- { state: present, name: headers } - { state: present, name: headers }
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-apache-config
- horizon-apache-modules
- name: Ensure Apache ServerName - name: Ensure Apache ServerName
lineinfile: lineinfile:
dest: "/etc/apache2/apache2.conf" dest: "/etc/apache2/apache2.conf"
line: "ServerName {{ horizon_server_name }}" line: "ServerName {{ horizon_server_name }}"
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-apache-config
- name: Ensure Apache ServerTokens - name: Ensure Apache ServerTokens
lineinfile: lineinfile:
@ -71,8 +59,6 @@
regexp: '^ServerTokens' regexp: '^ServerTokens'
line: "ServerTokens {{ horizon_apache_servertokens }}" line: "ServerTokens {{ horizon_apache_servertokens }}"
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-apache-config
- name: Ensure Apache ServerSignature - name: Ensure Apache ServerSignature
lineinfile: lineinfile:
@ -80,5 +66,3 @@
regexp: '^ServerSignature' regexp: '^ServerSignature'
line: "ServerSignature {{ horizon_apache_serversignature }}" line: "ServerSignature {{ horizon_apache_serversignature }}"
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-apache-config

View File

@ -17,11 +17,6 @@
command: "{{ horizon_bin }}/horizon-manage.py syncdb --noinput" command: "{{ horizon_bin }}/horizon-manage.py syncdb --noinput"
become: yes become: yes
become_user: "{{ horizon_system_user_name }}" become_user: "{{ horizon_system_user_name }}"
tags:
- horizon-db-setup
- horizon-db-sync
- horizon-setup
- horizon-command-bin
- name: Register DB session cleanup cron - name: Register DB session cleanup cron
cron: cron:
@ -31,5 +26,3 @@
job: "{{ horizon_bin }}/horizon-manage.py clearsessions" job: "{{ horizon_bin }}/horizon-manage.py clearsessions"
user: "{{ horizon_system_user_name }}" user: "{{ horizon_system_user_name }}"
state: present state: present
tags:
- horizon-db-setup

View File

@ -16,8 +16,6 @@
- include: install-apt.yml - include: install-apt.yml
when: when:
- ansible_pkg_mgr == 'apt' - ansible_pkg_mgr == 'apt'
tags:
- install-apt
- name: Create developer mode constraint file - name: Create developer mode constraint file
copy: copy:
@ -28,9 +26,6 @@
{% endfor %} {% endfor %}
when: when:
- horizon_developer_mode | bool - horizon_developer_mode | bool
tags:
- horizon-install
- horizon-pip-packages
- name: Clone requirements git repository - name: Clone requirements git repository
git: git:
@ -41,27 +36,18 @@
version: "{{ horizon_requirements_git_install_branch }}" version: "{{ horizon_requirements_git_install_branch }}"
when: when:
- horizon_developer_mode | bool - horizon_developer_mode | bool
tags:
- horizon-install
- horizon-pip-packages
- name: Add constraints to pip_install_options fact for developer mode - name: Add constraints to pip_install_options fact for developer mode
set_fact: set_fact:
pip_install_options_fact: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt --constraint /opt/requirements/upper-constraints.txt" pip_install_options_fact: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt --constraint /opt/requirements/upper-constraints.txt"
when: when:
- horizon_developer_mode | bool - horizon_developer_mode | bool
tags:
- horizon-install
- horizon-pip-packages
- name: Set pip_install_options_fact when not in developer mode - name: Set pip_install_options_fact when not in developer mode
set_fact: set_fact:
pip_install_options_fact: "{{ pip_install_options|default('') }}" pip_install_options_fact: "{{ pip_install_options|default('') }}"
when: when:
- not horizon_developer_mode | bool - not horizon_developer_mode | bool
tags:
- horizon-install
- horizon-pip-packages
- name: Install requires pip packages - name: Install requires pip packages
pip: pip:
@ -73,8 +59,6 @@
retries: 5 retries: 5
delay: 2 delay: 2
with_items: "{{ horizon_requires_pip_packages }}" with_items: "{{ horizon_requires_pip_packages }}"
tags:
- horizon-pip-packages
- name: Get local venv checksum - name: Get local venv checksum
stat: stat:
@ -83,9 +67,6 @@
when: when:
- not horizon_developer_mode | bool - not horizon_developer_mode | bool
register: local_venv_stat register: local_venv_stat
tags:
- horizon-install
- horizon-pip-packages
- name: Get remote venv checksum - name: Get remote venv checksum
uri: uri:
@ -94,9 +75,6 @@
when: when:
- not horizon_developer_mode | bool - not horizon_developer_mode | bool
register: remote_venv_checksum register: remote_venv_checksum
tags:
- horizon-install
- horizon-pip-packages
# TODO: When project moves to ansible 2 we can pass this a sha256sum which will: # TODO: When project moves to ansible 2 we can pass this a sha256sum which will:
# a) allow us to remove force: yes # a) allow us to remove force: yes
@ -114,16 +92,10 @@
- not horizon_developer_mode | bool - not horizon_developer_mode | bool
- (local_venv_stat.stat.exists == False or - (local_venv_stat.stat.exists == False or
{{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }}) {{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }})
tags:
- horizon-install
- horizon-pip-packages
- name: Set horizon get_venv fact - name: Set horizon get_venv fact
set_fact: set_fact:
horizon_get_venv: "{{ get_venv }}" horizon_get_venv: "{{ get_venv }}"
tags:
- horizon-install
- horizon-pip-packages
- name: Remove existing venv - name: Remove existing venv
file: file:
@ -131,9 +103,6 @@
state: absent state: absent
when: when:
- horizon_get_venv | changed - horizon_get_venv | changed
tags:
- horizon-install
- horizon-pip-packages
- name: Create horizon venv dir - name: Create horizon venv dir
file: file:
@ -143,9 +112,6 @@
when: when:
- not horizon_developer_mode | bool - not horizon_developer_mode | bool
- horizon_get_venv | changed - horizon_get_venv | changed
tags:
- horizon-install
- horizon-pip-packages
- name: Unarchive pre-built venv - name: Unarchive pre-built venv
unarchive: unarchive:
@ -156,9 +122,6 @@
- not horizon_developer_mode | bool - not horizon_developer_mode | bool
- horizon_get_venv | changed or horizon_venv_dir | changed - horizon_get_venv | changed or horizon_venv_dir | changed
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-install
- horizon-pip-packages
- name: Install pip packages - name: Install pip packages
pip: pip:
@ -175,8 +138,6 @@
when: when:
- horizon_get_venv | failed or horizon_developer_mode | bool - horizon_get_venv | failed or horizon_developer_mode | bool
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-pip-packages
- name: Update virtualenv path - name: Update virtualenv path
command: > command: >
@ -184,9 +145,6 @@
when: when:
- not horizon_developer_mode | bool - not horizon_developer_mode | bool
- horizon_get_venv | success - horizon_get_venv | success
tags:
- horizon-install
- horizon-pip-packages
- name: Create horizon link for venv - name: Create horizon link for venv
file: file:
@ -195,9 +153,6 @@
owner: "{{ horizon_system_user_name }}" owner: "{{ horizon_system_user_name }}"
group: "{{ horizon_system_group_name }}" group: "{{ horizon_system_group_name }}"
state: "link" state: "link"
tags:
- horizon-install
- horizon-configs
- name: Create static horizon dir - name: Create static horizon dir
file: file:
@ -210,5 +165,3 @@
- { path: "{{ horizon_lib_dir }}/openstack_dashboard", mode: "2755" } - { path: "{{ horizon_lib_dir }}/openstack_dashboard", mode: "2755" }
- { path: "{{ horizon_lib_dir }}/openstack_dashboard/local", mode: "2755" } - { path: "{{ horizon_lib_dir }}/openstack_dashboard/local", mode: "2755" }
- { path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled", mode: "2755" } - { path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled", mode: "2755" }
tags:
- horizon-dirs

View File

@ -25,17 +25,12 @@
- { src: "horizon-manage.py.j2", dest: "{{ horizon_bin }}/horizon-manage.py", mode: "0755" } - { src: "horizon-manage.py.j2", dest: "{{ horizon_bin }}/horizon-manage.py", mode: "0755" }
- { src: "80_admin_default_panel.py.j2", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled/_80_admin_default_panel.py", mode: "0755" } - { src: "80_admin_default_panel.py.j2", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled/_80_admin_default_panel.py", mode: "0755" }
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-configs
- horizon-branding
- name: Uploading horizon custom files - name: Uploading horizon custom files
copy: copy:
src: "{{ item.value.src }}" src: "{{ item.value.src }}"
dest: "{{ horizon_lib_dir }}/openstack_dashboard/static/dashboard/{{ item.value.dest }}" dest: "{{ horizon_lib_dir }}/openstack_dashboard/static/dashboard/{{ item.value.dest }}"
with_dict: "{{ horizon_custom_uploads | default({}) }}" with_dict: "{{ horizon_custom_uploads | default({}) }}"
tags:
- horizon-branding
- name: Enable the neutron-lbaas-dashboard Horizon panel - name: Enable the neutron-lbaas-dashboard Horizon panel
file: file:
@ -43,8 +38,6 @@
path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py" path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py"
state: "{{ (horizon_enable_neutron_lbaas | bool) | ternary('link', 'absent') }}" state: "{{ (horizon_enable_neutron_lbaas | bool) | ternary('link', 'absent') }}"
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-configs
- name: Create horizon links - name: Create horizon links
file: file:
@ -55,8 +48,6 @@
state: "link" state: "link"
with_items: with_items:
- { src: "/etc/horizon/local_settings.py", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.py" } - { src: "/etc/horizon/local_settings.py", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.py" }
tags:
- horizon-configs
- name: Setup Horizon config(s) - name: Setup Horizon config(s)
template: template:
@ -67,9 +58,6 @@
with_items: with_items:
- { src: "horizon_django.wsgi.j2", dest: "{{ horizon_lib_wsgi_file }}" } - { src: "horizon_django.wsgi.j2", dest: "{{ horizon_lib_wsgi_file }}" }
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-configs
- horizon-wsgi-venv
- name: Create customization module directory - name: Create customization module directory
file: file:
@ -79,8 +67,6 @@
group: "{{ horizon_system_group_name }}" group: "{{ horizon_system_group_name }}"
mode: "0755" mode: "0755"
when: horizon_customization_module is defined when: horizon_customization_module is defined
tags:
- horizon-configs
- name: Drop horizon customization module - name: Drop horizon customization module
template: template:
@ -91,8 +77,6 @@
mode: "0644" mode: "0644"
notify: Restart apache2 notify: Restart apache2
when: horizon_customization_module is defined when: horizon_customization_module is defined
tags:
- horizon-configs
- name: Collect and compress static files - name: Collect and compress static files
command: "{{ item }}" command: "{{ item }}"
@ -102,7 +86,3 @@
- "{{ horizon_bin }}/horizon-manage.py collectstatic --noinput" - "{{ horizon_bin }}/horizon-manage.py collectstatic --noinput"
- "{{ horizon_bin }}/horizon-manage.py compress --force" - "{{ horizon_bin }}/horizon-manage.py compress --force"
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-configs
- horizon-static-collect
- horizon-command-bin

View File

@ -18,8 +18,6 @@
name: "{{ horizon_system_group_name }}" name: "{{ horizon_system_group_name }}"
state: "present" state: "present"
system: "yes" system: "yes"
tags:
- horizon-group
- name: Create the horizon system user - name: Create the horizon system user
user: user:
@ -30,8 +28,6 @@
system: "yes" system: "yes"
createhome: "yes" createhome: "yes"
home: "{{ horizon_system_user_home }}" home: "{{ horizon_system_user_home }}"
tags:
- horizon-user
- name: Create horizon dir - name: Create horizon dir
file: file:
@ -43,8 +39,6 @@
- { path: "/openstack", mode: "0755", owner: "root", group: "root" } - { path: "/openstack", mode: "0755", owner: "root", group: "root" }
- { path: "/etc/horizon", mode: "2755" } - { path: "/etc/horizon", mode: "2755" }
- { path: "{{ horizon_system_user_home }}", mode: "2755" } - { path: "{{ horizon_system_user_home }}", mode: "2755" }
tags:
- horizon-dirs
- name: Test for log directory or link - name: Test for log directory or link
shell: | shell: |
@ -57,9 +51,6 @@
register: log_dir register: log_dir
failed_when: false failed_when: false
changed_when: log_dir.rc != 0 changed_when: log_dir.rc != 0
tags:
- horizon-dirs
- horizon-logs
- name: Create horizon log dir - name: Create horizon log dir
file: file:
@ -71,6 +62,3 @@
with_items: with_items:
- { path: "/var/log/horizon" } - { path: "/var/log/horizon" }
when: log_dir.rc != 0 when: log_dir.rc != 0
tags:
- horizon-dirs
- horizon-logs

View File

@ -34,5 +34,3 @@
until: add_member_role|success until: add_member_role|success
retries: 5 retries: 5
delay: 10 delay: 10
tags:
- horizon-member-config

View File

@ -18,8 +18,6 @@
dest: "{{ horizon_ssl_cert }}" dest: "{{ horizon_ssl_cert }}"
state: "absent" state: "absent"
when: horizon_ssl_self_signed_regen | bool when: horizon_ssl_self_signed_regen | bool
tags:
- horizon-ssl
- name: Create self-signed ssl cert - name: Create self-signed ssl cert
command: > command: >
@ -31,5 +29,3 @@
-extensions v3_ca -extensions v3_ca
creates={{ horizon_ssl_cert }} creates={{ horizon_ssl_cert }}
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-ssl

View File

@ -20,8 +20,6 @@
owner: "{{ horizon_system_user_name }}" owner: "{{ horizon_system_user_name }}"
group: "{{ horizon_system_group_name }}" group: "{{ horizon_system_group_name }}"
mode: "0640" mode: "0640"
tags:
- horizon-ssl
- name: Distribute self signed ssl cert - name: Distribute self signed ssl cert
copy: copy:
@ -30,5 +28,3 @@
owner: "{{ horizon_system_user_name }}" owner: "{{ horizon_system_user_name }}"
group: "{{ horizon_system_group_name }}" group: "{{ horizon_system_group_name }}"
mode: "0640" mode: "0640"
tags:
- horizon-ssl

View File

@ -18,20 +18,14 @@
src: "{{ horizon_ssl_cert }}" src: "{{ horizon_ssl_cert }}"
register: _horizon_ssl_cert register: _horizon_ssl_cert
changed_when: false changed_when: false
tags:
- horizon-ssl
- name: Store ssl key - name: Store ssl key
slurp: slurp:
src: "{{ horizon_ssl_key }}" src: "{{ horizon_ssl_key }}"
register: _horizon_ssl_key register: _horizon_ssl_key
changed_when: false changed_when: false
tags:
- horizon-ssl
- name: Register a fact for the cert and key - name: Register a fact for the cert and key
set_fact: set_fact:
horizon_ssl_cert_fact: "{{ _horizon_ssl_cert.content }}" horizon_ssl_cert_fact: "{{ _horizon_ssl_cert.content }}"
horizon_ssl_key_fact: "{{ _horizon_ssl_key.content }}" horizon_ssl_key_fact: "{{ _horizon_ssl_key.content }}"
tags:
- horizon-ssl

View File

@ -22,9 +22,6 @@
mode: "0644" mode: "0644"
when: horizon_user_ssl_cert is defined when: horizon_user_ssl_cert is defined
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-configs
- horizon-ssl
- name: Drop user provided ssl key - name: Drop user provided ssl key
copy: copy:
@ -35,9 +32,6 @@
mode: "0640" mode: "0640"
when: horizon_user_ssl_key is defined when: horizon_user_ssl_key is defined
notify: Restart apache2 notify: Restart apache2
tags:
- horizon-configs
- horizon-ssl
- name: Drop user provided ssl CA cert - name: Drop user provided ssl CA cert
copy: copy:
@ -48,6 +42,3 @@
mode: "0644" mode: "0644"
when: horizon_user_ssl_ca_cert is defined when: horizon_user_ssl_ca_cert is defined
notify: Restart apache2 notify: Restart apache2
tags:
- keystone-configs
- keystone-ssl

View File

@ -20,15 +20,11 @@
stat: stat:
path: /var/cache/apt path: /var/cache/apt
register: apt_cache_stat register: apt_cache_stat
tags:
- horizon-apt-packages
- name: Update apt if needed - name: Update apt if needed
apt: apt:
update_cache: yes update_cache: yes
when: "ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" when: "ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}"
tags:
- horizon-apt-packages
- name: Install apt packages - name: Install apt packages
apt: apt:
@ -39,6 +35,3 @@
retries: 5 retries: 5
delay: 2 delay: 2
with_items: "{{ horizon_apt_packages }}" with_items: "{{ horizon_apt_packages }}"
tags:
- horizon-install
- horizon-apt-packages

View File

@ -25,24 +25,45 @@
- always - always
- include: horizon_pre_install.yml - include: horizon_pre_install.yml
tags:
- horizon-install
- include: horizon_install.yml - include: horizon_install.yml
tags:
- horizon-install
- include: horizon_post_install.yml - include: horizon_post_install.yml
tags:
- horizon-install
- horizon-config
- include: horizon_db_setup.yml - include: horizon_db_setup.yml
when: > when: >
inventory_hostname == groups['horizon_all'][0] inventory_hostname == groups['horizon_all'][0]
tags:
- horizon-install
- include: horizon_ssl_self_signed.yml - include: horizon_ssl_self_signed.yml
when: when:
- not horizon_external_ssl|bool - not horizon_external_ssl|bool
- horizon_user_ssl_cert is not defined or horizon_user_ssl_key is not defined - horizon_user_ssl_cert is not defined or horizon_user_ssl_key is not defined
tags:
- horizon-install
- include: horizon_ssl_user_provided.yml - include: horizon_ssl_user_provided.yml
when: not horizon_external_ssl|bool when: not horizon_external_ssl|bool
tags:
- horizon-install
- horizon-config
- include: horizon_service_setup.yml - include: horizon_service_setup.yml
tags:
- horizon-install
- include: horizon_apache.yml - include: horizon_apache.yml
tags:
- horizon-install
- horizon-config
- name: Flush handlers - name: Flush handlers
meta: flush_handlers meta: flush_handlers