1 of 14

TripleO Operator Ansible

Alex Schultz

May 2020

2 of 14

History

3 of 14

A bit of history ...

  • Historically TripleO users were on their own to wrap TripleO CLI actions for automation using ansible playbooks or even basic shell scripts
  • Relying on the users to implement their own automation concepts has lead to the same actions repeatedly being implemented in different ways

4 of 14

A bit of history, part deux...

  • A spec was proposed to implement Ansible roles that could be used by anyone to perform TripleO related actions
  • https://specs.openstack.org/openstack/tripleo-specs/specs/ussuri/tripleo-operator-ansible.html
  • This concept allows TripleO to distribute support automation building blocks to be used by end users
  • By recommending these building blocks and becoming consumers ourselves, we can ensure that end users automating TripleO will be performing actions in the same way we do.
  • While researching implementation options, Ansible Collections were announced...

5 of 14

Automate all the things

6 of 14

Ansible Collections

  • https://www.ansible.com/blog/getting-started-with-ansible-collections
  • Ansible collections provide a way to distribute multiple roles, plugins and functions within a single unit.
  • Collections can be installed or downloaded from Galaxy
  • We have created a “tripleo” namespace that can be used our collections https://galaxy.ansible.com/tripleo
  • For these roles, we have created the “tripleo.operator” namespace.

7 of 14

What do we automate?

  • The tripleo-operator-ansible automation is only a basic wrapper around the TripleO CLI actions
  • Variable naming concepts and patterns are universal to all implemented roles
  • End user specific logic is not included
  • The goal is to provide the basic roles for specific actions and not to implement entire workflows
  • Every user has their own workflows required, but everyone is ultimately doing same actions at some point
  • We are not implementing full deployment automation tooling
  • We want to create basic consumable units for users

8 of 14

What does that mean for me?

9 of 14

Consuming the roles

  • Starting with Ussuri, tripleo-operator-ansible has been packaged in RDO
  • At the end of Ussuri, we will be publishing the released version to Galaxy
  • https://docs.openstack.org/tripleo-operator-ansible/latest/
  • At the time of writing of this (end of Ussuri), the initial support for Ussuri and later has been created
  • The roles have been kept generic enough to likely be able to manage older versions of TripleO

10 of 14

Example Playbook

  • Playbooks can be written for common actions
  • Here is an example overcloud deploy playbook
  • Operators would be able to invoke this playbook via ansible-playbook or Ansible Tower to trigger overcloud deployments

###############################################################################

# Overcloud deploy playbook

###############################################################################

- hosts: undercloud

collections:

- tripleo.operator

vars:

deploy_debug: true

deploy_templates: /usr/share/openstack-tripleo-heat-templates/

deploy_controller_count: 1

deploy_compute_count: 1

deploy_dns: [‘1.1.1.1’, ‘8.8.8.8’]

deploy_ntp: [‘0.pool.ntp.org’, ‘1.pool.ntp.org’]

deploy_env_files:

- /usr/share/openstack-tripleo-heat-templates/environments/enable-swap.yaml

- /usr/share/openstack-tripleo-heat-templates/environments/docker-ha.yaml

- "{{ ansible_env.HOME }}/container-image-prepare.yaml"

- "{{ ansible_env.HOME }}/parameters.yaml"

tasks:

- name: Gather the rpm package facts

package_facts:

- name: Check if tripleoclient is installed

fail:

msg: >-

TripleO Client is not installed. Please make sure that the client

has been installed and the repositories are properly configured.

when: (ansible_facts.distribution_major_version|int <= 7 and not 'python2-tripleoclient' in ansible_facts.packages) or

(ansible_facts.distribution_major_version|int >= 8 and not 'python3-tripleoclient' in ansible_facts.packages)

- name: Generate parameters.yaml

copy:

content: |

parameter_defaults:

ControllerCount: {{ deploy_controller_count | default(1) }}

ComputeCount: {{ deploy_compute_count | default(1) }}

DnsServers: {{ deploy_dns }}

NtpServer: {{ deploy_ntp }}

dest: "{{ ansible_env.HOME }}/parameters.yaml"

- name: Run overcloud deployment

include_role:

name: tripleo_overcloud_deploy

vars:

tripleo_overcloud_deploy_debug: "{{ deploy_debug }}"

tripleo_overcloud_deploy_environment_files: "{{ deploy_env_files }}"

tripleo_overcloud_deploy_templates: "{{ deploy_templates }}"

11 of 14

What do we still need?

12 of 14

Keep them updated

  • When new CLI parameters or actions are created, roles need to be updated in tripleo-operator-ansible
  • Removing items should also be documented in tripleo-operator-ansible
  • https://docs.openstack.org/tripleo-operator-ansible/latest/roles.html
  • Current implementations for the ‘overcloud plan’ and ‘tripleo validator’ actions are still pending.

13 of 14

Integrate with them

  • Consume the roles!
  • Write playbooks and contribute them to the upstream
  • We have provided a few basic playbooks in the tripleo-operator-ansible repository to perform functions like undercloud installation, building overcloud images or deploying a standalone.
  • https://opendev.org/openstack/tripleo-operator-ansible/src/branch/master/playbooks

14 of 14

End

Thank you!

openstack

openstack

OpenStackFoundation

@OpenStack