Merge "Add freezer-scheduler role"

This commit is contained in:
Zuul 2018-04-11 07:00:06 +00:00 committed by Gerrit Code Review
commit a702af5adb
11 changed files with 99 additions and 13 deletions

View File

@ -359,6 +359,7 @@ openstack_auth:
password: "{{ keystone_admin_password }}"
project_name: "admin"
domain_name: "default"
user_domain_name: "default"
# Endpoint type used to connect with OpenStack services with ansible modules.
# Valid options are [ public, internal, admin ]

View File

@ -345,6 +345,9 @@ cloudkitty
[freezer-api:children]
freezer
[freezer-scheduler:children]
freezer
# iSCSI
[iscsid:children]
compute

View File

@ -364,6 +364,9 @@ cloudkitty
[freezer-api:children]
freezer
[freezer-scheduler:children]
freezer
# iSCSI
[iscsid:children]
compute

View File

@ -12,6 +12,16 @@ freezer_services:
- "/etc/localtime:/etc/localtime:ro"
- "freezer:/var/lib/freezer/"
- "kolla_logs:/var/log/kolla/"
freezer-scheduler:
container_name: freezer_scheduler
group: freezer-scheduler
enabled: true
image: "{{ freezer_scheduler_image_full }}"
volumes:
- "{{ node_config_directory }}/freezer-scheduler/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "freezer:/var/lib/freezer/"
- "kolla_logs:/var/log/kolla/"
####################
@ -20,6 +30,9 @@ freezer_services:
freezer_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-freezer-api"
freezer_api_tag: "{{ openstack_release }}"
freezer_api_image_full: "{{ freezer_api_image }}:{{ freezer_api_tag }}"
freezer_scheduler_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-freezer-scheduler"
freezer_scheduler_tag: "{{ openstack_release }}"
freezer_scheduler_image_full: "{{ freezer_scheduler_image }}:{{ freezer_scheduler_tag }}"
####################

View File

@ -22,3 +22,26 @@
or freezer_conf.changed | bool
or policy_overwriting.changed | bool
or freezer_api_container.changed | bool
- name: Restart freezer-scheduler container
vars:
service_name: "freezer-scheduler"
service: "{{ freezer_services[service_name] }}"
config_json: "{{ freezer_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
freezer_conf: "{{ freezer_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_overwriting: "{{ freezer_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
freezer_scheduler_container: "{{ check_freezer_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes }}"
when:
- action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or freezer_conf.changed | bool
or policy_overwriting.changed | bool
or freezer_scheduler_container.changed | bool

View File

@ -41,33 +41,34 @@
- item.value.enabled | bool
with_dict: "{{ freezer_services }}"
notify:
- Restart freezer-api container
- "Restart {{ item.key }} container"
- name: Copying over wsgi-freezer-api.conf
vars:
service: "{{ freezer_services['freezer-api'] }}"
template:
src: "wsgi-freezer-api.conf.j2"
dest: "{{ node_config_directory }}/{{ item.key }}/wsgi-freezer-api.conf"
dest: "{{ node_config_directory }}/freezer-api/wsgi-freezer-api.conf"
mode: "0660"
become: true
register: wsgi_freezer_api
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ freezer_services }}"
- inventory_hostname in groups[service.group]
- service.enabled | bool
notify:
- Restart freezer-api container
- name: Copying over freezer-api.conf
- name: Copying over freezer confs
vars:
service_name: "{{ item.key }}"
merge_configs:
sources:
- "{{ role_path }}/templates/freezer-api.conf.j2"
- "{{ role_path }}/templates/freezer.conf.j2"
- "{{ node_custom_config }}/global.conf"
- "{{ node_custom_config }}/freezer.conf"
- "{{ node_custom_config }}/freezer/{{ item.key }}.conf"
- "{{ node_custom_config }}/freezer/{{ inventory_hostname }}/{{ item.key }}.conf"
dest: "{{ node_config_directory }}/{{ item.key }}/freezer-api.conf"
dest: "{{ node_config_directory }}/{{ item.key }}/freezer.conf"
mode: "0660"
become: true
register: freezer_confs
@ -76,7 +77,7 @@
- item.value.enabled | bool
with_dict: "{{ freezer_services }}"
notify:
- Restart freezer-api container
- "Restart {{ item.key }} container"
- name: Copying over existing policy file
template:
@ -91,7 +92,7 @@
- item.value.enabled | bool
with_dict: "{{ freezer_services }}"
notify:
- Restart freezer-api container
- "Restart {{ item.key }} container"
- name: Check freezer containers
kolla_docker:
@ -107,4 +108,4 @@
- item.value.enabled | bool
with_dict: "{{ freezer_services }}"
notify:
- Restart freezer-api container
- "Restart {{ item.key }} container"

View File

@ -1,5 +1,5 @@
---
- name: Pulling freezer image
- name: Pulling freezer images
kolla_docker:
action: "pull_image"
common_options: "{{ docker_common_options }}"

View File

@ -4,7 +4,7 @@
"command": "{{ apache_cmd }} -DFOREGROUND",
"config_files": [
{
"source": "{{ container_config_directory }}/freezer-api.conf",
"source": "{{ container_config_directory }}/freezer.conf",
"dest": "/etc/freezer/freezer.conf",
"owner": "freezer",
"perm": "0600"

View File

@ -0,0 +1,24 @@
{
"command": "freezer-scheduler --config-file /etc/freezer/freezer.conf start",
"config_files": [
{
"source": "{{ container_config_directory }}/freezer.conf",
"dest": "/etc/freezer/freezer.conf",
"owner": "freezer",
"perm": "0600"
}{% if freezer_policy_file is defined %},
{
"source": "{{ container_config_directory }}/{{ freezer_policy_file }}",
"dest": "/etc/freezer/{{ freezer_policy_file }}",
"owner": "freezer",
"perm": "0600"
}{% endif %}
],
"permissions": [
{
"path": "/var/log/kolla/freezer",
"owner": "freezer:freezer",
"recurse": true
}
]
}

View File

@ -8,6 +8,19 @@ bind_host = {{ api_interface_address }}
bind_port = {{ freezer_api_port }}
{% endif %}
{% if service_name == 'freezer-scheduler' %}
client_id = {{ inventory_hostname }}
jobs_dir = /etc/freezer/scheduler/conf.d
os_username = {{ openstack_auth.username }}
os_password = {{ openstack_auth.password }}
os_auth_url = {{ openstack_auth.auth_url }}/v3
os_project_name = {{ openstack_auth.project_name }}
os_project_domain_name = {{ openstack_auth.domain_name }}
os_user_domain_name = {{ openstack_auth.user_domain_name }}
{% endif %}
{% if service_name == 'freezer-api' %}
[keystone_authtoken]
auth_uri = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_public_port }}
auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }}
@ -38,3 +51,4 @@ driver = freezer_api.storage.elasticv2.ElasticSearchEngineV2
hosts = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ elasticsearch_port }}
number_of_replicas = 0
index = freezer
{% endif %}

View File

@ -0,0 +1,4 @@
---
features:
- |
Add a kolla-ansible role for freezer-scheduler