From 744270e64b4dbb7e196edaeab6229e6fb8c8c918 Mon Sep 17 00:00:00 2001 From: Travis Truman Date: Fri, 8 Jul 2016 12:36:23 -0400 Subject: [PATCH] Cleanup/standardize usage of tags The numerous tags within the role have been condensed to two tags: neutron-install and neutron-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: I5beda5397f1f4f6d03a4a6946700eb7aeab245ec --- README.rst | 10 ++++++++ tasks/main.yml | 20 +++++++++++++++ tasks/neutron_db_setup.yml | 21 ---------------- tasks/neutron_init.yml | 20 --------------- tasks/neutron_init_common.yml | 7 ------ tasks/neutron_init_upstart.yml | 6 ----- tasks/neutron_install-apt.yml | 22 ----------------- tasks/neutron_install.yml | 44 --------------------------------- tasks/neutron_l3_ha.yml | 10 -------- tasks/neutron_post_install.yml | 19 -------------- tasks/neutron_pre_install.yml | 15 ----------- tasks/neutron_service_setup.yml | 16 ------------ tasks/nuage_neutron_config.yml | 3 --- tasks/plumgrid_config.yml | 10 -------- 14 files changed, 30 insertions(+), 193 deletions(-) diff --git a/README.rst b/README.rst index cf393598..98929ebe 100644 --- a/README.rst +++ b/README.rst @@ -18,3 +18,13 @@ This role will install the following: - { role: "os_neutron", tags: [ "os-neutron" ] } vars: neutron_galera_address: "{{ internal_lb_vip_address }}" + +Tags +==== + +This role supports two tags: ``neutron-install`` and ``neutron-config`` + +The ``neutron-install`` tag can be used to install and upgrade. + +The ``neutron-config`` tag can be used to maintain configuration of the +service. \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 029bc5d5..597ea98a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -37,22 +37,42 @@ - always - include: neutron_check.yml + tags: + - always + - include: neutron_pre_install.yml + tags: + - neutron-install + - include: neutron_install.yml + tags: + - neutron-install + - include: neutron_post_install.yml + tags: + - neutron-install + - neutron-config # neutron system services - include: neutron_init.yml + tags: + - neutron-install - include: neutron_lbaas.yml + tags: + - neutron-install - include: neutron_db_setup.yml when: > inventory_hostname == groups[neutron_services['neutron-server']['group']][0] + tags: + - neutron-install - include: neutron_service_setup.yml when: > inventory_hostname == groups['neutron_all'][0] + tags: + - neutron-install - include: neutron_l3_ha.yml when: diff --git a/tasks/neutron_db_setup.yml b/tasks/neutron_db_setup.yml index d697b4b0..a5b0c188 100644 --- a/tasks/neutron_db_setup.yml +++ b/tasks/neutron_db_setup.yml @@ -19,17 +19,11 @@ library_path: "{{ neutron_lib_dir }}" bin_path: "{{ neutron_bin }}" when: neutron_plugin_type.split('.')[0] == 'ml2' - tags: - - neutron-db-setup - - neutron-upgrade - name: Print neutron migrations facts debug: var: neutron_migrations when: neutron_plugin_type.split('.')[0] == 'ml2' - tags: - - neutron-db-setup - - neutron-upgrade - name: Perform a Neutron DB online upgrade (expand) command: | @@ -42,9 +36,6 @@ when: - (neutron_migrations is defined and neutron_migrations['run_expand']|bool) - neutron_plugin_type.split('.')[0] == 'ml2' - tags: - - neutron-db-setup - - neutron-upgrade - name: Stop Neutron server service: @@ -54,9 +45,6 @@ delegate_to: "{{ item }}" with_items: "{{ groups[neutron_services['neutron-server']['group']] }}" when: (neutron_migrations is defined and neutron_migrations['run_contract']|bool) or neutron_plugin_type.split('.')[0] != 'ml2' - tags: - - neutron-db-setup - - neutron-upgrade - name: Perform a Neutron DB offline upgrade (contract) command: | @@ -69,9 +57,6 @@ when: - (neutron_migrations is defined and neutron_migrations['run_contract']|bool) - neutron_plugin_type.split('.')[0] == 'ml2' - tags: - - neutron-db-setup - - neutron-upgrade # NOTE: We have to handle neutron_plugin_type.split('.')[0] != 'ml2' because not all neutron # plugins have contract/expand branches which breaks neutron-db-manage. @@ -86,9 +71,6 @@ become_user: "{{ neutron_system_user_name }}" when: - neutron_plugin_type.split('.')[0] != 'ml2' - tags: - - neutron-db-setup - - neutron-upgrade - name: Start neutron server service: @@ -98,6 +80,3 @@ delegate_to: "{{ item }}" with_items: "{{ groups[neutron_services['neutron-server']['group']] }}" when: (neutron_migrations is defined and neutron_migrations['run_contract']|bool) or neutron_plugin_type.split('.')[0] != 'ml2' - tags: - - neutron-db-setup - - neutron-upgrade diff --git a/tasks/neutron_init.yml b/tasks/neutron_init.yml index 2cbd70ee..6a2be792 100644 --- a/tasks/neutron_init.yml +++ b/tasks/neutron_init.yml @@ -24,8 +24,6 @@ when: - inventory_hostname in groups[neutron_services['neutron-server']['group']] - neutron_services['neutron-server'].service_en | bool - tags: - - upstart-init - include: neutron_init_common.yml vars: @@ -38,8 +36,6 @@ when: - inventory_hostname in groups[neutron_services['neutron-dhcp-agent']['group']] - neutron_services['neutron-dhcp-agent'].service_en | bool - tags: - - upstart-init - include: neutron_init_common.yml vars: @@ -52,8 +48,6 @@ when: - inventory_hostname in groups[neutron_services['neutron-l3-agent']['group']] - neutron_services['neutron-l3-agent'].service_en | bool - tags: - - upstart-init - include: neutron_init_common.yml vars: @@ -66,8 +60,6 @@ when: - inventory_hostname in groups[neutron_services['neutron-linuxbridge-agent']['group']] - neutron_services['neutron-linuxbridge-agent'].service_en | bool - tags: - - upstart-init - include: neutron_init_common.yml vars: @@ -81,8 +73,6 @@ - neutron_services['neutron-openvswitch-agent']['group'] in group_names - inventory_hostname in groups[neutron_services['neutron-openvswitch-agent']['group']] - neutron_services['neutron-openvswitch-agent'].service_en | bool - tags: - - upstart-init - include: neutron_init_common.yml vars: @@ -95,8 +85,6 @@ when: - inventory_hostname in groups[neutron_services['neutron-metadata-agent']['group']] - neutron_services['neutron-metadata-agent'].service_en | bool - tags: - - upstart-init - include: neutron_init_common.yml vars: @@ -109,8 +97,6 @@ when: - inventory_hostname in groups[neutron_services['neutron-metering-agent']['group']] - neutron_services['neutron-metering-agent'].service_en | bool - tags: - - upstart-init - include: neutron_init_common.yml vars: @@ -123,8 +109,6 @@ when: - inventory_hostname in groups[neutron_services['neutron-lbaas-agent']['group']] - neutron_services['neutron-lbaas-agent'].service_en | bool - tags: - - upstart-init - include: neutron_init_common.yml vars: @@ -137,8 +121,6 @@ when: - inventory_hostname in groups[neutron_services['neutron-lbaasv2-agent']['group']] - neutron_services['neutron-lbaasv2-agent'].service_en | bool - tags: - - upstart-init - include: neutron_init_common.yml vars: @@ -151,5 +133,3 @@ when: - inventory_hostname in groups[neutron_services['neutron-vpnaas-agent']['group']] - neutron_services['neutron-vpnaas-agent'].service_en | bool - tags: - - upstart-init diff --git a/tasks/neutron_init_common.yml b/tasks/neutron_init_common.yml index d04544b7..81b83e74 100644 --- a/tasks/neutron_init_common.yml +++ b/tasks/neutron_init_common.yml @@ -15,13 +15,9 @@ - include: neutron_init_upstart.yml when: pid1_name == "init" - tags: - - neutron-init - include: neutron_init_systemd.yml when: pid1_name == "systemd" - tags: - - neutron-init - name: Load service service: @@ -29,6 +25,3 @@ enabled: "yes" notify: - Restart neutron services - tags: - - upstart-init - - neutron-init diff --git a/tasks/neutron_init_upstart.yml b/tasks/neutron_init_upstart.yml index c1d65b43..e7d7f1fd 100644 --- a/tasks/neutron_init_upstart.yml +++ b/tasks/neutron_init_upstart.yml @@ -21,14 +21,8 @@ owner: "root" group: "root" register: upstart_init - tags: - - upstart-init - - neutron-init - name: Reload init scripts shell: | initctl reload-configuration when: upstart_init | changed - tags: - - upstart-init - - neutron-init diff --git a/tasks/neutron_install-apt.yml b/tasks/neutron_install-apt.yml index d1e5ad68..dfe99e9e 100644 --- a/tasks/neutron_install-apt.yml +++ b/tasks/neutron_install-apt.yml @@ -34,16 +34,12 @@ stat: path: /var/cache/apt register: apt_cache_stat - tags: - - neutron-apt-packages - name: Update apt if needed apt: update_cache: yes when: ("ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" or add_uca_keys | changed or add_uca_repo | changed) - tags: - - neutron-apt-packages - name: Install neutron apt dependencies apt: @@ -54,9 +50,6 @@ retries: 5 delay: 2 with_items: "{{ neutron_apt_packages }}" - tags: - - neutron-install - - neutron-apt-packages - name: Install apt packages for lxb apt: @@ -71,9 +64,6 @@ - inventory_hostname in groups[neutron_services['neutron-linuxbridge-agent']['group']] - neutron_services['neutron-linuxbridge-agent']['group'] in group_names - neutron_services['neutron-linuxbridge-agent'].service_en | bool - tags: - - neutron-install - - neutron-apt-packages - name: Install apt packages for ovs apt: @@ -88,9 +78,6 @@ - inventory_hostname in groups[neutron_services['neutron-openvswitch-agent']['group']] - neutron_services['neutron-openvswitch-agent']['group'] in group_names - neutron_services['neutron-openvswitch-agent'].service_en | bool - tags: - - neutron-install - - neutron-apt-packages - name: Install apt packages for LBaaS apt: @@ -104,9 +91,6 @@ when: - inventory_hostname in groups[neutron_services['neutron-lbaas-agent']['group']] - neutron_lbaas | bool or neutron_lbaasv2 | bool - tags: - - neutron-install - - neutron-apt-packages - name: Install apt packages for VPNaaS apt: @@ -120,9 +104,6 @@ when: - inventory_hostname in groups[neutron_services['neutron-vpnaas-agent']['group']] - neutron_vpnaas | bool - tags: - - neutron-install - - neutron-apt-packages - name: remove specific apt packages apt: @@ -133,6 +114,3 @@ retries: 5 delay: 2 with_items: "{{ neutron_apt_remove_packages }}" - tags: - - neutron-install - - neutron-apt-packages \ No newline at end of file diff --git a/tasks/neutron_install.yml b/tasks/neutron_install.yml index 90b610f1..e6cbed20 100644 --- a/tasks/neutron_install.yml +++ b/tasks/neutron_install.yml @@ -16,8 +16,6 @@ - include: neutron_install-apt.yml when: - ansible_pkg_mgr == 'apt' - tags: - - install-apt - name: Create developer mode constraint file copy: @@ -28,9 +26,6 @@ {% endfor %} when: - neutron_developer_mode | bool - tags: - - neutron-install - - neutron-pip-packages - name: Clone requirements git repository git: @@ -41,27 +36,18 @@ version: "{{ neutron_requirements_git_install_branch }}" when: - neutron_developer_mode | bool - tags: - - neutron-install - - neutron-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: - neutron_developer_mode | bool - tags: - - neutron-install - - neutron-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 neutron_developer_mode | bool - tags: - - neutron-install - - neutron-pip-packages - name: Install requires pip packages pip: @@ -73,9 +59,6 @@ retries: 5 delay: 2 with_items: "{{ neutron_requires_pip_packages }}" - tags: - - neutron-install - - neutron-pip-packages - name: Get local venv checksum stat: @@ -84,9 +67,6 @@ when: - not neutron_developer_mode | bool register: local_venv_stat - tags: - - neutron-install - - neutron-pip-packages - name: Get remote venv checksum uri: @@ -95,9 +75,6 @@ when: - not neutron_developer_mode | bool register: remote_venv_checksum - tags: - - neutron-install - - neutron-pip-packages # TODO: When project moves to ansible 2 we can pass this a sha256sum which will: # a) allow us to remove force: yes @@ -115,16 +92,10 @@ - not neutron_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: - - neutron-install - - neutron-pip-packages - name: Set neutron get_venv fact set_fact: neutron_get_venv: "{{ get_venv }}" - tags: - - neutron-install - - neutron-pip-packages - name: Remove existing venv file: @@ -132,9 +103,6 @@ state: absent when: - neutron_get_venv | changed - tags: - - neutron-install - - neutron-pip-packages - name: Create neutron venv dir file: @@ -143,9 +111,6 @@ register: neutron_venv_dir when: - not neutron_developer_mode | bool - tags: - - neutron-install - - neutron-pip-packages - name: Unarchive pre-built venv unarchive: @@ -156,9 +121,6 @@ - not neutron_developer_mode | bool - neutron_get_venv | changed or neutron_venv_dir | changed notify: Restart neutron services - tags: - - neutron-install - - neutron-pip-packages - name: Install pip packages pip: @@ -175,9 +137,6 @@ when: - neutron_get_venv | failed or neutron_developer_mode | bool notify: Restart neutron services - tags: - - neutron-install - - neutron-pip-packages - name: Update virtualenv path command: > @@ -185,6 +144,3 @@ when: - not neutron_developer_mode | bool - neutron_get_venv | success - tags: - - neutron-install - - neutron-pip-packages \ No newline at end of file diff --git a/tasks/neutron_l3_ha.yml b/tasks/neutron_l3_ha.yml index 0206cac0..708c8fb9 100644 --- a/tasks/neutron_l3_ha.yml +++ b/tasks/neutron_l3_ha.yml @@ -23,23 +23,17 @@ owner: "root" group: "root" mode: "0755" - tags: - - neutron-ha-tool - name: Convert the hostname to an int name2int: name: "{{ inventory_hostname }}" register: hashed_name - tags: - - neutron-ha-tool # These are used in the Neutron HA Cron job script, and processed in the template. - name: Creating Job Facts set_fact: do_job: ". /root/openrc && /opt/neutron-ha-tool.py {% if keystone_service_internaluri_insecure | bool %}--insecure {% endif %}--l3-agent-migrate" sleep_time: "{{ hashed_name.int_value }}" - tags: - - neutron-ha-tool - name: "Drop Neutron HA job script" template: @@ -48,8 +42,6 @@ owner: "root" group: "root" mode: "0755" - tags: - - neutron-ha-tool - name: Create Neutron HA cron: @@ -62,5 +54,3 @@ job: "/opt/neutron-ha-tool.sh" user: root cron_file: "neutron-ha-tool" - tags: - - neutron-ha-tool diff --git a/tasks/neutron_post_install.yml b/tasks/neutron_post_install.yml index f42f5ab0..d7816d48 100644 --- a/tasks/neutron_post_install.yml +++ b/tasks/neutron_post_install.yml @@ -47,8 +47,6 @@ config_type: "json" notify: - Restart neutron services - tags: - - neutron-config - name: Generate neutron dnsmasq Config config_template: @@ -63,8 +61,6 @@ - Restart neutron services when: > inventory_hostname in groups[neutron_services['neutron-dhcp-agent']['group']] - tags: - - neutron-config - name: Generate neutron agent only Config config_template: @@ -82,8 +78,6 @@ - item.value.service_en | bool - item.value.service_conf is defined - inventory_hostname in groups[item.value.group] - tags: - - neutron-config - name: Drop neutron rootwrap filters copy: @@ -103,8 +97,6 @@ - { src: "rootwrap.d/vpnaas.filters", dest: "/etc/neutron/rootwrap.d/vpnaas.filters" } notify: - Restart neutron services - tags: - - neutron-config - name: Drop neutron agent rootwrap filters copy: @@ -118,8 +110,6 @@ - item.value.service_rootwrap is defined notify: - Restart neutron services - tags: - - neutron_config - name: Setup PLUMgrid config include: plumgrid_config.yml @@ -137,9 +127,6 @@ mode: "0440" owner: "root" group: "root" - tags: - - sudoers - - neutron-sudoers - name: Drop metadata iptables checksum fix copy: @@ -151,15 +138,9 @@ when: - neutron_metadata_checksum_fix | bool - inventory_hostname in groups[neutron_services['neutron-linuxbridge-agent']['group']] - tags: - - neutron-config - - neutron-checksum-fix - name: Run metadata iptables checksum fix command: /etc/network/if-up.d/post-up-metadata-checksum when: - neutron_metadata_checksum_fix | bool - inventory_hostname in groups[neutron_services['neutron-linuxbridge-agent']['group']] - tags: - - neutron-config - - neutron-checksum-fix diff --git a/tasks/neutron_pre_install.yml b/tasks/neutron_pre_install.yml index 66a0b6ad..668ecd7c 100644 --- a/tasks/neutron_pre_install.yml +++ b/tasks/neutron_pre_install.yml @@ -18,8 +18,6 @@ name: "{{ neutron_system_group_name }}" state: "present" system: "yes" - tags: - - neutron-group - name: Create the neutron system user user: @@ -30,8 +28,6 @@ system: "yes" createhome: "yes" home: "/var/lib/{{ neutron_system_user_name }}" - tags: - - neutron-user - name: Create neutron dir file: @@ -51,8 +47,6 @@ - { path: "/var/run/neutron" } - { path: "{{ neutron_system_home_folder }}" } - { path: "{{ neutron_system_home_folder }}/ha_confs" } - tags: - - neutron-dirs - name: Test for log directory or link shell: | @@ -65,9 +59,6 @@ register: log_dir failed_when: false changed_when: log_dir.rc != 0 - tags: - - neutron-dirs - - neutron-logs - name: Create neutron log dir file: @@ -79,9 +70,6 @@ with_items: - { path: "/var/log/neutron" } when: log_dir.rc != 0 - tags: - - neutron-dirs - - neutron-logs - name: Drop sudoers file template: @@ -90,6 +78,3 @@ mode: "0440" owner: "root" group: "root" - tags: - - sudoers - - neutron-sudoers diff --git a/tasks/neutron_service_setup.yml b/tasks/neutron_service_setup.yml index 0cfcc912..67560f7c 100644 --- a/tasks/neutron_service_setup.yml +++ b/tasks/neutron_service_setup.yml @@ -29,10 +29,6 @@ until: add_service|success retries: 5 delay: 2 - tags: - - neutron-api-setup - - neutron-service-add - - neutron-setup # Create an admin user - name: Ensure neutron user @@ -51,10 +47,6 @@ until: add_service|success retries: 5 delay: 10 - tags: - - neutron-api-setup - - neutron-service-add - - neutron-setup # Add a role to the user - name: Ensure neutron user to admin role @@ -73,10 +65,6 @@ until: add_service|success retries: 5 delay: 10 - tags: - - neutron-api-setup - - neutron-service-add - - neutron-setup # Create an endpoint - name: Ensure neutron endpoint @@ -101,7 +89,3 @@ until: add_service|success retries: 5 delay: 10 - tags: - - neutron-api-setup - - neutron-service-add - - neutron-setup diff --git a/tasks/nuage_neutron_config.yml b/tasks/nuage_neutron_config.yml index f3ef3511..c5c194fe 100644 --- a/tasks/nuage_neutron_config.yml +++ b/tasks/nuage_neutron_config.yml @@ -24,6 +24,3 @@ - "{{ neutron_proprietary_nuage_pip_packages }}" when: - inventory_hostname in groups[neutron_services['neutron-server']['group']] - tags: - - neutron-install - - neutron-pip-packages diff --git a/tasks/plumgrid_config.yml b/tasks/plumgrid_config.yml index c43aa2f3..21753fe8 100644 --- a/tasks/plumgrid_config.yml +++ b/tasks/plumgrid_config.yml @@ -20,8 +20,6 @@ group: "{{ neutron_system_group_name }}" config_overrides: "{{ neutron_plumlib_ini_overrides }}" config_type: "ini" - tags: - - neutron_config - name: Place pgrc file template: @@ -29,8 +27,6 @@ dest: /etc/neutron/plugins/plumgrid/pgrc owner: "{{ neutron_system_user_name }}" group: "{{ neutron_system_group_name }}" - tags: - - neutron_config - name: Install plumgrid pip packages pip: @@ -48,9 +44,6 @@ - "{{ neutron_optional_plumgrid_pip_packages }}" when: - inventory_hostname in groups[neutron_services['neutron-server']['group']] - tags: - - neutron-install - - neutron-pip-packages - name: Install plumgrid pip packages fall back pip: @@ -68,6 +61,3 @@ when: - install_packages | failed - inventory_hostname in groups[neutron_services['neutron-server']['group']] - tags: - - neutron-install - - neutron-pip-packages