From 605f1765c9675c1a76bc09fd9abada51c7c465c1 Mon Sep 17 00:00:00 2001 From: Travis Truman Date: Mon, 11 Jul 2016 12:04:29 -0400 Subject: [PATCH] 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 --- README.rst | 9 ++++++ tasks/horizon_apache.yml | 16 ---------- tasks/horizon_db_setup.yml | 7 ----- tasks/horizon_install.yml | 47 ---------------------------- tasks/horizon_post_install.yml | 20 ------------ tasks/horizon_pre_install.yml | 12 ------- tasks/horizon_service_setup.yml | 2 -- tasks/horizon_ssl_key_create.yml | 4 --- tasks/horizon_ssl_key_distribute.yml | 4 --- tasks/horizon_ssl_key_store.yml | 6 ---- tasks/horizon_ssl_user_provided.yml | 9 ------ tasks/install-apt.yml | 7 ----- tasks/main.yml | 21 +++++++++++++ 13 files changed, 30 insertions(+), 134 deletions(-) diff --git a/README.rst b/README.rst index 6ff0c590..53c4f5d0 100644 --- a/README.rst +++ b/README.rst @@ -65,3 +65,12 @@ Example Playbook openrc_os_domain_name: "Default" memcached_servers: 10.100.100.101 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. diff --git a/tasks/horizon_apache.yml b/tasks/horizon_apache.yml index a8e8e889..81e05eb6 100644 --- a/tasks/horizon_apache.yml +++ b/tasks/horizon_apache.yml @@ -23,10 +23,6 @@ - { 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" } notify: Restart apache2 - tags: - - horizon-apache-config - - horizon-apache-ports - - horizon-apache-vhost - name: Enable Horizon Site file: @@ -37,9 +33,6 @@ - { state: link, name: openstack-dashboard.conf } - { state: absent, name: 000-default.conf } notify: Restart apache2 - tags: - - horizon-apache-config - - horizon-apache-sites-enabled - name: Enable apache2 modules apache2_module: @@ -53,17 +46,12 @@ - { state: present, name: rewrite } - { state: present, name: headers } notify: Restart apache2 - tags: - - horizon-apache-config - - horizon-apache-modules - name: Ensure Apache ServerName lineinfile: dest: "/etc/apache2/apache2.conf" line: "ServerName {{ horizon_server_name }}" notify: Restart apache2 - tags: - - horizon-apache-config - name: Ensure Apache ServerTokens lineinfile: @@ -71,8 +59,6 @@ regexp: '^ServerTokens' line: "ServerTokens {{ horizon_apache_servertokens }}" notify: Restart apache2 - tags: - - horizon-apache-config - name: Ensure Apache ServerSignature lineinfile: @@ -80,5 +66,3 @@ regexp: '^ServerSignature' line: "ServerSignature {{ horizon_apache_serversignature }}" notify: Restart apache2 - tags: - - horizon-apache-config diff --git a/tasks/horizon_db_setup.yml b/tasks/horizon_db_setup.yml index bac738fa..388b9a7c 100644 --- a/tasks/horizon_db_setup.yml +++ b/tasks/horizon_db_setup.yml @@ -17,11 +17,6 @@ command: "{{ horizon_bin }}/horizon-manage.py syncdb --noinput" become: yes become_user: "{{ horizon_system_user_name }}" - tags: - - horizon-db-setup - - horizon-db-sync - - horizon-setup - - horizon-command-bin - name: Register DB session cleanup cron cron: @@ -31,5 +26,3 @@ job: "{{ horizon_bin }}/horizon-manage.py clearsessions" user: "{{ horizon_system_user_name }}" state: present - tags: - - horizon-db-setup diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml index ab59d0fc..dafeeb3f 100644 --- a/tasks/horizon_install.yml +++ b/tasks/horizon_install.yml @@ -16,8 +16,6 @@ - include: install-apt.yml when: - ansible_pkg_mgr == 'apt' - tags: - - install-apt - name: Create developer mode constraint file copy: @@ -28,9 +26,6 @@ {% endfor %} when: - horizon_developer_mode | bool - tags: - - horizon-install - - horizon-pip-packages - name: Clone requirements git repository git: @@ -41,27 +36,18 @@ version: "{{ horizon_requirements_git_install_branch }}" when: - horizon_developer_mode | bool - tags: - - horizon-install - - horizon-pip-packages - name: Add constraints to pip_install_options fact for developer mode set_fact: pip_install_options_fact: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt --constraint /opt/requirements/upper-constraints.txt" when: - horizon_developer_mode | bool - tags: - - horizon-install - - horizon-pip-packages - name: Set pip_install_options_fact when not in developer mode set_fact: pip_install_options_fact: "{{ pip_install_options|default('') }}" when: - not horizon_developer_mode | bool - tags: - - horizon-install - - horizon-pip-packages - name: Install requires pip packages pip: @@ -73,8 +59,6 @@ retries: 5 delay: 2 with_items: "{{ horizon_requires_pip_packages }}" - tags: - - horizon-pip-packages - name: Get local venv checksum stat: @@ -83,9 +67,6 @@ when: - not horizon_developer_mode | bool register: local_venv_stat - tags: - - horizon-install - - horizon-pip-packages - name: Get remote venv checksum uri: @@ -94,9 +75,6 @@ when: - not horizon_developer_mode | bool 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: # a) allow us to remove force: yes @@ -114,16 +92,10 @@ - not horizon_developer_mode | bool - (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 }}) - tags: - - horizon-install - - horizon-pip-packages - name: Set horizon get_venv fact set_fact: horizon_get_venv: "{{ get_venv }}" - tags: - - horizon-install - - horizon-pip-packages - name: Remove existing venv file: @@ -131,9 +103,6 @@ state: absent when: - horizon_get_venv | changed - tags: - - horizon-install - - horizon-pip-packages - name: Create horizon venv dir file: @@ -143,9 +112,6 @@ when: - not horizon_developer_mode | bool - horizon_get_venv | changed - tags: - - horizon-install - - horizon-pip-packages - name: Unarchive pre-built venv unarchive: @@ -156,9 +122,6 @@ - not horizon_developer_mode | bool - horizon_get_venv | changed or horizon_venv_dir | changed notify: Restart apache2 - tags: - - horizon-install - - horizon-pip-packages - name: Install pip packages pip: @@ -175,8 +138,6 @@ when: - horizon_get_venv | failed or horizon_developer_mode | bool notify: Restart apache2 - tags: - - horizon-pip-packages - name: Update virtualenv path command: > @@ -184,9 +145,6 @@ when: - not horizon_developer_mode | bool - horizon_get_venv | success - tags: - - horizon-install - - horizon-pip-packages - name: Create horizon link for venv file: @@ -195,9 +153,6 @@ owner: "{{ horizon_system_user_name }}" group: "{{ horizon_system_group_name }}" state: "link" - tags: - - horizon-install - - horizon-configs - name: Create static horizon dir file: @@ -210,5 +165,3 @@ - { path: "{{ horizon_lib_dir }}/openstack_dashboard", mode: "2755" } - { path: "{{ horizon_lib_dir }}/openstack_dashboard/local", mode: "2755" } - { path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled", mode: "2755" } - tags: - - horizon-dirs diff --git a/tasks/horizon_post_install.yml b/tasks/horizon_post_install.yml index e7746d69..53b4528c 100644 --- a/tasks/horizon_post_install.yml +++ b/tasks/horizon_post_install.yml @@ -25,17 +25,12 @@ - { 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" } notify: Restart apache2 - tags: - - horizon-configs - - horizon-branding - name: Uploading horizon custom files copy: src: "{{ item.value.src }}" dest: "{{ horizon_lib_dir }}/openstack_dashboard/static/dashboard/{{ item.value.dest }}" with_dict: "{{ horizon_custom_uploads | default({}) }}" - tags: - - horizon-branding - name: Enable the neutron-lbaas-dashboard Horizon panel file: @@ -43,8 +38,6 @@ path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py" state: "{{ (horizon_enable_neutron_lbaas | bool) | ternary('link', 'absent') }}" notify: Restart apache2 - tags: - - horizon-configs - name: Create horizon links file: @@ -55,8 +48,6 @@ state: "link" with_items: - { src: "/etc/horizon/local_settings.py", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.py" } - tags: - - horizon-configs - name: Setup Horizon config(s) template: @@ -67,9 +58,6 @@ with_items: - { src: "horizon_django.wsgi.j2", dest: "{{ horizon_lib_wsgi_file }}" } notify: Restart apache2 - tags: - - horizon-configs - - horizon-wsgi-venv - name: Create customization module directory file: @@ -79,8 +67,6 @@ group: "{{ horizon_system_group_name }}" mode: "0755" when: horizon_customization_module is defined - tags: - - horizon-configs - name: Drop horizon customization module template: @@ -91,8 +77,6 @@ mode: "0644" notify: Restart apache2 when: horizon_customization_module is defined - tags: - - horizon-configs - name: Collect and compress static files command: "{{ item }}" @@ -102,7 +86,3 @@ - "{{ horizon_bin }}/horizon-manage.py collectstatic --noinput" - "{{ horizon_bin }}/horizon-manage.py compress --force" notify: Restart apache2 - tags: - - horizon-configs - - horizon-static-collect - - horizon-command-bin diff --git a/tasks/horizon_pre_install.yml b/tasks/horizon_pre_install.yml index bdaed6bf..2fe80c17 100644 --- a/tasks/horizon_pre_install.yml +++ b/tasks/horizon_pre_install.yml @@ -18,8 +18,6 @@ name: "{{ horizon_system_group_name }}" state: "present" system: "yes" - tags: - - horizon-group - name: Create the horizon system user user: @@ -30,8 +28,6 @@ system: "yes" createhome: "yes" home: "{{ horizon_system_user_home }}" - tags: - - horizon-user - name: Create horizon dir file: @@ -43,8 +39,6 @@ - { path: "/openstack", mode: "0755", owner: "root", group: "root" } - { path: "/etc/horizon", mode: "2755" } - { path: "{{ horizon_system_user_home }}", mode: "2755" } - tags: - - horizon-dirs - name: Test for log directory or link shell: | @@ -57,9 +51,6 @@ register: log_dir failed_when: false changed_when: log_dir.rc != 0 - tags: - - horizon-dirs - - horizon-logs - name: Create horizon log dir file: @@ -71,6 +62,3 @@ with_items: - { path: "/var/log/horizon" } when: log_dir.rc != 0 - tags: - - horizon-dirs - - horizon-logs diff --git a/tasks/horizon_service_setup.yml b/tasks/horizon_service_setup.yml index b24cd460..9d42d2ee 100644 --- a/tasks/horizon_service_setup.yml +++ b/tasks/horizon_service_setup.yml @@ -34,5 +34,3 @@ until: add_member_role|success retries: 5 delay: 10 - tags: - - horizon-member-config diff --git a/tasks/horizon_ssl_key_create.yml b/tasks/horizon_ssl_key_create.yml index 0e36cfe7..df02a2eb 100644 --- a/tasks/horizon_ssl_key_create.yml +++ b/tasks/horizon_ssl_key_create.yml @@ -18,8 +18,6 @@ dest: "{{ horizon_ssl_cert }}" state: "absent" when: horizon_ssl_self_signed_regen | bool - tags: - - horizon-ssl - name: Create self-signed ssl cert command: > @@ -31,5 +29,3 @@ -extensions v3_ca creates={{ horizon_ssl_cert }} notify: Restart apache2 - tags: - - horizon-ssl diff --git a/tasks/horizon_ssl_key_distribute.yml b/tasks/horizon_ssl_key_distribute.yml index b567f68c..2e80b536 100644 --- a/tasks/horizon_ssl_key_distribute.yml +++ b/tasks/horizon_ssl_key_distribute.yml @@ -20,8 +20,6 @@ owner: "{{ horizon_system_user_name }}" group: "{{ horizon_system_group_name }}" mode: "0640" - tags: - - horizon-ssl - name: Distribute self signed ssl cert copy: @@ -30,5 +28,3 @@ owner: "{{ horizon_system_user_name }}" group: "{{ horizon_system_group_name }}" mode: "0640" - tags: - - horizon-ssl diff --git a/tasks/horizon_ssl_key_store.yml b/tasks/horizon_ssl_key_store.yml index 173885cd..f7a103d2 100644 --- a/tasks/horizon_ssl_key_store.yml +++ b/tasks/horizon_ssl_key_store.yml @@ -18,20 +18,14 @@ src: "{{ horizon_ssl_cert }}" register: _horizon_ssl_cert changed_when: false - tags: - - horizon-ssl - name: Store ssl key slurp: src: "{{ horizon_ssl_key }}" register: _horizon_ssl_key changed_when: false - tags: - - horizon-ssl - name: Register a fact for the cert and key set_fact: horizon_ssl_cert_fact: "{{ _horizon_ssl_cert.content }}" horizon_ssl_key_fact: "{{ _horizon_ssl_key.content }}" - tags: - - horizon-ssl diff --git a/tasks/horizon_ssl_user_provided.yml b/tasks/horizon_ssl_user_provided.yml index 0a49991e..1a7ccda0 100644 --- a/tasks/horizon_ssl_user_provided.yml +++ b/tasks/horizon_ssl_user_provided.yml @@ -22,9 +22,6 @@ mode: "0644" when: horizon_user_ssl_cert is defined notify: Restart apache2 - tags: - - horizon-configs - - horizon-ssl - name: Drop user provided ssl key copy: @@ -35,9 +32,6 @@ mode: "0640" when: horizon_user_ssl_key is defined notify: Restart apache2 - tags: - - horizon-configs - - horizon-ssl - name: Drop user provided ssl CA cert copy: @@ -48,6 +42,3 @@ mode: "0644" when: horizon_user_ssl_ca_cert is defined notify: Restart apache2 - tags: - - keystone-configs - - keystone-ssl diff --git a/tasks/install-apt.yml b/tasks/install-apt.yml index 98aea006..e62fba95 100644 --- a/tasks/install-apt.yml +++ b/tasks/install-apt.yml @@ -20,15 +20,11 @@ stat: path: /var/cache/apt register: apt_cache_stat - tags: - - horizon-apt-packages - name: Update apt if needed apt: update_cache: yes when: "ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" - tags: - - horizon-apt-packages - name: Install apt packages apt: @@ -39,6 +35,3 @@ retries: 5 delay: 2 with_items: "{{ horizon_apt_packages }}" - tags: - - horizon-install - - horizon-apt-packages \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 657d62eb..64f88dbd 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -25,24 +25,45 @@ - always - include: horizon_pre_install.yml + tags: + - horizon-install + - include: horizon_install.yml + tags: + - horizon-install + - include: horizon_post_install.yml + tags: + - horizon-install + - horizon-config - include: horizon_db_setup.yml when: > inventory_hostname == groups['horizon_all'][0] + tags: + - horizon-install - include: horizon_ssl_self_signed.yml when: - not horizon_external_ssl|bool - horizon_user_ssl_cert is not defined or horizon_user_ssl_key is not defined + tags: + - horizon-install - include: horizon_ssl_user_provided.yml when: not horizon_external_ssl|bool + tags: + - horizon-install + - horizon-config - include: horizon_service_setup.yml + tags: + - horizon-install - include: horizon_apache.yml + tags: + - horizon-install + - horizon-config - name: Flush handlers meta: flush_handlers