---
version: '2.0'
name: tripleo.swift_ring.v1
description: Rebalance and distribute Swift rings using Ansible


workflows:
  rebalance:
    tags:
      - tripleo-common-managed

    input:
      - container: overcloud
      - work_dir: /var/lib/mistral

    tasks:
      get_private_key:
        action: tripleo.validations.get_privkey
        on-success: deploy_rings

      deploy_rings:
        action: tripleo.ansible-playbook
        publish:
          output: <% task().result %>
        input:
          ssh_private_key: <% task(get_private_key).result %>
          verbosity: 1
          remote_user: tripleo-admin
          become: true
          become_user: root
          playbook: /usr/share/tripleo-common/playbooks/swift_ring_rebalance.yaml
          inventory: <% $.get('work_dir') %>/<% $.get('container') %>/tripleo-ansible-inventory.yaml
          use_openstack_credentials: true
          execution_id: <% execution().id %>
