Ansible bits to rsyslog

Ansible installation of rsyslog container

Change-Id: I17a7ee679f72e8fe667012d7eb6e07a27098a909
Implements: bp logging-container
This commit is contained in:
inc0 2015-08-20 12:35:19 +02:00 committed by Michal Jastrzebski
parent 6f9709ce9c
commit 4a75d05de1
5 changed files with 80 additions and 0 deletions

8
ansible/roles/common/defaults/main.yml Normal file → Executable file
View File

@ -5,3 +5,11 @@
ansible_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-kolla-ansible" ansible_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-kolla-ansible"
ansible_tag: "{{ openstack_release }}" ansible_tag: "{{ openstack_release }}"
ansible_image_full: "{{ ansible_image }}:{{ ansible_tag }}" 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 }}"
log_data_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-data"
log_data_tag: "{{ openstack_release }}"
log_data_image_full: "{{ log_data_image }}:{{ log_data_tag }}"

View File

@ -0,0 +1,11 @@
---
- name: Ensuring config directory exists
file:
path: "{{ node_config_directory }}/rsyslog/"
state: "directory"
recurse: "yes"
- name: Copying over config(s)
template:
src: "rsyslog.conf.j2"
dest: "{{ node_config_directory }}/rsyslog/rsyslog.conf"

3
ansible/roles/common/tasks/main.yml Normal file → Executable file
View File

@ -1,2 +1,5 @@
--- ---
- include: config.yml
- include: start.yml - include: start.yml

44
ansible/roles/common/tasks/start.yml Normal file → Executable file
View File

@ -1,4 +1,46 @@
--- ---
- name: Starting log_data container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: log_data
image: "{{ log_data_image_full }}"
volumes:
- "/var/log"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
- name: Starting rsyslog container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: rsyslog
image: "{{ rsyslog_image_full }}"
volumes_from:
- "log_data"
volumes:
- "/var/lib/kolla/dev:/dev"
- "{{ node_config_directory }}/rsyslog/:/opt/kolla/rsyslog/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
- name: Starting Ansible container - name: Starting Ansible container
docker: docker:
docker_api_version: "{{ docker_api_version }}" docker_api_version: "{{ docker_api_version }}"
@ -16,4 +58,6 @@
env: env:
ANSIBLE_NOCOLOR: "1" ANSIBLE_NOCOLOR: "1"
ANSIBLE_LIBRARY: "/usr/share/ansible" ANSIBLE_LIBRARY: "/usr/share/ansible"
volumes:
- /var/lib/kolla/dev/log:/dev/log
command: "/bin/sleep infinity" command: "/bin/sleep infinity"

View File

@ -0,0 +1,14 @@
# provides support for local system logging
$ModLoad imuxsock
$ModLoad imklog
$KLogPermitNonKernelFacility on
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$RepeatedMsgReduction on
$template KollaAnsibleFile,"/var/log/kolla_ansible.log"
:syslogtag,contains,"ansible" ?KollaAnsibleFile
$template DynFile,"/var/log/syslog.log"
*.* ?DynFile
& ~