Skip to content

Commit cb713f7

Browse files
authored
Merge pull request #205 from stackhpc/feature/wallaby/caso
Add role to deploy cASO
2 parents 766548f + 1add752 commit cb713f7

File tree

25 files changed

+340
-0
lines changed

25 files changed

+340
-0
lines changed

ansible/group_vars/all.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ barbican_api_listen_port: "{{ barbican_api_port }}"
284284

285285
blazar_api_port: "1234"
286286

287+
caso_tcp_output_port: "24224"
288+
287289
ceph_rgw_internal_fqdn: "{{ kolla_internal_fqdn }}"
288290
ceph_rgw_external_fqdn: "{{ kolla_external_fqdn }}"
289291
ceph_rgw_port: "6780"
@@ -608,6 +610,7 @@ enable_haproxy_memcached: "no"
608610
enable_aodh: "no"
609611
enable_barbican: "no"
610612
enable_blazar: "no"
613+
enable_caso: "no"
611614
enable_ceilometer: "no"
612615
enable_ceilometer_ipmi: "no"
613616
enable_cells: "no"

ansible/inventory/all-in-one

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ localhost ansible_connection=local
1818
[deployment]
1919
localhost ansible_connection=local
2020

21+
# Caso
22+
[caso:children]
23+
monitoring
24+
2125
# You can explicitly specify which hosts run each project by updating the
2226
# groups in the sections below. Common services are grouped together.
2327

ansible/inventory/multinode

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ monitoring
4242
[tls-backend:children]
4343
control
4444

45+
# Caso
46+
[caso:children]
47+
monitoring
48+
4549
# You can explicitly specify which hosts run each project by updating the
4650
# groups in the sections below. Common services are grouped together.
4751

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
caso_services:
3+
caso:
4+
container_name: caso
5+
group: caso
6+
enabled: true
7+
image: "{{ caso_image_full }}"
8+
volumes:
9+
- "{{ node_config_directory }}/caso/:{{ container_config_directory }}/"
10+
- "/etc/localtime:/etc/localtime:ro"
11+
- "caso_spool:/var/lib/caso"
12+
- "caso_ssm_outgoing:/var/spool/apel/outgoing/openstack"
13+
- "kolla_logs:/var/log/kolla/"
14+
dimensions: "{{ caso_dimensions }}"
15+
16+
####################
17+
# caso
18+
####################
19+
caso_site_name: "kolla_caso"
20+
caso_logging_debug: "{{ openstack_logging_debug }}"
21+
caso_log_dir: "/var/log/kolla/caso"
22+
caso_cron_table: "10 * * * *"
23+
caso_messengers:
24+
- caso.messenger.logstash.LogstashMessenger
25+
26+
####################
27+
# OpenStack
28+
####################
29+
caso_openstack_auth: "{{ openstack_auth }}"
30+
caso_keystone_user: "caso"
31+
caso_projects: []
32+
caso_ks_users_tmpl: >
33+
{%- for project in caso_projects -%}
34+
- project: "{{ project }}"
35+
user: "{{ caso_keystone_user }}"
36+
password: "{{ caso_keystone_password }}"
37+
role: "admin"
38+
{% endfor %}
39+
caso_ks_users: "{{ caso_ks_users_tmpl | from_yaml if caso_projects else [] }}"
40+
41+
####################
42+
# Docker
43+
####################
44+
caso_install_type: "{{ kolla_install_type }}"
45+
caso_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ caso_install_type }}-caso"
46+
caso_tag: "{{ openstack_tag }}"
47+
caso_image_full: "{{ caso_image }}:{{ caso_tag }}"
48+
caso_dimensions: "{{ default_container_dimensions }}"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
- name: Restart caso container
3+
vars:
4+
service_name: "caso"
5+
service: "{{ caso_services[service_name] }}"
6+
config_json: "{{ caso_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
7+
caso_container: "{{ check_caso_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
8+
become: true
9+
kolla_docker:
10+
action: "recreate_or_restart_container"
11+
common_options: "{{ docker_common_options }}"
12+
name: "{{ service.container_name }}"
13+
image: "{{ service.image }}"
14+
volumes: "{{ service.volumes }}"
15+
dimensions: "{{ service.dimensions }}"
16+
when:
17+
- kolla_action != "config"
18+
- inventory_hostname in groups[service.group]
19+
- service.enabled | bool
20+
- config_json.changed | bool
21+
or caso_conf.changed | bool
22+
or caso_vom_conf.changed | bool
23+
or caso_crontab.changed | bool
24+
or caso_container.changed | bool

