Created
May 21, 2020 01:16
-
-
Save luckylittle/eba28b63f3ee0add19c70364abead5a5 to your computer and use it in GitHub Desktop.
Red Hat Ansible Tower - passing Sumologic accessID/accessKEY from the Microsoft Azure Key Vault to the playbook example
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
--- | |
# Tested on Ansible 2.9.4 & Tower 3.6.4 | |
# Passing Sumologic accessID/accessKEY from the Microsoft Azure Key Vault to the playbook example | |
# Copyright (c) 2020 Lucian Maly, Red Hat | |
# Configuration in Tower: | |
# 1) Credentials > prod-ansible-azure-kms: | |
# a/ VAULT URL (DNS NAME) | |
# b/ CLIENT ID | |
# c/ CLIENT SECRET | |
# d/ TENANT ID | |
# | |
# 2) Credential types > Sumo Logic Access Key: | |
# a/ INPUT CONFIGURATION: | |
# fields: | |
# - id: accessId | |
# type: string | |
# label: Access ID | |
# secret: true | |
# - id: accessKey | |
# type: string | |
# label: Access Key | |
# secret: true | |
# required: | |
# - accessId | |
# - accessKey | |
# b/ INJECTOR CONFIGURATION: | |
# extra_vars: | |
# accessid: '{{ accessId }}' | |
# accesskey: '{{ accessKey }}' | |
# | |
# 3) Credentials > sumo-logic-collector | |
# a/ CREDENTIAL TYPE: Sumo Logic Access Key | |
# b/ ACCESS ID: prod-ansible-azure-kms | |
# c/ ACCESS KEY: prod-ansible-azure-kms | |
- hosts: all | |
gather_facts: no | |
become: true | |
vars: | |
sumo_rpm_url: "https://collectors.au.sumologic.com/rest/download/rpm/64" | |
sumo_custom_resources_path: "/opt/SumoCollector/custom-sources" | |
sumo_properties_file: "/opt/SumoCollector/config/user.properties" | |
tasks: | |
- name: 1.0 | SUMOLOGIC | Install the SumoCollector RPM. | |
yum: | |
name: "{{ sumo_rpm_url }}" | |
state: present | |
tags: | |
- sumologic | |
- name: 2.0 | SUMOLOGIC | Create a folder {{ sumo_custom_resources_path }}. | |
file: | |
path: "{{ sumo_custom_resources_path }}" | |
state: directory | |
tags: | |
- sumologic | |
- name: 3.0 | SUMOLOGIC | Set the 'accessid' and 'accesskey'. | |
lineinfile: | |
path: "{{ sumo_properties_file }}" | |
regexp: "{{ item.regexp }}" | |
line: "{{ item.line }}" | |
no_log: true | |
loop: | |
- { "regexp": "^accessid=", "line": "accessid={{ accessid }}" } | |
- { "regexp": "^accesskey=", "line": "accesskey={{ accesskey }}" } | |
tags: | |
- sumologic | |
- name: 4.0 | SUMOLOGIC | Copy the file 'eamcs-ansible-sumo-sources.json'. | |
copy: | |
src: files/eamcs-ansible-sumo-sources.json | |
dest: "{{ sumo_custom_resources_path }}/eamcs-ansible-sumo-sources.json" | |
owner: root | |
group: root | |
mode: '0644' | |
tags: | |
- sumologic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment