You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hetzner-ansible/pmci-kibana-create-objects.yml

172 lines
5.0 KiB
YAML

---
# Parameters:
# playbook inventory
# stage := the name of the stage (e.g. dev, int, qa, prod)
# tenant := object with tenant related data
# key :=
# name :=
# cluster := object with cluster specific data (optional)
# ...
# data := object with action specific data (optional)
# ...
# smardigo message callback
# scope_id := (scope id of the management process)
# process_instance_id := (process instance id of the management process)
# smardigo_management_action := (smardigo management action anme of the management process)
#############################################################
# Creating inventory dynamically for given parameters
#############################################################
- import_playbook: pmci-inventory-cluster.yml
#############################################################
# Running the PMCI roles
#############################################################
- hosts: "stage_{{ stage }}:!{{ stage }}-virtual-host-to-read-groups-vars"
serial: "{{ serial_number | default(1) }}"
gather_facts: no
remote_user: root
vars:
ansible_connection: local
ansible_ssh_host: "{{ stage_server_domain }}"
tenant_id: "{{ tenant.key }}" # legacy paramater, backwards compatibility
cluster_name: "{{ cluster.key }}" # legacy paramater, backwards compatibility
cluster_service: "{{ cluster.service }}"
elastic_state: present
elastic_users:
-
username: '{{ stage }}-{{ tenant_id }}'
roles:
- '{{ stage }}-{{ tenant_id }}'
full_name: ''
password: '{{ password | default( stage + "-" + tenant_id ) }}'
email: '{{ email | default("") }}'
enabled: true
elastic_state: '{{ elastic_state }}'
elastic_roles:
-
elastic_state: '{{ elastic_state }}'
name: '{{ stage }}-{{ tenant_id }}'
elasticsearch:
cluster: []
indices:
- names:
- '{{ stage }}-{{ tenant_id }}-*'
privileges:
- read
- read_cross_cluster
- view_index_metadata
allow_restricted_indices: false
run_as: []
kibana:
- base: []
feature:
advancedSettings:
- all
dashboard:
- all
dev_tools:
- all
discover:
- all
indexPatterns:
- all
savedObjectsManagement:
- all
visualize:
- all
spaces:
- '{{ stage }}-{{ tenant_id }}'
elastic_spaces:
-
elastic_state: '{{ elastic_state }}'
id: &es_space_name '{{ stage }}-{{ tenant_id }}'
name: '{{ stage }}-{{ tenant_id }}'
description: ''
disabledFeatures:
- canvas
- maps
- ml
- visualize
- enterpriseSearch
- logs
- infrastructure
- apm
- uptime
- observabilityCases
- siem
- monitoring
- fleet
- stackAlerts
- actions
- osquery
- savedObjectsTagging
es_index_pattern_tenant: '{{ stage }}-{{ tenant_id }}-{{ cluster_name }}-*'
es_index_pattern_services:
- id: "{{ stage }}-{{ tenant_id }}-{{ cluster_name }}-*-{{ cluster_service }}-*"
name: "{{ cluster_service }}"
tasks:
- name: "Do some stuff in elastic with spaces ... "
include_role:
name: kibana
tasks_from: _configure_spaces.yml
apply:
tags:
- es-spaces
loop: "{{ elastic_spaces }}"
loop_control:
loop_var: elastic_space
tags:
- es-spaces
- name: "Do some stuff in elastic with roles ..."
include_role:
name: kibana
tasks_from: _configure_roles.yml
apply:
tags:
- es-roles
loop: "{{ elastic_roles }}"
loop_control:
loop_var: elastic_role
tags:
- es-roles
- name: "Do some stuff in elastic with users ..."
include_role:
name: kibana
tasks_from: _configure_users.yml
apply:
tags:
- es-users
loop: "{{ elastic_users }}"
loop_control:
loop_var: elastic_user
tags:
- es-users
- name: "Do some stuff in elastic with spaces ..."
include_role:
name: kibana
tasks_from: _import_savedobjects.yml
apply:
tags:
- es-importobjects
vars:
es_space: *es_space_name
es_indexpattern_title: '{{ es_indexpattern_name }}'
es_index_pattern_tenant_uuid: '{{ es_index_pattern_tenant | to_uuid }}'
es_panel_uuid: "{{ 'panel_' + es_dashboard_name | to_uuid }}"
tags:
- es-importobjects
#############################################################
# Sending smardigo management message to process
#############################################################
- import_playbook: pmci-callback.yml