From c81f1df9380dc73b63c84157f5a1b79fc6e5b9e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Ramalho?= Date: Thu, 12 May 2016 12:50:23 -0300 Subject: [PATCH] Added extras folder with OSA configs --- extras/env.d/sahara.yml | 33 +++++++++ extras/group_vars_sahara.yml | 13 ++++ extras/haproxy_sahara.yml | 10 +++ extras/os-sahara-install.yml | 126 +++++++++++++++++++++++++++++++++ extras/repo-sahara.yml | 4 ++ extras/user_secrets_sahara.yml | 3 + 6 files changed, 189 insertions(+) create mode 100644 extras/env.d/sahara.yml create mode 100644 extras/group_vars_sahara.yml create mode 100644 extras/haproxy_sahara.yml create mode 100644 extras/os-sahara-install.yml create mode 100644 extras/repo-sahara.yml create mode 100644 extras/user_secrets_sahara.yml diff --git a/extras/env.d/sahara.yml b/extras/env.d/sahara.yml new file mode 100644 index 0000000..2914c61 --- /dev/null +++ b/extras/env.d/sahara.yml @@ -0,0 +1,33 @@ +--- +# 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: + sahara_api: + belongs_to: + - sahara_all + sahara_engine: + belongs_to: + - sahara_all + +container_skel: + sahara_container: + belongs_to: + - infra_containers + - os-infra_containers + contains: + - sahara_api + - sahara_engine + properties: + service_name: sahara + container_release: trusty + container_fs_size: 12G diff --git a/extras/group_vars_sahara.yml b/extras/group_vars_sahara.yml new file mode 100644 index 0000000..52422ae --- /dev/null +++ b/extras/group_vars_sahara.yml @@ -0,0 +1,13 @@ +## Sahara +sahara_service_port: 8386 +sahara_service_proto: http +sahara_service_adminuri_proto: "{{ openstack_service_adminuri_proto | default(sahara_service_proto) }}" +sahara_service_user_name: sahara +sahara_service_project_name: service +sahara_service_project_domain_id: default +sahara_service_user_domain_id: default +sahara_service_adminuri: "{{ sahara_service_adminuri_proto }}://{{ internal_lb_vip_address }}:{{ sahara_service_port }}" +sahara_service_adminurl: "{{ sahara_service_adminuri }}/v1.1/%(tenant_id)s" +sahara_service_region: "{{ service_region }}" +sahara_rabbitmq_userid: sahara +sahara_rabbitmq_vhost: /sahara diff --git a/extras/haproxy_sahara.yml b/extras/haproxy_sahara.yml new file mode 100644 index 0000000..0e23034 --- /dev/null +++ b/extras/haproxy_sahara.yml @@ -0,0 +1,10 @@ +haproxy_service_configs: + - service: + haproxy_service_name: sahara_api + haproxy_backend_nodes: "{{ groups['sahara_api'] | default([]) }}" + haproxy_port: 8386 + haproxy_balance_type: http + haproxy_backend_options: + - "forwardfor" + - "httpchk /versions" + - "httplog" diff --git a/extras/os-sahara-install.yml b/extras/os-sahara-install.yml new file mode 100644 index 0000000..2e4424f --- /dev/null +++ b/extras/os-sahara-install.yml @@ -0,0 +1,126 @@ +--- +# 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 sahara server + hosts: sahara_all + max_fail_percentage: 20 + user: root + pre_tasks: + - name: Use the lxc-openstack aa profile + lxc_container: + name: "{{ container_name }}" + container_config: + - "lxc.aa_profile=lxc-openstack" + delegate_to: "{{ physical_host }}" + when: not is_metal | bool + register: container_config + tags: + - lxc-aa-profile + - name: Wait for container ssh + wait_for: + port: "22" + delay: "{{ ssh_delay }}" + search_regex: "OpenSSH" + host: "{{ ansible_ssh_host }}" + delegate_to: "{{ physical_host }}" + when: > + (container_config is defined and container_config | changed) or + (container_extra_config is defined and container_config | changed) + register: ssh_wait_check + until: ssh_wait_check | success + retries: 3 + tags: + - ssh-wait + - name: Sort the rabbitmq servers + dist_sort: + value_to_lookup: "{{ container_name }}" + ref_list: "{{ groups['sahara_all'] }}" + src_list: "{{ rabbitmq_servers }}" + register: servers + - name: Set rabbitmq servers + set_fact: + rabbitmq_servers: "{{ servers.sorted_list }}" + - name: Create log dir + file: + path: "{{ item.path }}" + state: directory + with_items: + - { path: "/openstack/log/{{ inventory_hostname }}-sahara" } + when: is_metal | bool + tags: + - sahara-logs + - sahara-log-dirs + - name: Create log aggregation links + file: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + state: "{{ item.state }}" + force: "yes" + with_items: + - { src: "/openstack/log/{{ inventory_hostname }}-sahara", dest: "/var/log/sahara", state: "link" } + when: is_metal | bool + tags: + - sahara-logs + - name: Ensure Rabbitmq vhost + rabbitmq_vhost: + name: "{{ sahara_rabbitmq_vhost }}" + state: "present" + delegate_to: "{{ groups['rabbitmq_all'][0] }}" + when: + - inventory_hostname == groups['sahara_all'][0] + - groups['rabbitmq_all']|length > 0 + tags: + - sahara-rabbitmq + - sahara-rabbitmq-vhost + - name: Ensure rabbitmq user + rabbitmq_user: + user: "{{ sahara_rabbitmq_userid }}" + password: "{{ sahara_rabbitmq_password }}" + vhost: "{{ sahara_rabbitmq_vhost }}" + configure_priv: ".*" + read_priv: ".*" + write_priv: ".*" + state: "present" + delegate_to: "{{ groups['rabbitmq_all'][0] }}" + when: + - inventory_hostname == groups['sahara_all'][0] + - groups['rabbitmq_all']|length > 0 + tags: + - sahara-rabbitmq + - sahara-rabbitmq-user + roles: + - role: "os_sahara" + sahara_galera_address: "{{ galera_address }}" + sahara_venv_tag: "{{ openstack_release }}" + sahara_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/sahara-{{ openstack_release }}.tgz" + tags: + - "os-sahara" + - { role: "openstack_openrc", tags: [ "openstack-openrc" ] } + - role: "rsyslog_client" + rsyslog_client_log_rotate_file: sahara_log_rotate + rsyslog_client_log_dir: "/var/log/sahara" + rsyslog_client_config_name: "99-sahara-rsyslog-client.conf" + tags: + - "sahara-rsyslog-client" + - "rsyslog-client" + - role: "system_crontab_coordination" + tags: + - "system-crontab-coordination" + vars: + galera_address: "{{ internal_lb_vip_address }}" + is_metal: "{{ properties.is_metal|default(false) }}" + sahara_rabbitmq_userid: sahara + sahara_rabbitmq_vhost: /sahara + sahara_rabbitmq_servers: "{{ rabbitmq_servers }}" + sahara_rabbitmq_port: "{{ rabbitmq_port }}" + sahara_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}" diff --git a/extras/repo-sahara.yml b/extras/repo-sahara.yml new file mode 100644 index 0000000..1c678a1 --- /dev/null +++ b/extras/repo-sahara.yml @@ -0,0 +1,4 @@ +## Sahara service +sahara_git_repo: https://git.openstack.org/openstack/sahara +sahara_git_install_branch: stable/mitaka +sahara_git_dest: "/opt/sahara_{{ sahara_git_install_branch | replace('/', '_') }}" diff --git a/extras/user_secrets_sahara.yml b/extras/user_secrets_sahara.yml new file mode 100644 index 0000000..23438e2 --- /dev/null +++ b/extras/user_secrets_sahara.yml @@ -0,0 +1,3 @@ +sahara_container_mysql_password: +sahara_rabbitmq_password: +sahara_service_password: