Add Heka to common role

Partially implements: blueprint heka
Change-Id: I9ddad09b3f16b323c7ed535243458b0de6620cdb
This commit is contained in:
Éric Lemoine 2016-02-03 11:52:46 +01:00 committed by Sam Yaple
parent 9ef1be1c38
commit 916925c9a8
10 changed files with 94 additions and 0 deletions

View File

@ -13,3 +13,7 @@ ansible_image_full: "{{ ansible_image }}:{{ ansible_tag }}"
rsyslog_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-rsyslog" rsyslog_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-rsyslog"
rsyslog_tag: "{{ openstack_release }}" rsyslog_tag: "{{ openstack_release }}"
rsyslog_image_full: "{{ rsyslog_image }}:{{ rsyslog_tag }}" rsyslog_image_full: "{{ rsyslog_image }}:{{ rsyslog_tag }}"
heka_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-heka"
heka_tag: "{{ openstack_release }}"
heka_image_full: "{{ heka_image }}:{{ heka_tag }}"

View File

@ -0,0 +1,23 @@
---
- name: Creating log volume
kolla_docker:
action: "create_volume"
common_options: "{{ docker_common_options }}"
name: "kolla_logs"
- name: Starting heka bootstrap container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
detach: False
environment:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
image: "{{ heka_image_full }}"
labels:
BOOTSTRAP:
name: "bootstrap_heka"
restart_policy: "never"
volumes:
- "{{ node_config_directory }}/heka/:{{ container_config_directory }}/:ro"
- "kolla_logs:/var/log/kolla/"

View File

@ -6,6 +6,7 @@
recurse: yes recurse: yes
with_items: with_items:
- "rsyslog" - "rsyslog"
- "heka"
- name: Copying over config.json files for services - name: Copying over config.json files for services
template: template:
@ -13,6 +14,7 @@
dest: "{{ node_config_directory }}/{{ item }}/config.json" dest: "{{ node_config_directory }}/{{ item }}/config.json"
with_items: with_items:
- "rsyslog" - "rsyslog"
- "heka"
- name: Copying over rsyslog.conf - name: Copying over rsyslog.conf
template: template:
@ -20,3 +22,10 @@
dest: "{{ node_config_directory }}/{{ item }}/{{ item }}.conf" dest: "{{ node_config_directory }}/{{ item }}/{{ item }}.conf"
with_items: with_items:
- "rsyslog" - "rsyslog"
- name: Copying over heka config files
template:
src: "heka-{{ item }}.toml.j2"
dest: "{{ node_config_directory }}/heka/heka-{{ item }}.toml"
with_items:
- "global"

View File

@ -1,4 +1,6 @@
--- ---
- include: config.yml - include: config.yml
- include: bootstrap.yml
- include: start.yml - include: start.yml

View File

@ -10,3 +10,9 @@
action: "pull_image" action: "pull_image"
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
image: "{{ ansible_image_full }}" image: "{{ ansible_image_full }}"
- name: Pulling heka image
kolla_docker:
action: "pull_image"
common_options: "{{ docker_common_options }}"
image: "{{ heka_image_full }}"

View File

@ -14,6 +14,18 @@
- "rsyslog:/var/log" - "rsyslog:/var/log"
- "rsyslog_socket:/var/lib/kolla/rsyslog/" - "rsyslog_socket:/var/lib/kolla/rsyslog/"
- name: Starting heka container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
image: "{{ heka_image_full }}"
name: "heka"
volumes:
- "{{ node_config_directory }}/heka/:{{ container_config_directory }}/:ro"
- "kolla_logs:/var/log/kolla/"
- "heka:/var/cache/hekad"
- "heka_socket:/var/lib/kolla/heka/"
- name: Starting kolla-toolbox container - name: Starting kolla-toolbox container
kolla_docker: kolla_docker:
action: "start_container" action: "start_container"

View File

@ -0,0 +1,19 @@
[hekad]
maxprocs = {{ ansible_processor_count * ansible_processor_cores }}
[syslog_encoder]
type = "SandboxEncoder"
filename = "lua_encoders/os_syslog.lua"
[syslog_log_decoder]
type = "SandboxDecoder"
filename = "lua_decoders/os_syslog.lua"
[syslog_log_decoder.config]
hostname = "{{ ansible_hostname }}"
[syslog_input]
type = "UdpInput"
net = "unixgram"
address = "/var/lib/kolla/heka/log"
decoder = "syslog_log_decoder"
splitter = "NullSplitter"

View File

@ -0,0 +1,11 @@
{
"command": "/usr/bin/hekad -config=/etc/heka/",
"config_files": [
{
"source": "{{ container_config_directory }}/heka-global.toml",
"dest": "/etc/heka/heka-global.toml",
"owner": "heka",
"perm": "0600"
}
]
}

View File

@ -11,6 +11,13 @@ if [[ ! "${!SKIP_LOG_SETUP[@]}" && -e /var/lib/kolla/rsyslog ]]; then
sudo ln -sf /var/lib/kolla/rsyslog/log /dev/log sudo ln -sf /var/lib/kolla/rsyslog/log /dev/log
fi fi
# Wait for the log socket
if [[ ! "${!SKIP_LOG_SETUP[@]}" && -e /var/lib/kolla/heka ]]; then
while [[ ! -S /var/lib/kolla/heka/log ]]; do
sleep 1
done
fi
# Processing /var/lib/kolla/config_files/config.json as root. This is necessary # Processing /var/lib/kolla/config_files/config.json as root. This is necessary
# to permit certain files to be controlled by the root user which should # to permit certain files to be controlled by the root user which should
# not be writable by the dropped-privileged user, especially /run_command # not be writable by the dropped-privileged user, especially /run_command

View File

@ -32,6 +32,7 @@ else
openvswitch_{vswitchd,db} \ openvswitch_{vswitchd,db} \
rabbitmq{,_bootstrap} \ rabbitmq{,_bootstrap} \
rsyslog \ rsyslog \
heka \
swift_{account_{auditor,reaper,replicator,server},container_{auditor,replicator,server,updater},object_{auditor,expirer,replicator,server,updater},proxy_server,rsyncd} swift_{account_{auditor,reaper,replicator,server},container_{auditor,replicator,server,updater},object_{auditor,expirer,replicator,server,updater},proxy_server,rsyncd}
) )
ceph_osd_bootstrap=$(docker ps -a --filter "name=bootstrap_osd_*" --format "{{.Names}}") ceph_osd_bootstrap=$(docker ps -a --filter "name=bootstrap_osd_*" --format "{{.Names}}")