forked from openstack/kolla-ansible
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cASO is an OpenStack accounting extractor. For more detail see: https://github.com/IFCA/caso By default, cASO is configured to output to Fluentd via TCP. The accounting information can then be shipped off to ElasticSearch. (cherry picked from commit d8ab00f) (cherry picked from commit 67ee60e) Change-Id: Ib81ec443bbb14d494d7c81dff617b371a1b68c52
- Loading branch information
1 parent
57d7ad5
commit 8532698
Showing
25 changed files
with
338 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
caso_services: | ||
caso: | ||
container_name: caso | ||
group: caso | ||
enabled: true | ||
image: "{{ caso_image_full }}" | ||
volumes: | ||
- "{{ node_config_directory }}/caso/:{{ container_config_directory }}/" | ||
- "/etc/localtime:/etc/localtime:ro" | ||
- "caso_spool:/var/lib/caso" | ||
- "caso_ssm_outgoing:/var/spool/apel/outgoing/openstack" | ||
- "kolla_logs:/var/log/kolla/" | ||
dimensions: "{{ caso_dimensions }}" | ||
|
||
#################### | ||
# caso | ||
#################### | ||
caso_site_name: "kolla_caso" | ||
caso_logging_debug: "{{ openstack_logging_debug }}" | ||
caso_log_dir: "/var/log/kolla/caso" | ||
caso_cron_table: "10 * * * *" | ||
caso_messengers: | ||
- caso.messenger.logstash.LogstashMessenger | ||
|
||
#################### | ||
# OpenStack | ||
#################### | ||
caso_openstack_auth: "{{ openstack_auth }}" | ||
caso_keystone_user: "caso" | ||
caso_ks_users: | ||
- project: "service" | ||
user: "{{ caso_keystone_user }}" | ||
password: "{{ caso_keystone_password }}" | ||
role: "admin" | ||
|
||
#################### | ||
# Docker | ||
#################### | ||
caso_install_type: "{{ kolla_install_type }}" | ||
caso_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ caso_install_type }}-caso" | ||
caso_tag: "{{ openstack_tag }}" | ||
caso_image_full: "{{ caso_image }}:{{ caso_tag }}" | ||
caso_dimensions: "{{ default_container_dimensions }}" |
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: Restart caso container | ||
vars: | ||
service_name: "caso" | ||
service: "{{ caso_services[service_name] }}" | ||
config_json: "{{ caso_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}" | ||
caso_container: "{{ check_caso_containers.results|selectattr('item.key', 'equalto', service_name)|first }}" | ||
become: true | ||
kolla_docker: | ||
action: "recreate_or_restart_container" | ||
common_options: "{{ docker_common_options }}" | ||
name: "{{ service.container_name }}" | ||
image: "{{ service.image }}" | ||
volumes: "{{ service.volumes }}" | ||
dimensions: "{{ service.dimensions }}" | ||
when: | ||
- kolla_action != "config" | ||
- inventory_hostname in groups[service.group] | ||
- service.enabled | bool | ||
- config_json.changed | bool | ||
or caso_conf.changed | bool | ||
or caso_vom_conf.changed | bool | ||
or caso_crontab.changed | bool | ||
or caso_container.changed | bool |
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 @@ | ||
--- |
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,90 @@ | ||
--- | ||
- name: Ensuring config directories exist | ||
file: | ||
path: "{{ node_config_directory }}/{{ item.key }}" | ||
state: "directory" | ||
owner: "{{ config_owner_user }}" | ||
group: "{{ config_owner_group }}" | ||
mode: "0770" | ||
become: true | ||
when: | ||
- inventory_hostname in groups[item.value.group] | ||
- item.value.enabled | bool | ||
with_dict: "{{ caso_services }}" | ||
|
||
- name: Copying over config.json files for services | ||
template: | ||
src: "{{ item.key }}.json.j2" | ||
dest: "{{ node_config_directory }}/{{ item.key }}/config.json" | ||
mode: "0660" | ||
become: true | ||
register: caso_config_jsons | ||
when: | ||
- inventory_hostname in groups[item.value.group] | ||
- item.value.enabled | bool | ||
with_dict: "{{ caso_services }}" | ||
notify: | ||
- Restart caso container | ||
|
||
- name: Copying over caso config | ||
merge_configs: | ||
sources: | ||
- "{{ role_path }}/templates/caso.conf.j2" | ||
- "{{ node_custom_config }}//caso/caso.conf" | ||
- "{{ node_custom_config }}/{{ item.key }}/{{ inventory_hostname }}/caso.conf" | ||
dest: "{{ node_config_directory }}/{{ item.key }}/caso.conf" | ||
mode: "0660" | ||
become: true | ||
register: caso_conf | ||
when: | ||
- inventory_hostname in groups[item.value.group] | ||
- item.value.enabled | bool | ||
with_dict: "{{ caso_services }}" | ||
notify: | ||
- Restart caso container | ||
|
||
- name: Copying over caso crontab | ||
template: | ||
src: "{{ role_path }}/templates/caso.crontab.j2" | ||
dest: "{{ node_config_directory }}/{{ item.key }}/caso.crontab" | ||
mode: "0660" | ||
become: true | ||
register: caso_crontab | ||
when: | ||
- inventory_hostname in groups[item.value.group] | ||
- item.value.enabled | bool | ||
with_dict: "{{ caso_services }}" | ||
notify: | ||
- Restart caso container | ||
|
||
- name: Copying over caso voms file | ||
template: | ||
src: "{{ role_path }}/templates/voms.json.j2" | ||
dest: "{{ node_config_directory }}/{{ item.key }}/voms.json" | ||
mode: "0660" | ||
become: true | ||
register: caso_vom_conf | ||
when: | ||
- inventory_hostname in groups[item.value.group] | ||
- item.value.enabled | bool | ||
with_dict: "{{ caso_services }}" | ||
notify: | ||
- Restart caso container | ||
|
||
- name: Check caso containers | ||
become: true | ||
kolla_docker: | ||
action: "compare_container" | ||
common_options: "{{ docker_common_options }}" | ||
name: "{{ item.value.container_name }}" | ||
image: "{{ item.value.image }}" | ||
volumes: "{{ item.value.volumes }}" | ||
dimensions: "{{ item.value.dimensions }}" | ||
register: check_caso_containers | ||
when: | ||
- kolla_action != "config" | ||
- inventory_hostname in groups[item.value.group] | ||
- item.value.enabled | bool | ||
with_dict: "{{ caso_services }}" | ||
notify: | ||
- Restart caso container |
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_tasks: register.yml | ||
when: inventory_hostname in groups['caso'] | ||
|
||
- include_tasks: config.yml | ||
when: inventory_hostname in groups['caso'] | ||
|
||
- name: Flush handlers | ||
meta: flush_handlers | ||
|
||
- include_tasks: check.yml | ||
when: inventory_hostname in groups['caso'] |
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_tasks: "{{ kolla_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 @@ | ||
--- |
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,11 @@ | ||
--- | ||
- name: Pulling caso images | ||
become: true | ||
kolla_docker: | ||
action: "pull_image" | ||
common_options: "{{ docker_common_options }}" | ||
image: "{{ item.value.image }}" | ||
when: | ||
- inventory_hostname in groups[item.value.group] | ||
- item.value.enabled | bool | ||
with_dict: "{{ caso_services }}" |
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_tasks: deploy.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,7 @@ | ||
--- | ||
- import_role: | ||
name: service-ks-register | ||
vars: | ||
service_ks_register_auth: "{{ openstack_caso_auth }}" | ||
service_ks_register_users: "{{ caso_ks_users }}" | ||
tags: always |
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,5 @@ | ||
--- | ||
- include_tasks: config.yml | ||
|
||
- name: Flush handlers | ||
meta: flush_handlers |
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,23 @@ | ||
[DEFAULT] | ||
messengers = {{ caso_messengers|join(', ') }} | ||
site_name = {{ caso_site_name }} | ||
projects = {{ caso_projects|join(', ') }} | ||
debug = {{ caso_logging_debug }} | ||
log_file = caso.log | ||
log_dir = {{ caso_log_dir }} | ||
log_rotation_type = none | ||
spooldir = /var/lib/caso | ||
|
||
[keystone_auth] | ||
auth_type = password | ||
auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }} | ||
project_domain_id = {{ default_project_domain_id }} | ||
username = {{ caso_keystone_user }} | ||
user_domain_id = {{ default_user_domain_id }} | ||
password = {{ caso_keystone_password }} | ||
|
||
[logstash] | ||
port = {{ caso_tcp_output_port }} | ||
|
||
[ssm] | ||
output_path = /var/spool/apel/outgoing/openstack |
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 @@ | ||
{{ caso_cron_table }} caso-extract --config-file /etc/caso/caso.conf |
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,41 @@ | ||
{% set cron_cmd = 'cron -f' if kolla_base_distro in ['ubuntu', 'debian'] else 'crond -s -n' %} | ||
{ | ||
"command": "{{ cron_cmd }}", | ||
"config_files": [ | ||
{ | ||
"source": "{{ container_config_directory }}/caso.crontab", | ||
"dest": "/var/spool/cron/caso", | ||
"owner": "caso", | ||
"perm": "0600" | ||
}, | ||
{ | ||
"source": "{{ container_config_directory }}/caso.conf", | ||
"dest": "/etc/caso/caso.conf", | ||
"owner": "caso", | ||
"perm": "0600" | ||
}, | ||
{ | ||
"source": "{{ container_config_directory }}/voms.json", | ||
"dest": "/etc/caso/voms.json", | ||
"owner": "caso", | ||
"perm": "0600" | ||
} | ||
], | ||
"permissions": [ | ||
{ | ||
"path": "/var/log/kolla/caso", | ||
"owner": "caso:caso", | ||
"recurse": true | ||
}, | ||
{ | ||
"path": "/var/spool/apel/outgoing/openstack", | ||
"owner": "caso:caso", | ||
"recurse": true | ||
}, | ||
{ | ||
"path": "/var/lib/caso", | ||
"owner": "caso:caso", | ||
"recurse": 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,9 @@ | ||
{ | ||
"VO FQAN": { | ||
"projects": ["local tenant 1", "local tenant 2"] | ||
}, | ||
"VO NAME": { | ||
"projects": ["local tenant 3"] | ||
} | ||
} | ||
|
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,8 @@ | ||
<source> | ||
@type tcp | ||
tag apel.events | ||
port {{ caso_tcp_output_port }} | ||
bind 127.0.0.1 | ||
format /^(?<Payload>.*)$/ | ||
emit_unmatched_lines true | ||
</source> |
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,3 @@ | ||
"/var/log/kolla/caso/*.log" | ||
{ | ||
} |
Oops, something went wrong.