ansible/roles/caso/tasks/check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
---
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
- name: Ensuring config directories exist
3+
file:
4+
path: "{{ node_config_directory }}/{{ item.key }}"
5+
state: "directory"
6+
owner: "{{ config_owner_user }}"
7+
group: "{{ config_owner_group }}"
8+
mode: "0770"
9+
become: true
10+
when:
11+
- inventory_hostname in groups[item.value.group]
12+
- item.value.enabled | bool
13+
with_dict: "{{ caso_services }}"
14+
15+
- name: Copying over config.json files for services
16+
template:
17+
src: "{{ item.key }}.json.j2"
18+
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
19+
mode: "0660"
20+
become: true
21+
register: caso_config_jsons
22+
when:
23+
- inventory_hostname in groups[item.value.group]
24+
- item.value.enabled | bool
25+
with_dict: "{{ caso_services }}"
26+
notify:
27+
- Restart caso container
28+
29+
- name: Copying over caso config
30+
merge_configs:
31+
sources:
32+
- "{{ role_path }}/templates/caso.conf.j2"
33+
- "{{ node_custom_config }}//caso/caso.conf"
34+
- "{{ node_custom_config }}/{{ item.key }}/{{ inventory_hostname }}/caso.conf"
35+
dest: "{{ node_config_directory }}/{{ item.key }}/caso.conf"
36+
mode: "0660"
37+
become: true
38+
register: caso_conf
39+
when:
40+
- inventory_hostname in groups[item.value.group]
41+
- item.value.enabled | bool
42+
with_dict: "{{ caso_services }}"
43+
notify:
44+
- Restart caso container
45+
46+
- name: Copying over caso crontab
47+
template:
48+
src: "{{ role_path }}/templates/caso.crontab.j2"
49+
dest: "{{ node_config_directory }}/{{ item.key }}/caso.crontab"
50+
mode: "0660"
51+
become: true
52+
register: caso_crontab
53+
when:
54+
- inventory_hostname in groups[item.value.group]
55+
- item.value.enabled | bool
56+
with_dict: "{{ caso_services }}"
57+
notify:
58+
- Restart caso container
59+
60+
- name: Copying over caso voms file
61+
template:
62+
src: "{{ role_path }}/templates/voms.json.j2"
63+
dest: "{{ node_config_directory }}/{{ item.key }}/voms.json"
64+
mode: "0660"
65+
become: true
66+
register: caso_vom_conf
67+
when:
68+
- inventory_hostname in groups[item.value.group]
69+
- item.value.enabled | bool
70+
with_dict: "{{ caso_services }}"
71+
notify:
72+
- Restart caso container
73+
74+
- name: Check caso containers
75+
become: true
76+
kolla_docker:
77+
action: "compare_container"
78+
common_options: "{{ docker_common_options }}"
79+
name: "{{ item.value.container_name }}"
80+
image: "{{ item.value.image }}"
81+
volumes: "{{ item.value.volumes }}"
82+
dimensions: "{{ item.value.dimensions }}"
83+
register: check_caso_containers
84+
when:
85+
- kolla_action != "config"
86+
- inventory_hostname in groups[item.value.group]
87+
- item.value.enabled | bool
88+
with_dict: "{{ caso_services }}"
89+
notify:
90+
- Restart caso container
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
- include_tasks: register.yml
3+
when: inventory_hostname in groups['caso']
4+
5+
- include_tasks: config.yml
6+
when: inventory_hostname in groups['caso']
7+
8+
- name: Flush handlers
9+
meta: flush_handlers
10+
11+
- include_tasks: check.yml
12+
when: inventory_hostname in groups['caso']

ansible/roles/caso/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
- include_tasks: "{{ kolla_action }}.yml"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
---

0 commit comments

Comments
 (0)