initial commit of stackdriver logging role for GCP

This commit is contained in:
Eric Anderson 2020-04-24 15:54:06 -07:00
commit 42a304bdda
16 changed files with 282 additions and 0 deletions

View file

@ -0,0 +1,25 @@
---
- name: Stackdriver Logging | Debian | Add the Stackdriver repository
apt_repository:
repo: "deb {{ stackdriver_log_apt_repo_url }} {{ stackdriver_log_apt_repo_name }} main"
filename: google-cloud-logging
state: present
- name: Stackdriver Logging | Debian | Ensure Stackdriver's GPG key is available.
apt_key:
url: "{{ stackdriver_log_apt_repo_url }}/doc/apt-key.gpg"
state: present
- name: Stackdriver Logging | Debian | Install the Stackdriver agent
apt:
name: "{{ stackdriver_log_package_name }}"
state: present
update_cache: yes
notify: Stackdriver Logging | Restart Stackdriver Agent
- name: Stackdriver Logging | Debian | Install the Stackdriver catch all config
apt:
name: "{{ stackdriver_log_config_name }}"
state: present
update_cache: yes
when: stackdriver_log_catch_all_conf

View file

@ -0,0 +1,20 @@
---
# tasks file for stackdriver_logging
- name: Stackdriver Logging | OS Based Installation
include_tasks: "{{ ansible_os_family|lower }}.yml"
- name: Stackdriver Logging | Install the Stackdriver defaults file
template:
src: default/google-fluentd
dest: /etc/default/google-fluentd
when: stackdriver_http_proxy is defined or
stackdriver_https_proxy is defined
- name: Stackdriver Logging | Install the logging files
template:
src: source.conf
dest: /etc/google-fluentd/config.d/{{ item.name }}.conf
loop: "{{ stackdriver_log_files }}"
when: stackdriver_log_files is defined
notify: Stackdriver Logging | Restart Stackdriver Agent

View file

@ -0,0 +1,20 @@
---
- name: Stackdriver Logging | RedHat | Install the Python bindings for SELinux
yum: name=libselinux-python state=present
- name: Stackdriver Logging | RedHat | Add the Stackdriver repository
yum_repository:
name: google-cloud-logging
description: Google Cloud Logging Agent Repository
baseurl: "{{ stackdriver_log_yum_repo }}"
file: google-cloud-logging
enabled: yes
gpgcheck: yes
repo_gpgcheck: yes
gpgkey: "{{ stackdriver_log_yum_gpg_key }}"
- name: Stackdriver Logging | RedHat | Install Stackdriver agent
yum:
name: "{{ stackdriver_log_package_name }}"
state: present
notify: Stackdriver Logging | Restart Stackdriver Agent