From eb0005f5dad94879f10f5502353d5f7c9835a3c1 Mon Sep 17 00:00:00 2001 From: "gokhan.isik" Date: Wed, 15 Nov 2017 14:12:31 +0300 Subject: [PATCH] adding a playbook for cloudkitty --- ansible-role-requirements.yml | 5 ++ .../conf.d/cloudkitty.yml.aio | 16 ++++ etc/openstack_deploy/user_secrets.yml | 5 ++ .../repo_packages/openstack_services.yml | 5 ++ playbooks/inventory/env.d/cloudkitty.yml | 38 +++++++++ playbooks/inventory/group_vars/all.yml | 21 +++++ .../inventory/group_vars/cloudkitty_all.yml | 16 ++++ playbooks/os-cloudkitty-install.yml | 83 +++++++++++++++++++ playbooks/setup-openstack.yml | 1 + playbooks/vars/configs/haproxy_config.yml | 11 +++ 10 files changed, 201 insertions(+) create mode 100644 etc/openstack_deploy/conf.d/cloudkitty.yml.aio create mode 100644 playbooks/inventory/env.d/cloudkitty.yml create mode 100644 playbooks/inventory/group_vars/cloudkitty_all.yml create mode 100644 playbooks/os-cloudkitty-install.yml diff --git a/ansible-role-requirements.yml b/ansible-role-requirements.yml index 1547ccf8d3..307920139c 100644 --- a/ansible-role-requirements.yml +++ b/ansible-role-requirements.yml @@ -186,3 +186,8 @@ scm: git src: https://github.com/ceph/ansible-ceph-osd version: v2.2.12 +- name: os_cloudkitty + scm: git + src: https://github.com/openstack/openstack-ansible-os_cloudkitty + version: stable/ocata + diff --git a/etc/openstack_deploy/conf.d/cloudkitty.yml.aio b/etc/openstack_deploy/conf.d/cloudkitty.yml.aio new file mode 100644 index 0000000000..aa42b350e7 --- /dev/null +++ b/etc/openstack_deploy/conf.d/cloudkitty.yml.aio @@ -0,0 +1,16 @@ +--- +# 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. + +cloudkitty-infra_hosts: + aio1: + ip: 172.29.236.100 diff --git a/etc/openstack_deploy/user_secrets.yml b/etc/openstack_deploy/user_secrets.yml index 6b762fc094..5f008aefa8 100644 --- a/etc/openstack_deploy/user_secrets.yml +++ b/etc/openstack_deploy/user_secrets.yml @@ -56,6 +56,11 @@ cinder_rabbitmq_password: ## Ceph/rbd: a UUID to be used by libvirt to refer to the client.cinder user cinder_ceph_client_uuid: +##cloudkitty options +cloudkitty_container_mysql_password: +cloudkitty_service_password: +cloudkitty_rabbitmq_password: + ## Glance Options glance_container_mysql_password: glance_service_password: diff --git a/playbooks/defaults/repo_packages/openstack_services.yml b/playbooks/defaults/repo_packages/openstack_services.yml index 9f2d3cae1f..dfd6b1822c 100644 --- a/playbooks/defaults/repo_packages/openstack_services.yml +++ b/playbooks/defaults/repo_packages/openstack_services.yml @@ -62,6 +62,11 @@ cinder_git_install_branch: 69a79e38afbdc67f61568c0b82cf6d06ca304e56 # HEAD of "s cinder_git_dest: "/opt/cinder_{{ cinder_git_install_branch | replace('/', '_') }}" cinder_git_project_group: cinder_all +##Cloudkitty service +cloudkitty_git_repo: https://git.openstack.org/openstack/cloudkitty +cloudkitty_git_install_branch: stable/ocata +cloudkitty_git_dest: "/opt/cloudkitty_{{cloudkitty_git_install_branch | replace('/', '_') }}" +cloudkitty_git_project_group: cloudkitty_all ## Designate service designate_git_repo: https://git.openstack.org/openstack/designate diff --git a/playbooks/inventory/env.d/cloudkitty.yml b/playbooks/inventory/env.d/cloudkitty.yml new file mode 100644 index 0000000000..8ce47e83a9 --- /dev/null +++ b/playbooks/inventory/env.d/cloudkitty.yml @@ -0,0 +1,38 @@ +--- +# 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. + +component_skel: + cloudkitty_api: + belongs_to: + - cloudkitty_all + cloudkitty-processor: + belongs_to: + - cloudkitty_all + +container_skel: + cloudkitty_container: + belongs_to: + - cloudkitty-infra_containers + contains: + - cloudkitty_api + - cloudkitty-processor + properties: + service_name: cloudkitty + +physical_skel: + cloudkitty-infra_containers: + belongs_to: + - all_containers + cloudkitty-infra_hosts: + belongs_to: + - hosts diff --git a/playbooks/inventory/group_vars/all.yml b/playbooks/inventory/group_vars/all.yml index e6fc4ae694..19f317261e 100644 --- a/playbooks/inventory/group_vars/all.yml +++ b/playbooks/inventory/group_vars/all.yml @@ -177,6 +177,27 @@ cinder_rabbitmq_telemetry_host_group: "{{ cinder_rabbitmq_host_group }}" # If there are any Ceilometer hosts in the environment, then enable its usage cinder_ceilometer_enabled: "{{ (groups['cinder_all'] is defined) and (groups['cinder_all'] | length > 0) and (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}" +## cloudkitty +# RPC +cloudkitty_rabbitmq_userid: cloudkitty +cloudkitty_rabbitmq_vhost: /cloudkitty +cloudkitty_rabbitmq_port: "{{ rabbitmq_port }}" +cloudkitty_rabbitmq_servers: "{{ rabbitmq_servers }}" +cloudkitty_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}" +cloudkitty_rabbitmq_host_group: "{{ rabbitmq_host_group }}" + +# Telemetry notifications +cloudkitty_rabbitmq_telemetry_userid: "{{ cloudkitty_rabbitmq_userid }}" +cloudkitty_rabbitmq_telemetry_password: "{{ cloudkitty_rabbitmq_password }}" +cloudkitty_rabbitmq_telemetry_vhost: "{{ cloudkitty_rabbitmq_vhost }}" +cloudkitty_rabbitmq_telemetry_port: "{{ cloudkitty_rabbitmq_port }}" +cloudkitty_rabbitmq_telemetry_servers: "{{ cloudkitty_rabbitmq_servers }}" +cloudkitty_rabbitmq_telemetry_use_ssl: "{{ cloudkitty_rabbitmq_use_ssl }}" +cloudkitty_rabbitmq_telemetry_host_group: "{{ cloudkitty_rabbitmq_host_group }}" + +# If there are any Ceilometer hosts in the environment, then enable its usage +cloudkitty_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}" + ## Glance glance_service_port: 9292 glance_service_proto: http diff --git a/playbooks/inventory/group_vars/cloudkitty_all.yml b/playbooks/inventory/group_vars/cloudkitty_all.yml new file mode 100644 index 0000000000..e41e934448 --- /dev/null +++ b/playbooks/inventory/group_vars/cloudkitty_all.yml @@ -0,0 +1,16 @@ +--- +# 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. + +cloudkitty_service_region: "{{ service_region }}" +cloudkitty_service_in_ldap: "{{ service_ldap_backend_enabled }}" +cloudkitty_galera_address: "{{ galera_address }}" diff --git a/playbooks/os-cloudkitty-install.yml b/playbooks/os-cloudkitty-install.yml new file mode 100644 index 0000000000..0891041ddd --- /dev/null +++ b/playbooks/os-cloudkitty-install.yml @@ -0,0 +1,83 @@ +--- +# 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: Install cloudkitty server + hosts: cloudkitty_all + gather_facts: "{{ osa_gather_facts | default(True) }}" + user: root + pre_tasks: + - include: common-tasks/os-lxc-container-setup.yml + - include: common-tasks/rabbitmq-vhost-user.yml + static: no + vars: + user: "{{ cloudkitty_rabbitmq_userid }}" + password: "{{ cloudkitty_rabbitmq_password }}" + vhost: "{{ cloudkitty_rabbitmq_vhost }}" + _rabbitmq_host_group: "{{ cloudkitty_rabbitmq_host_group }}" + when: + - inventory_hostname == groups['cloudkitty_all'][0] + - groups[cloudkitty_rabbitmq_host_group] | length > 0 + - include: common-tasks/rabbitmq-vhost-user.yml + static: no + vars: + user: "{{ cloudkitty_rabbitmq_telemetry_userid }}" + password: "{{ cloudkitty_rabbitmq_telemetry_password }}" + vhost: "{{ cloudkitty_rabbitmq_telemetry_vhost }}" + _rabbitmq_host_group: "{{ cloudkitty_rabbitmq_telemetry_host_group }}" + when: + - cloudkitty_ceilometer_enabled | bool + - inventory_hostname == groups['cloudkitty_all'][0] + - groups[cloudkitty_rabbitmq_telemetry_host_group] is defined + - groups[cloudkitty_rabbitmq_telemetry_host_group] | length > 0 + - groups[cloudkitty_rabbitmq_telemetry_host_group] != groups[cloudkitty_rabbitmq_host_group] + - include: common-tasks/os-log-dir-setup.yml + vars: + log_dirs: + - src: "/openstack/log/{{ inventory_hostname }}-cloudkitty" + dest: "/var/log/cloudkitty" + - include: common-tasks/mysql-db-user.yml + static: no + vars: + user_name: "{{ cloudkitty_galera_user }}" + password: "{{ cloudkitty_container_mysql_password }}" + login_host: "{{ cloudkitty_galera_address }}" + db_name: "{{ cloudkitty_galera_database }}" + when: inventory_hostname == groups['cloudkitty_all'][0] + - include: common-tasks/package-cache-proxy.yml + roles: + - role: "os_cloudkitty" + cloudkitty_venv_tag: "{{ openstack_release }}" + cloudkitty_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}-16.04-x86_64/cloudkitty-{{ openstack_release }}-x86_64.tgz" + cloudkitty_galera_address: "{{ galera_address }}" + tags: + - "os-cloudkitty" + - role: "openstack_openrc" + tags: + - openrc + - role: "rsyslog_client" + rsyslog_client_log_rotate_file: cloudkitty_log_rotate + rsyslog_client_log_dir: "/var/log/cloudkitty" + rsyslog_client_config_name: "99-cloudkitty-rsyslog-client.conf" + tags: + - rsyslog + vars: + galera_address: "{{ internal_lb_vip_address }}" + is_metal: "{{ properties.is_metal|default(false) }}" + cloudkitty_rabbitmq_userid: cloudkitty + cloudkitty_rabbitmq_vhost: /cloudkitty + cloudkitty_rabbitmq_servers: "{{ rabbitmq_servers }}" + cloudkitty_rabbitmq_port: "{{ rabbitmq_port }}" + cloudkitty_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}" + environment: "{{ deployment_environment_variables | default({}) }}" + tags: + - cloudkitty diff --git a/playbooks/setup-openstack.yml b/playbooks/setup-openstack.yml index 83545c0c2b..fb844f42cd 100644 --- a/playbooks/setup-openstack.yml +++ b/playbooks/setup-openstack.yml @@ -37,6 +37,7 @@ - include: os-magnum-install.yml - include: os-trove-install.yml - include: os-sahara-install.yml +- include: os-cloudkitty-install.yml - include: os-tempest-install.yml when: (tempest_install | default(False)) | bool or (tempest_run | default(False)) | bool diff --git a/playbooks/vars/configs/haproxy_config.yml b/playbooks/vars/configs/haproxy_config.yml index 7fc836de3b..f2e1a8fa68 100644 --- a/playbooks/vars/configs/haproxy_config.yml +++ b/playbooks/vars/configs/haproxy_config.yml @@ -172,6 +172,17 @@ haproxy_default_services: haproxy_balance_type: http haproxy_backend_options: - "httpchk HEAD /" + - service: + haproxy_service_name: cloudkitty_api + haproxy_backend_nodes: "{{ groups['cloudkitty_api'] | default([]) }}" + haproxy_ssl: "{{ haproxy_ssl }}" + haproxy_port: 8089 + haproxy_balance_type: http + haproxy_backend_options: + - "forwardfor" + - "httpchk" + - "httplog" + - service: haproxy_service_name: horizon haproxy_backend_nodes: "{{ groups['horizon_all'] | default([]) }}"