Add Heka to common role
Partially implements: blueprint heka Change-Id: I9ddad09b3f16b323c7ed535243458b0de6620cdb
This commit is contained in:
parent
9ef1be1c38
commit
916925c9a8
@ -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_tag: "{{ openstack_release }}"
|
||||
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 }}"
|
||||
|
23
ansible/roles/common/tasks/bootstrap.yml
Normal file
23
ansible/roles/common/tasks/bootstrap.yml
Normal 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/"
|
@ -6,6 +6,7 @@
|
||||
recurse: yes
|
||||
with_items:
|
||||
- "rsyslog"
|
||||
- "heka"
|
||||
|
||||
- name: Copying over config.json files for services
|
||||
template:
|
||||
@ -13,6 +14,7 @@
|
||||
dest: "{{ node_config_directory }}/{{ item }}/config.json"
|
||||
with_items:
|
||||
- "rsyslog"
|
||||
- "heka"
|
||||
|
||||
- name: Copying over rsyslog.conf
|
||||
template:
|
||||
@ -20,3 +22,10 @@
|
||||
dest: "{{ node_config_directory }}/{{ item }}/{{ item }}.conf"
|
||||
with_items:
|
||||
- "rsyslog"
|
||||
|
||||
- name: Copying over heka config files
|
||||
template:
|
||||
src: "heka-{{ item }}.toml.j2"
|
||||
dest: "{{ node_config_directory }}/heka/heka-{{ item }}.toml"
|
||||
with_items:
|
||||
- "global"
|
||||
|
@ -1,4 +1,6 @@
|
||||
---
|
||||
- include: config.yml
|
||||
|
||||
- include: bootstrap.yml
|
||||
|
||||
- include: start.yml
|
||||
|
@ -10,3 +10,9 @@
|
||||
action: "pull_image"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
image: "{{ ansible_image_full }}"
|
||||
|
||||
- name: Pulling heka image
|
||||
kolla_docker:
|
||||
action: "pull_image"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
image: "{{ heka_image_full }}"
|
||||
|
@ -14,6 +14,18 @@
|
||||
- "rsyslog:/var/log"
|
||||
- "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
|
||||
kolla_docker:
|
||||
action: "start_container"
|
||||
|
19
ansible/roles/common/templates/heka-global.toml.j2
Normal file
19
ansible/roles/common/templates/heka-global.toml.j2
Normal 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"
|
11
ansible/roles/common/templates/heka.json.j2
Normal file
11
ansible/roles/common/templates/heka.json.j2
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
@ -11,6 +11,13 @@ if [[ ! "${!SKIP_LOG_SETUP[@]}" && -e /var/lib/kolla/rsyslog ]]; then
|
||||
sudo ln -sf /var/lib/kolla/rsyslog/log /dev/log
|
||||
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
|
||||
# to permit certain files to be controlled by the root user which should
|
||||
# not be writable by the dropped-privileged user, especially /run_command
|
||||
|
@ -32,6 +32,7 @@ else
|
||||
openvswitch_{vswitchd,db} \
|
||||
rabbitmq{,_bootstrap} \
|
||||
rsyslog \
|
||||
heka \
|
||||
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}}")
|
||||
|
Loading…
Reference in New Issue
Block a user