-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "Support searchlight ansible role"
- Loading branch information
Showing
28 changed files
with
451 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
ansible/roles/common/templates/cron-logrotate-searchlight.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"/var/log/kolla/searchlight/*.log" | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
project_name: "searchlight" | ||
|
||
#################### | ||
# Elasticsearch | ||
#################### | ||
searchlight_elasticsearch_url: "{{ kolla_internal_fqdn }}:{{ elasticsearch_port }}" | ||
|
||
#################### | ||
# Docker | ||
#################### | ||
searchlight_listener_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-searchlight-listener" | ||
searchlight_listener_tag: "{{ openstack_release }}" | ||
searchlight_listener_image_full: "{{ searchlight_listener_image }}:{{ searchlight_listener_tag }}" | ||
|
||
searchlight_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-searchlight-api" | ||
searchlight_api_tag: "{{ openstack_release }}" | ||
searchlight_api_image_full: "{{ searchlight_api_image }}:{{ searchlight_api_tag }}" | ||
|
||
|
||
#################### | ||
# OpenStack | ||
#################### | ||
searchlight_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ searchlight_api_port }}" | ||
searchlight_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ searchlight_api_port }}" | ||
searchlight_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ searchlight_api_port }}" | ||
|
||
searchlight_logging_debug: "{{ openstack_logging_debug }}" | ||
|
||
searchlight_keystone_user: "searchlight" | ||
|
||
openstack_searchlight_auth: "{'auth_url':'{{ openstack_auth.auth_url }}','username':'{{ openstack_auth.username }}','password':'{{ openstack_auth.password }}','project_name':'{{ openstack_auth.project_name }}'}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- { role: common } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
- include: bootstrap_service.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- name: Running Searchlight bootstrap container | ||
kolla_docker: | ||
action: "start_container" | ||
common_options: "{{ docker_common_options }}" | ||
detach: False | ||
environment: | ||
KOLLA_BOOTSTRAP: | ||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" | ||
image: "{{ searchlight_api_image_full }}" | ||
labels: | ||
BOOTSTRAP: | ||
name: "bootstrap_searchlight" | ||
restart_policy: "never" | ||
volumes: | ||
- "{{ node_config_directory }}/searchlight-api/:{{ container_config_directory }}/:ro" | ||
- "/etc/localtime:/etc/localtime:ro" | ||
- "kolla_logs:/var/log/kolla/" | ||
run_once: True | ||
delegate_to: "{{ groups['searchlight-api'][0] }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
- name: Ensuring config directories exist | ||
file: | ||
path: "{{ node_config_directory }}/{{ item }}" | ||
state: "directory" | ||
recurse: yes | ||
with_items: | ||
- "searchlight-api" | ||
- "searchlight-listener" | ||
|
||
- name: Copying over config.json files for services | ||
template: | ||
src: "{{ item }}.json.j2" | ||
dest: "{{ node_config_directory }}/{{ item }}/config.json" | ||
with_items: | ||
- "searchlight-api" | ||
- "searchlight-listener" | ||
|
||
- name: Copying over searchlight.conf | ||
merge_configs: | ||
vars: | ||
service_name: "{{ item }}" | ||
sources: | ||
- "{{ role_path }}/templates/searchlight.conf.j2" | ||
- "{{ node_custom_config }}/global.conf" | ||
- "{{ node_custom_config }}/messaging.conf" | ||
- "{{ node_custom_config }}/searchlight.conf" | ||
- "{{ node_custom_config }}/searchlight/{{ inventory_hostname }}/searchlight.conf" | ||
dest: "{{ node_config_directory }}/{{ item }}/searchlight.conf" | ||
with_items: | ||
- "searchlight-api" | ||
- "searchlight-listener" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- include: register.yml | ||
when: inventory_hostname in groups['searchlight'] | ||
|
||
- include: config.yml | ||
when: inventory_hostname in groups['searchlight'] | ||
|
||
- include: bootstrap.yml | ||
when: inventory_hostname in groups['searchlight'] | ||
|
||
- include: start.yml | ||
when: inventory_hostname in groups['searchlight'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
- include: "{{ action }}.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
- name: Pulling searchlight-api image | ||
kolla_docker: | ||
action: "pull_image" | ||
common_options: "{{ docker_common_options }}" | ||
image: "{{ searchlight_api_image_full }}" | ||
when: inventory_hostname in groups['searchlight-api'] | ||
|
||
- name: Pulling searchlight-listener image | ||
kolla_docker: | ||
action: "pull_image" | ||
common_options: "{{ docker_common_options }}" | ||
image: "{{ searchlight_listener_image_full }}" | ||
when: inventory_hostname in groups['searchlight-listener'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
- name: Ensuring the containers up | ||
kolla_docker: | ||
name: "{{ item.name }}" | ||
action: "get_container_state" | ||
register: container_state | ||
failed_when: container_state.Running == false | ||
when: inventory_hostname in groups[item.group] | ||
with_items: | ||
- { name: searchlight_api, group: searchlight-api } | ||
- { name: searchlight_listener, group: searchlight-listener } | ||
|
||
- include: config.yml | ||
|
||
- name: Check the configs | ||
command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check | ||
changed_when: false | ||
failed_when: false | ||
register: check_results | ||
when: inventory_hostname in groups[item.group] | ||
with_items: | ||
- { name: searchlight_api, group: searchlight-api } | ||
- { name: searchlight_listener, group: searchlight-listener } | ||
|
||
- name: Containers config strategy | ||
kolla_docker: | ||
name: "{{ item.name }}" | ||
action: "get_container_env" | ||
register: container_envs | ||
when: inventory_hostname in groups[item.group] | ||
with_items: | ||
- { name: searchlight_api, group: searchlight-api } | ||
- { name: searchlight_listener, group: searchlight-listener } | ||
|
||
- name: Remove the containers | ||
kolla_docker: | ||
name: "{{ item[0]['name'] }}" | ||
action: "remove_container" | ||
register: remove_containers | ||
when: | ||
- config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' | ||
- item[2]['rc'] == 1 | ||
- inventory_hostname in groups[item[0]['group']] | ||
with_together: | ||
- [{ name: searchlight_api, group: searchlight-api }, | ||
{ name: searchlight_listener, group: searchlight-listener }] | ||
- "{{ container_envs.results }}" | ||
- "{{ check_results.results }}" | ||
|
||
- include: start.yml | ||
when: remove_containers.changed | ||
|
||
- name: Restart containers | ||
kolla_docker: | ||
name: "{{ item[0]['name'] }}" | ||
action: "restart_container" | ||
when: | ||
- config_strategy == 'COPY_ALWAYS' | ||
- item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' | ||
- item[2]['rc'] == 1 | ||
- inventory_hostname in groups[item[0]['group']] | ||
with_together: | ||
- [{ name: searchlight_api, group: searchlight-api }, | ||
{ name: searchlight_listener, group: searchlight-listener }] | ||
- "{{ container_envs.results }}" | ||
- "{{ check_results.results }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
- name: Creating the Searchlight service and endpoint | ||
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost | ||
-m kolla_keystone_service | ||
-a "service_name=searchlight | ||
service_type=search | ||
description='Openstack Index Service' | ||
endpoint_region={{ openstack_region_name }} | ||
url='{{ item.url }}' | ||
interface='{{ item.interface }}' | ||
region_name={{ openstack_region_name }} | ||
auth={{ '{{ openstack_searchlight_auth }}' }}" | ||
-e "{'openstack_searchlight_auth':{{ openstack_searchlight_auth }}}" | ||
register: searchlight_endpoint | ||
changed_when: "{{ searchlight_endpoint.stdout.find('localhost | SUCCESS => ') != -1 and (searchlight_endpoint.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" | ||
until: searchlight_endpoint.stdout.split()[2] == 'SUCCESS' | ||
retries: 10 | ||
delay: 5 | ||
run_once: True | ||
with_items: | ||
- {'interface': 'admin', 'url': '{{ searchlight_admin_endpoint }}'} | ||
- {'interface': 'internal', 'url': '{{ searchlight_internal_endpoint }}'} | ||
- {'interface': 'public', 'url': '{{ searchlight_public_endpoint }}'} | ||
|
||
- name: Creating the Searchlight project, user, and role | ||
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost | ||
-m kolla_keystone_user | ||
-a "project=service | ||
user=searchlight | ||
password={{ searchlight_keystone_password }} | ||
role=admin | ||
region_name={{ openstack_region_name }} | ||
auth={{ '{{ openstack_searchlight_auth }}' }}" | ||
-e "{'openstack_searchlight_auth':{{ openstack_searchlight_auth }}}" | ||
register: searchlight_user | ||
changed_when: "{{ searchlight_user.stdout.find('localhost | SUCCESS => ') != -1 and (searchlight_user.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" | ||
until: searchlight_user.stdout.split()[2] == 'SUCCESS' | ||
retries: 10 | ||
delay: 5 | ||
run_once: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
- name: Starting searchlight-api container | ||
kolla_docker: | ||
action: "start_container" | ||
common_options: "{{ docker_common_options }}" | ||
image: "{{ searchlight_api_image_full }}" | ||
name: "searchlight_api" | ||
volumes: | ||
- "{{ node_config_directory }}/searchlight-api/:{{ container_config_directory }}/:ro" | ||
- "/etc/localtime:/etc/localtime:ro" | ||
- "kolla_logs:/var/log/kolla/" | ||
when: inventory_hostname in groups['searchlight-api'] | ||
|
||
- name: Starting searchlight-listener container | ||
kolla_docker: | ||
action: "start_container" | ||
common_options: "{{ docker_common_options }}" | ||
image: "{{ searchlight_listener_image_full }}" | ||
name: "searchlight_listener" | ||
volumes: | ||
- "{{ node_config_directory }}/searchlight-listener/:{{ container_config_directory }}/:ro" | ||
- "/etc/localtime:/etc/localtime:ro" | ||
- "kolla_logs:/var/log/kolla/" | ||
when: inventory_hostname in groups['searchlight-listener'] |
Oops, something went wrong.