openstack-ansible-os_gnocchi/tasks/main.yml

166 lines
5.6 KiB
YAML

---
# Copyright 2015, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather variables for each operating system
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
paths:
- "{{ role_path }}/vars"
tags:
- always
- import_tasks: db_setup.yml
when:
- _gnocchi_is_first_play_host
vars:
_oslodb_setup_host: "{{ gnocchi_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ gnocchi_db_setup_python_interpreter }}"
_oslodb_setup_endpoint: "{{ gnocchi_galera_address }}"
_oslodb_setup_port: "{{ gnocchi_galera_port }}"
_oslodb_databases:
- name: "{{ gnocchi_galera_database }}"
users:
- username: "{{ gnocchi_galera_user }}"
password: "{{ gnocchi_container_mysql_password }}"
tags:
- common-db
- gnocchi-config
- import_tasks: gnocchi_pre_install.yml
tags:
- gnocchi-install
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_build_distro_package_list: "{{ gnocchi_devel_distro_packages }}"
venv_python_executable: "{{ gnocchi_venv_python_executable }}"
venv_build_constraints: "{{ gnocchi_git_constraints }}"
venv_install_destination_path: "{{ gnocchi_bin | dirname }}"
venv_install_distro_package_list: "{{ gnocchi_distro_packages }}"
venv_pip_install_args: "{{ gnocchi_pip_install_args }}"
venv_pip_packages: "{{ gnocchi_pip_packages }}"
venv_facts_when_changed:
- section: "gnocchi"
option: "venv_tag"
value: "{{ gnocchi_venv_tag }}"
tags:
- gnocchi-install
- import_tasks: gnocchi_post_install.yml
when: not gnocchi_identity_only | bool
tags:
- gnocchi-config
- name: Run the systemd service role
import_role:
name: systemd_service
vars:
systemd_user_name: "{{ gnocchi_system_user_name }}"
systemd_group_name: "{{ gnocchi_system_group_name }}"
systemd_tempd_prefix: openstack
systemd_slice_name: gnocchi
systemd_lock_path: /var/lock/gnocchi
systemd_CPUAccounting: true
systemd_BlockIOAccounting: true
systemd_MemoryAccounting: true
systemd_TasksAccounting: true
systemd_services: "{{ filtered_gnocchi_services }}"
when: not gnocchi_identity_only | bool
tags:
- gnocchi-config
- systemd-service
- name: Import uwsgi role
import_role:
name: uwsgi
vars:
uwsgi_services: "{{ uwsgi_gnocchi_services }}"
uwsgi_install_method: "source"
tags:
- gnocchi-config
- uwsgi
- import_tasks: service_setup.yml
vars:
_service_adminuri_insecure: "{{ keystone_service_adminuri_insecure }}"
_service_setup_host: "{{ gnocchi_service_setup_host }}"
_service_setup_host_python_interpreter: "{{ gnocchi_service_setup_host_python_interpreter }}"
_service_region: "{{ gnocchi_service_region }}"
_service_in_ldap: "{{ gnocchi_service_in_ldap }}"
_service_project_name: "{{ gnocchi_service_project_name }}"
_project_name: "{{ gnocchi_service_project_name }}"
_project_domain: "{{ gnocchi_service_project_domain_id }}"
_service_users:
- name: "{{ gnocchi_service_user_name }}"
password: "{{ gnocchi_service_password }}"
role: "{{ gnocchi_role_name }}"
_service_endpoints:
- service: "{{ gnocchi_service_name }}"
interface: "public"
url: "{{ gnocchi_service_publicurl }}"
- service: "{{ gnocchi_service_name }}"
interface: "internal"
url: "{{ gnocchi_service_internalurl }}"
- service: "{{ gnocchi_service_name }}"
interface: "admin"
url: "{{ gnocchi_service_adminurl }}"
_service_catalog:
- name: "{{ gnocchi_service_name }}"
type: "{{ gnocchi_service_type }}"
description: "{{ gnocchi_service_description }}"
when:
- _gnocchi_is_first_play_host
- not gnocchi_identity_only | bool
tags:
- gnocchi-config
- name: Include ceph_client role
include_role:
name: "ceph_client"
apply:
tags:
- ceph
- gnocchi-install
vars:
openstack_service_system_user: "{{ gnocchi_system_user_name }}"
openstack_service_venv_bin: "{{ gnocchi_bin }}"
when:
- gnocchi_storage_driver == 'ceph'
- not gnocchi_identity_only | bool
tags:
- always
- name: Flush handlers
meta: flush_handlers
# N.B. Must occur after identity setup, as this may perform calls to Swift.
# Similarly, when using Ceph, must occur after Ceph setup.
- import_tasks: gnocchi_db_sync.yml
when:
- (gnocchi_storage_driver == 'file') | ternary(True, _gnocchi_is_first_play_host)
- not gnocchi_identity_only | bool
tags:
- gnocchi-config