tripleo-common/workbooks/skydive-ansible.yaml
James Slagle 678d564619 Pass execution_id to tripleo.ansible-playbook.
Passing the execution_id to the tripleo.ansible-playbook action will
make it such that the execution_id is included in any messages sent on
the queue.

This is needed so that when tripleoclient filters by execution id to
discard messages that are not from workflows it did not start, won't be
shown.

The tripleoclient patch to filter on execution_id is
https://review.openstack.org/#/c/605520/, but first we must land this
patch so that execution_id is added an input to these actions.

Change-Id: Icbe80c338d69efc6ce8fceb0f73f833bec588536
Related-Bug: #1794277
2018-11-09 14:50:24 -07:00

75 lines
3.2 KiB
YAML

---
version: '2.0'
name: tripleo.skydive_ansible.v1
description: TripleO manages Skydive with skydive-ansible
workflows:
skydive_install:
# allows for additional extra_vars via workflow input
input:
- ansible_playbook_verbosity: 0
- ansible_extra_env_variables:
ANSIBLE_ROLES_PATH: /usr/share/skydive-ansible/roles/
ANSIBLE_RETRY_FILES_ENABLED: 'False'
ANSIBLE_LOG_PATH: /var/log/mistral/skydive-install-workflow.log
ANSIBLE_HOST_KEY_CHECKING: 'False'
- skydive_ansible_extra_vars: {}
- skydive_ansible_playbook: /usr/share/skydive-ansible/playbook.yml.sample
tags:
- tripleo-common-managed
tasks:
set_blacklisted_ips:
publish:
blacklisted_ips: <% env().get('blacklisted_ip_addresses', []) %>
on-success: set_ip_lists
set_ip_lists:
publish:
agent_ips: <% let(root => $) -> env().get('service_ips', {}).get('skydive_agent_ctlplane_node_ips', []).where(not ($ in $root.blacklisted_ips)) %>
analyzer_ips: <% let(root => $) -> env().get('service_ips', {}).get('skydive_analyzer_ctlplane_node_ips', []).where(not ($ in $root.blacklisted_ips)) %>
on-success: enable_ssh_admin
enable_ssh_admin:
workflow: tripleo.access.v1.enable_ssh_admin
input:
ssh_servers: <% ($.agent_ips + $.analyzer_ips).toSet() %>
on-success: get_private_key
get_private_key:
action: tripleo.validations.get_privkey
publish:
private_key: <% task().result %>
on-success: set_fork_count
set_fork_count:
publish: # unique list of all IPs: make each list a set, take unions and count
fork_count: <% min($.agent_ips.toSet().union($.analyzer_ips.toSet()).count(), 100) %> # don't use >100 forks
on-success: set_role_vars
set_role_vars:
publish:
# NOTE(sbaubeau): collect role settings from all tht roles
agent_vars: <% env().get('role_merged_configs', {}).values().select($.get('skydive_agent_ansible_vars', {})).aggregate($1 + $2) %>
analyzer_vars: <% env().get('role_merged_configs', {}).values().select($.get('skydive_analyzer_ansible_vars', {})).aggregate($1 + $2) %>
on-success: build_extra_vars
build_extra_vars:
publish:
# NOTE(sbaubeau): merge vars from all ansible roles
extra_vars: <% $.agent_vars + $.analyzer_vars + $.skydive_ansible_extra_vars %>
on-success: skydive_install
skydive_install:
action: tripleo.ansible-playbook
input:
inventory:
agents:
hosts: <% $.agent_ips.toDict($, {}) %>
analyzers:
hosts: <% $.analyzer_ips.toDict($, {}) %>
playbook: <% $.skydive_ansible_playbook %>
remote_user: tripleo-admin
become: true
become_user: root
verbosity: <% $.ansible_playbook_verbosity %>
forks: <% $.fork_count %>
ssh_private_key: <% $.private_key %>
extra_env_variables: <% $.ansible_extra_env_variables %>
extra_vars: <% $.extra_vars %>
execution_id: <% execution().id %>
publish:
output: <% task().result %>