Adding ability to start and plumb splunk instance (#12183)

This commit is contained in:
John Westcott IV
2022-05-09 09:50:28 -04:00
committed by GitHub
parent 385a94866c
commit a86740c3c9
6 changed files with 113 additions and 2 deletions

View File

@@ -0,0 +1,51 @@
---
- name: Plumb a splunk instance
hosts: localhost
connection: local
gather_facts: False
vars:
awx_host: "https://localhost:8043"
collections:
- splunk.es
tasks:
- name: create splunk_data_input_network
splunk.es.data_input_network:
name: "9199"
protocol: "tcp"
source: "http:tower_logging_collections"
sourcetype: "httpevent"
state: "present"
vars:
ansible_network_os: splunk.es.splunk
ansible_user: admin
ansible_httpapi_pass: splunk_admin
ansible_httpapi_port: 8089
ansible_httpapi_use_ssl: yes
ansible_httpapi_validate_certs: False
ansible_connection: httpapi
- name: Load existing and new Logging settings
set_fact:
existing_logging: "{{ lookup('awx.awx.controller_api', 'settings/logging', host=awx_host, verify_ssl=false) }}"
new_logging: "{{ lookup('template', 'logging.json.j2') }}"
- name: Display existing Logging configuration
debug:
msg:
- "Here is your existing SAML configuration for reference:"
- "{{ existing_logging }}"
- pause:
prompt: "Continuing to run this will replace your existing logging settings (displayed above). They will all be captured except for your connection password. Be sure that is backed up before continuing"
- name: Write out the existing content
copy:
dest: "../_sources/existing_logging.json"
content: "{{ existing_logging }}"
- name: Configure AWX logging adapter
awx.awx.settings:
settings: "{{ new_logging }}"
controller_host: "{{ awx_host }}"
validate_certs: False

View File

@@ -27,3 +27,5 @@ ldap_diff_dir: '{{ sources_dest }}/ldap_diffs'
ldap_public_key_file: '{{ ldap_cert_dir }}/{{ ldap_public_key_file_name }}'
ldap_private_key_file: '{{ ldap_cert_dir }}/{{ ldap_private_key_file_name }}'
ldap_cert_subject: "/C=US/ST=NC/L=Durham/O=awx/CN="
enable_splunk: false

View File

@@ -122,6 +122,19 @@ services:
- 'openldap_data:/bitnami/openldap'
- '../../docker-compose/_sources/ldap_certs:/opt/bitnami/openldap/certs'
- '../../docker-compose/_sources/ldap_diffs:/opt/bitnami/openldap/ldiffs'
{% endif %}
{% if enable_splunk|bool %}
splunk:
image: splunk/splunk:latest
container_name: tools_splunk_1
hostname: splunk
ports:
- "8000:8000"
- "8089:8089"
- "9199:9199"
environment:
SPLUNK_START_ARGS: --accept-license
SPLUNK_PASSWORD: splunk_admin
{% endif %}
# A useful container that simply passes through log messages to the console
# helpful for testing awx/tower logging

View File

@@ -0,0 +1,10 @@
{
"LOG_AGGREGATOR_HOST": "splunk",
"LOG_AGGREGATOR_PORT": 9199,
"LOG_AGGREGATOR_TYPE": "splunk",
"LOG_AGGREGATOR_USERNAME": "admin",
"LOG_AGGREGATOR_PASSWORD": "splunk_admin",
"LOG_AGGREGATOR_ENABLED": true,
"LOG_AGGREGATOR_PROTOCOL": "tcp",
"LOG_AGGREGATOR_VERIFY_CERT": false,
}