From 87e54428afa42d2ff7f916a028c3751197605d91 Mon Sep 17 00:00:00 2001 From: Travis Truman Date: Tue, 12 Jul 2016 16:55:32 -0400 Subject: [PATCH] Cleanup/standardize usage of tags The numerous tags within the role have been condensed to two tags: glance-install and glance-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: Iafd4aeed4c76404605c77abae2e6ea57a7ae0355 --- README.rst | 9 +++++++ tasks/glance_db_setup.yml | 8 ------ tasks/glance_init_common.yml | 4 --- tasks/glance_install.yml | 46 ---------------------------------- tasks/glance_post_install.yml | 10 -------- tasks/glance_pre_install.yml | 12 --------- tasks/glance_service_setup.yml | 16 ------------ tasks/main.yml | 16 ++++++++++++ 8 files changed, 25 insertions(+), 96 deletions(-) diff --git a/README.rst b/README.rst index 0424d366..3459f248 100644 --- a/README.rst +++ b/README.rst @@ -21,3 +21,12 @@ This role will install the following Upstart services: external_lb_vip_address: 172.16.24.1 internal_lb_vip_address: 192.168.0.1 glance_galera_address: "{{ internal_lb_vip_address }}" + +Tags +==== + +This role supports two tags: ``glance-install`` and ``glance-config`` + +The ``glance-install`` tag can be used to install and upgrade. + +The ``glance-config`` tag can be used to manage configuration. \ No newline at end of file diff --git a/tasks/glance_db_setup.yml b/tasks/glance_db_setup.yml index 5790de01..78d98dc0 100644 --- a/tasks/glance_db_setup.yml +++ b/tasks/glance_db_setup.yml @@ -17,16 +17,8 @@ command: "{{ glance_bin }}/glance-manage db_sync" become: yes become_user: "{{ glance_system_user_name }}" - tags: - - glance-db-sync - - glance-setup - - glance-command-bin - name: Load glance metadata definitions command: "{{ glance_bin }}/glance-manage db_load_metadefs {{ glance_etc_dir }}/metadefs" become: yes become_user: "{{ glance_system_user_name }}" - tags: - - glance-db-sync - - glance-setup - - glance-command-bin diff --git a/tasks/glance_init_common.yml b/tasks/glance_init_common.yml index 71adc5ee..b0ecefac 100644 --- a/tasks/glance_init_common.yml +++ b/tasks/glance_init_common.yml @@ -15,13 +15,9 @@ - include: glance_init_upstart.yml when: pid1_name == "init" - tags: - - glance-init - include: glance_init_systemd.yml when: pid1_name == "systemd" - tags: - - glance-init - name: Load service service: diff --git a/tasks/glance_install.yml b/tasks/glance_install.yml index b14b2654..c661544c 100644 --- a/tasks/glance_install.yml +++ b/tasks/glance_install.yml @@ -16,9 +16,6 @@ - include: glance_install_apt.yml when: - ansible_pkg_mgr == 'apt' - tags: - - glance-install - - glance-apt-packages - name: Create developer mode constraint file copy: @@ -29,9 +26,6 @@ {% endfor %} when: - glance_developer_mode | bool - tags: - - glance-install - - glance-pip-packages - name: Clone requirements git repository git: @@ -42,28 +36,18 @@ version: "{{ glance_requirements_git_install_branch }}" when: - glance_developer_mode | bool - tags: - - glance-install - - glance-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: - glance_developer_mode | bool - tags: - - glance-install - - glance-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 glance_developer_mode | bool - tags: - - glance-install - - glance-pip-packages - - name: Install requires pip packages pip: @@ -75,9 +59,6 @@ retries: 5 delay: 2 with_items: "{{ glance_requires_pip_packages }}" - tags: - - glance-install - - glance-pip-packages - name: Get local venv checksum stat: @@ -86,9 +67,6 @@ when: - not glance_developer_mode | bool register: local_venv_stat - tags: - - glance-install - - glance-pip-packages - name: Get remote venv checksum uri: @@ -97,9 +75,6 @@ when: - not glance_developer_mode | bool register: remote_venv_checksum - tags: - - glance-install - - glance-pip-packages # TODO: When project moves to ansible 2 we can pass this a sha256sum which will: # a) allow us to remove force: yes @@ -117,16 +92,10 @@ - not glance_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: - - glance-install - - glance-pip-packages - name: Set glance get_venv fact set_fact: glance_get_venv: "{{ get_venv }}" - tags: - - glance-install - - glance-pip-packages - name: Remove existing venv file: @@ -134,18 +103,12 @@ state: absent when: - glance_get_venv | changed - tags: - - glance-install - - glance-pip-packages - name: Create glance venv dir file: path: "{{ glance_bin | dirname }}" state: directory register: glance_venv_dir - tags: - - glance-install - - glance-pip-packages - name: Unarchive pre-built venv unarchive: @@ -157,9 +120,6 @@ - glance_get_venv | changed or glance_venv_dir | changed notify: - Restart glance services - tags: - - glance-install - - glance-pip-packages - name: Install pip packages pip: @@ -177,9 +137,6 @@ - glance_get_venv | failed or glance_developer_mode | bool notify: - Restart glance services - tags: - - glance-install - - glance-pip-packages - name: Update virtualenv path command: > @@ -187,6 +144,3 @@ when: - not glance_developer_mode | bool - glance_get_venv | success - tags: - - glance-install - - glance-pip-packages diff --git a/tasks/glance_post_install.yml b/tasks/glance_post_install.yml index b6a580cf..0c7bf6d6 100644 --- a/tasks/glance_post_install.yml +++ b/tasks/glance_post_install.yml @@ -70,17 +70,12 @@ notify: - Restart glance api - Restart glance registry - tags: - - glance-config - name: Create nfs shares local path file: path: "{{ item.local_path }}" state: directory with_items: "{{ glance_nfs_client }}" - tags: - - glance-nfs - - glance-nfs-local-path - name: Glance mount nfs mount: @@ -90,9 +85,6 @@ opts: "{{ item.options }}" state: "mounted" with_items: "{{ glance_nfs_client }}" - tags: - - glance-nfs - - glance-nfs-local-path - name: Create glance cache management cron jobs cron: @@ -110,5 +102,3 @@ - name: "{{ glance_bin }}/glance-cache-cleaner" hour: "*/5" when: glance_flavor | search("cache") - tags: - - glance-cron diff --git a/tasks/glance_pre_install.yml b/tasks/glance_pre_install.yml index e93b003b..05dd014a 100644 --- a/tasks/glance_pre_install.yml +++ b/tasks/glance_pre_install.yml @@ -18,8 +18,6 @@ name: "{{ glance_system_group_name }}" state: "present" system: "yes" - tags: - - glance-group - name: Create the glance system user user: @@ -30,8 +28,6 @@ system: "yes" createhome: "yes" home: "{{ glance_system_user_home }}" - tags: - - glance-user - name: Create glance dir file: @@ -49,8 +45,6 @@ - { path: "{{ glance_system_user_home }}/cache/registry" } - { path: "{{ glance_system_user_home }}/images/" } - { path: "{{ glance_system_user_home }}/scrubber" } - tags: - - glance-dirs - name: Test for log directory or link shell: | @@ -63,9 +57,6 @@ register: log_dir failed_when: false changed_when: log_dir.rc != 0 - tags: - - glance-dirs - - glance-logs - name: Create glance log dir file: @@ -75,6 +66,3 @@ group: "{{ glance_system_group_name }}" mode: "0755" when: log_dir.rc != 0 - tags: - - glance-dirs - - glance-logs diff --git a/tasks/glance_service_setup.yml b/tasks/glance_service_setup.yml index f2c12705..5553eb95 100644 --- a/tasks/glance_service_setup.yml +++ b/tasks/glance_service_setup.yml @@ -29,10 +29,6 @@ until: add_service|success retries: 5 delay: 2 - tags: - - glance-api-setup - - glance-service-add - - glance-setup # Create an admin user - name: Ensure glance user @@ -51,10 +47,6 @@ until: add_service|success retries: 5 delay: 10 - tags: - - glance-api-setup - - glance-service-add - - glance-setup # Add a role to the user - name: Ensure glance user to admin role @@ -73,10 +65,6 @@ until: add_service|success retries: 5 delay: 10 - tags: - - glance-api-setup - - glance-service-add - - glance-setup # Create an endpoint - name: Ensure glance endpoint @@ -101,7 +89,3 @@ until: add_service|success retries: 5 delay: 10 - tags: - - glance-api-setup - - glance-service-add - - glance-setup diff --git a/tasks/main.yml b/tasks/main.yml index 5aae5b35..67cc4b03 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -37,17 +37,33 @@ - always - include: glance_pre_install.yml + tags: + - glance-install + - include: glance_install.yml + tags: + - glance-install + - include: glance_post_install.yml + tags: + - glance-install + - glance-config + - include: glance_init.yml + tags: + - glance-install - include: glance_db_setup.yml when: > inventory_hostname == groups['glance_all'][0] + tags: + - glance-install - include: glance_service_setup.yml when: > inventory_hostname == groups['glance_all'][0] + tags: + - glance-install - name: Flush handlers meta: flush_handlers