diff --git a/README.rst b/README.rst index 6a1e78d..30f3aa0 100644 --- a/README.rst +++ b/README.rst @@ -57,3 +57,13 @@ Example Playbook roles: - { role: "os_keystone", tags: [ "os-keystone" ] } vars: + +Tags +==== + +This role supports two tags: ``gnocchi-install`` and ``gnocchi-config`` + +The ``gnocchi-install`` tag can be used to install and upgrade. + +The ``gnocchi-config`` tag can be used to maintain configuration of the +service. \ No newline at end of file diff --git a/tasks/gnocchi_apache.yml b/tasks/gnocchi_apache.yml index f13c915..b74e05d 100644 --- a/tasks/gnocchi_apache.yml +++ b/tasks/gnocchi_apache.yml @@ -25,8 +25,6 @@ - { src: "gnocchi-httpd.conf.j2", dest: "/etc/apache2/sites-available/gnocchi-httpd.conf" } notify: - Restart Apache - tags: - - gnocchi-httpd - name: Disable default apache site file: @@ -34,8 +32,6 @@ state: "absent" notify: - Restart Apache - tags: - - gnocchi-httpd - name: Enabled gnocchi vhost file: @@ -46,8 +42,6 @@ - { src: "/etc/apache2/sites-available/gnocchi-httpd.conf", dest: "/etc/apache2/sites-enabled/gnocchi-httpd.conf", state: "link" } notify: - Restart Apache - tags: - - gnocchi-httpd - name: Ensure Apache ServerName lineinfile: @@ -55,8 +49,6 @@ line: "ServerName {{ inventory_hostname }}" notify: - Restart Apache - tags: - - gnocchi-httpd - name: Ensure Apache ServerTokens lineinfile: @@ -65,8 +57,6 @@ line: "ServerTokens {{ gnocchi_apache_servertokens }}" notify: - Restart Apache - tags: - - gnocchi-httpd - name: Ensure Apache ServerSignature lineinfile: @@ -75,8 +65,6 @@ line: "ServerSignature {{ gnocchi_apache_serversignature }}" notify: - Restart Apache - tags: - - gnocchi-httpd - name: Enable/disable mod_ssl for apache2 apache2_module: @@ -84,6 +72,3 @@ state: "{{ gnocchi_ssl | bool | ternary('present', 'absent') }}" notify: - Restart Apache - tags: - - gnocchi-httpd - - gnocchi-ssl diff --git a/tasks/gnocchi_db_setup.yml b/tasks/gnocchi_db_setup.yml index 9360ce0..6f24ab6 100644 --- a/tasks/gnocchi_db_setup.yml +++ b/tasks/gnocchi_db_setup.yml @@ -20,8 +20,6 @@ login_host: "{{ gnocchi_galera_address }}" name: "{{ gnocchi_galera_database }}" state: "present" - tags: - - gnocchi-db-setup - name: Grant access to the DB for the service mysql_user: @@ -36,14 +34,8 @@ with_items: - "localhost" - "%" - tags: - - gnocchi-db-setup - name: Perform a Gnocchi DB sync command: "{{ gnocchi_bin }}/gnocchi-upgrade {{ gnocchi_db_sync_options }}" become: yes become_user: "{{ gnocchi_system_user_name }}" - tags: - - gnocchi-db-sync - - gnocchi-setup - - gnocchi-command-bin diff --git a/tasks/gnocchi_init_common.yml b/tasks/gnocchi_init_common.yml index d94bbd1..14894c3 100644 --- a/tasks/gnocchi_init_common.yml +++ b/tasks/gnocchi_init_common.yml @@ -15,13 +15,9 @@ - include: gnocchi_init_upstart.yml when: pid1_name == "init" - tags: - - gnocchi-init - include: gnocchi_init_systemd.yml when: pid1_name == "systemd" - tags: - - gnocchi-init - name: Load service service: diff --git a/tasks/gnocchi_install.yml b/tasks/gnocchi_install.yml index 5fd1ce5..ba9c0ee 100644 --- a/tasks/gnocchi_install.yml +++ b/tasks/gnocchi_install.yml @@ -16,9 +16,6 @@ - include: gnocchi_install_apt.yml when: - ansible_pkg_mgr == 'apt' - tags: - - gnocchi-install - - glance-apt-packages - name: Create developer mode constraint file copy: @@ -29,9 +26,6 @@ {% endfor %} when: - gnocchi_developer_mode | bool - tags: - - gnocchi-install - - gnocchi-pip-packages - name: Clone requirements git repository git: @@ -42,27 +36,18 @@ version: "{{ gnocchi_requirements_git_install_branch }}" when: - gnocchi_developer_mode | bool - tags: - - gnocchi-install - - gnocchi-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: - gnocchi_developer_mode | bool - tags: - - gnocchi-install - - gnocchi-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 gnocchi_developer_mode | bool - tags: - - gnocchi-install - - gnocchi-pip-packages - name: Install apt packages apt: @@ -73,9 +58,6 @@ retries: 5 delay: 2 with_items: gnocchi_apt_packages - tags: - - gnocchi-install - - gnocchi-apt-packages - name: Install required pip packages pip: @@ -88,9 +70,6 @@ delay: 2 with_items: - "{{ gnocchi_required_pip_packages }}" - tags: - - gnocchi-install - - gnocchi-pip-packages - name: Get local venv checksum stat: @@ -99,9 +78,6 @@ when: - not gnocchi_developer_mode | bool register: local_venv_stat - tags: - - gnocchi-install - - gnocchi-pip-packages - name: Get remote venv checksum uri: @@ -110,9 +86,6 @@ when: - not gnocchi_developer_mode | bool register: remote_venv_checksum - tags: - - gnocchi-install - - gnocchi-pip-packages # TODO: When project moves to ansible 2 we can pass this a sha256sum which will: # a) allow us to remove force: yes @@ -130,16 +103,10 @@ - not gnocchi_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: - - gnocchi-install - - gnocchi-pip-packages - name: Set gnocchi get_venv fact set_fact: gnocchi_get_venv: "{{ get_venv }}" - tags: - - gnocchi-install - - gnocchi-pip-packages - name: Remove existing venv file: @@ -147,18 +114,12 @@ state: absent when: - gnocchi_get_venv | changed - tags: - - gnocchi-install - - gnocchi-pip-packages - name: Create gnocchi venv dir file: path: "{{ gnocchi_bin | dirname }}" state: directory register: gnocchi_venv_dir - tags: - - gnocchi-install - - gnocchi-pip-packages - name: Unarchive pre-built venv unarchive: @@ -172,9 +133,6 @@ - Restart Gnocchi API services - Restart Gnocchi extra services - Restart Apache - tags: - - gnocchi-install - - gnocchi-pip-packages - name: Install pip packages pip: @@ -194,9 +152,6 @@ - Restart Gnocchi API services - Restart Gnocchi extra services - Restart Apache - tags: - - gnocchi-install - - gnocchi-pip-packages - name: Update virtualenv path command: > @@ -204,6 +159,3 @@ when: - not gnocchi_developer_mode | bool - gnocchi_get_venv | success - tags: - - gnocchi-install - - gnocchi-pip-packages diff --git a/tasks/gnocchi_policy_setup.yml b/tasks/gnocchi_policy_setup.yml index fdd86f1..a803ef1 100644 --- a/tasks/gnocchi_policy_setup.yml +++ b/tasks/gnocchi_policy_setup.yml @@ -15,9 +15,6 @@ - name: Ensure Gnocchi API service is (re)started meta: flush_handlers - tags: - - gnocchi-setup - - gnocchi-policy-setup - name: Wait for Gnocchi API to come up wait_for: @@ -25,9 +22,6 @@ port: "{{ gnocchi_service_port }}" timeout: 25 delay: 10 - tags: - - gnocchi-setup - - gnocchi-policy-setup - name: Ensure Archive Policies gnocchi: @@ -44,9 +38,6 @@ until: add_policies|success retries: 5 delay: 10 - tags: - - gnocchi-setup - - gnocchi-policy-setup - name: Ensure Archive Policy Rules gnocchi: @@ -62,6 +53,3 @@ until: add_policy_rules|success retries: 5 delay: 10 - tags: - - gnocchi-setup - - gnocchi-policy-setup diff --git a/tasks/gnocchi_post_install.yml b/tasks/gnocchi_post_install.yml index 57c63ae..e2c3fcb 100644 --- a/tasks/gnocchi_post_install.yml +++ b/tasks/gnocchi_post_install.yml @@ -39,8 +39,6 @@ - Restart Apache - Restart Gnocchi API services - Restart Gnocchi extra services - tags: - - gnocchi-config - name: Drop Gnocchi WSGI Configs template: @@ -52,5 +50,3 @@ when: gnocchi_use_mod_wsgi | bool notify: - Restart Apache - tags: - - gnocchi-config diff --git a/tasks/gnocchi_pre_install.yml b/tasks/gnocchi_pre_install.yml index de062fb..6ed78c7 100644 --- a/tasks/gnocchi_pre_install.yml +++ b/tasks/gnocchi_pre_install.yml @@ -18,8 +18,6 @@ name: "{{ gnocchi_system_group_name }}" state: "present" system: "yes" - tags: - - gnocchi-group - name: Create the gnocchi system user user: @@ -30,8 +28,6 @@ system: "yes" createhome: "yes" home: "{{ gnocchi_system_user_home }}" - tags: - - gnocchi-user - name: Create gnocchi dirs file: @@ -47,8 +43,6 @@ - { path: "/var/lib/gnocchi/tmp" } - { path: "/var/lib/gnocchi/locks" } - { path: "/var/cache/gnocchi", mode: "0700" } - tags: - - gnocchi-dirs - name: Create Apache mod_wsgi dirs file: @@ -61,8 +55,6 @@ - { path: "/var/www/cgi-bin", owner: root, group: root } - { path: "/var/www/cgi-bin/gnocchi" } when: gnocchi_use_mod_wsgi | bool - tags: - - gnocchi-dirs - name: Test for log directory or link shell: | @@ -75,9 +67,6 @@ register: log_dir failed_when: false changed_when: log_dir.rc != 0 - tags: - - gnocchi-dirs - - gnocchi-logs - name: Create gnocchi log dir file: @@ -89,6 +78,3 @@ with_items: - { path: "/var/log/gnocchi" } when: log_dir.rc != 0 - tags: - - gnocchi-dirs - - gnocchi-logs diff --git a/tasks/gnocchi_service_setup.yml b/tasks/gnocchi_service_setup.yml index 8296583..8d037c8 100644 --- a/tasks/gnocchi_service_setup.yml +++ b/tasks/gnocchi_service_setup.yml @@ -29,10 +29,6 @@ until: add_service|success retries: 5 delay: 2 - tags: - - gnocchi-api-setup - - gnocchi-service-add - - gnocchi-setup # Create the project if needed, assumed to be in default domain. # In many cases this will be present but under some circumstances the project @@ -51,10 +47,6 @@ until: add_project|success retries: 5 delay: 10 - tags: - - gnocchi-api-setup - - gnocchi-service-add - - gnocchi-setup # Create an admin user - name: Ensure Gnocchi user @@ -72,10 +64,6 @@ until: add_user|success retries: 5 delay: 10 - tags: - - gnocchi-api-setup - - gnocchi-service-add - - gnocchi-setup # Add a role to the user - name: Ensure Gnocchi user maps to admin role @@ -93,10 +81,6 @@ until: add_admin_role|success retries: 5 delay: 10 - tags: - - gnocchi-api-setup - - gnocchi-service-add - - gnocchi-setup # Create an endpoint - name: Ensure Gnocchi endpoint @@ -121,7 +105,3 @@ until: add_endpoint|success retries: 5 delay: 10 - tags: - - gnocchi-api-setup - - gnocchi-service-add - - gnocchi-setup diff --git a/tasks/main.yml b/tasks/main.yml index 24f209b..448ed68 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -37,19 +37,41 @@ - always - include: gnocchi_pre_install.yml + tags: + - gnocchi-install + - include: gnocchi_install.yml + tags: + - gnocchi-install + - include: gnocchi_post_install.yml + tags: + - gnocchi-install + - gnocchi-config + - include: gnocchi_init.yml + tags: + - gnocchi-install - include: gnocchi_service_setup.yml when: inventory_hostname == groups['gnocchi_all'][0] + tags: + - gnocchi-install # N.B. Must occur after service setup, as this may perform calls to Swift - include: gnocchi_db_setup.yml when: inventory_hostname == groups['gnocchi_all'][0] + tags: + - gnocchi-install - include: gnocchi_apache.yml when: gnocchi_use_mod_wsgi | bool + tags: + - gnocchi-install + - gnocchi-config - include: gnocchi_policy_setup.yml when: inventory_hostname == groups['gnocchi_all'][0] + tags: + - gnocchi-install + - gnocchi-config