Whats New With Ansible Collections Diving into the How to use - - PowerPoint PPT Presentation

what s new with ansible collections
SMART_READER_LITE
LIVE PREVIEW

Whats New With Ansible Collections Diving into the How to use - - PowerPoint PPT Presentation

INSERT CONFIDENTIAL designator Whats New With Ansible Collections Diving into the How to use Collections with Ansible 2.9.10+ and beyond Andrius Benokraitis Iftikhar Khan Bradley Thornton Sr. Principal Product Manager Sr. Manager,


slide-1
SLIDE 1

INSERT CONFIDENTIAL designator

1

Diving into the “How” to use Collections with Ansible 2.9.10+ and beyond

What’s New With Ansible Collections

Andrius Benokraitis

  • Sr. Principal Product Manager

Bradley Thornton Chief Architect, Engineering Iftikhar Khan

  • Sr. Manager, Engineering
slide-2
SLIDE 2

INSERT CONFIDENTIAL designator

  • 1. Use Ansible 2.9.10+ with Collections
  • 2. Use fully qualified collection names in playbooks and roles
  • 3. Migrate standalone roles into Collections

What’s New with Ansible Collections

2

What we hope you get from this

slide-3
SLIDE 3

INSERT CONFIDENTIAL designator

The Red Hat Ansible Automation Platform

Runner

(Ansible-runner)

Ansible Engine

(Ansible)

Ansible Tower API and Tower UI

(AWX)

Receptor

(Project-receptor)

Automation Hub

(Galaxy)

Ansible Analytics Catalog ...

Ansible Content Experience

Molecule Ansible-lint Ansible-test IDE Integration

Ansible Content Collections

Network Security Cloud Windows Linux

Ansible Automation Ansible Cloud Services

slide-4
SLIDE 4

INSERT CONFIDENTIAL designator

Introducing the Ansible Collection

4

Simplified and consistent content schema

  • A standardized way to organize and

package Ansible content (roles, modules, module utilities, plugins, documentation)

  • Semantic versioning
  • Portable and flexible delivery
slide-5
SLIDE 5

INSERT CONFIDENTIAL designator

Before Collections

5

Bug/Improvement for module introduced proposed & merged Ansible 2.5 Ansible 2.6 Bug/Feature for module Now available 4-6 months

slide-6
SLIDE 6

INSERT CONFIDENTIAL designator

After Collections

6

Bug/Improvement for module introduced Content can be supported and installed immediately! Ansible 2.9 Ansible 2.10

slide-7
SLIDE 7

INSERT CONFIDENTIAL designator

What went where?

Automation and IT modernization

7

github.com/ansible/ansible github.com/ansible-collections/* github.com/{vendor}/* Ansible 2.9 github.com/ansible/ansible Ansible Base 2.10

Ansible 2.10

Ansible Galaxy Ansible Automation Hub

slide-8
SLIDE 8

INSERT CONFIDENTIAL designator

Distribution of Collections

8

Ansible Galaxy

galaxy.ansible.com

Ansible Automation Hub

cloud.redhat.com

  • Community supported
  • Extended to leverage

Collections framework

  • “Latest and greatest”
  • Certified, jointly supported by

Red Hat and Partner

  • Access to advanced analytics
  • “Slow and steady”
slide-9
SLIDE 9

INSERT CONFIDENTIAL designator

Cloud

Virt & Container

Windows Network Security Monitoring

Ansible automates technologies you use

Time to automate is measured in minutes, 50+ certified platforms

AWS Azure Digital Ocean Google OpenStack Rackspace +more Docker Kubernetes OpenStack OpenShift VMware +more ACLs Files Packages IIS Registry Shares Services Configs Users Domains Updates +more Arista Aruba Bigswitch Cisco Ericsson F5 FRR Juniper Meraki OpenvSwitch Ruckus VyOS +more Checkpoint Cisco CyberArk F5 Fortinet Juniper IBM Palo Alto Snort +more Dynatrace Datadog LogicMonitor New Relic Sensu +more Devops Jira GitHub Vagrant Jenkins Slack +more Storage Infinidat Netapp Pure Storage +more

Red Hat Products

RHEL Satellite Insights +more

slide-10
SLIDE 10

INSERT CONFIDENTIAL designator

What you need to know about using Collections

Collection Architecture

10

slide-11
SLIDE 11

INSERT CONFIDENTIAL designator

Collection Directory Structure

11

  • docs/: local documentation for the collection
  • galaxy.yml: source data for the MANIFEST.json that will be part of the collection package
  • playbooks/: playbook snippets

○ tasks/: holds 'task list files' for include_tasks/import_tasks usage

  • plugins/: all ansible plugins and modules go here, each in its own subdir

○ modules/: ansible modules ○ lookup/: lookup plugins ○ filter/: Jinja2 filter plugins ○ connection/: connection plugins required if not using default

  • roles/: directory for ansible roles
  • tests/: tests for the collection's content
  • meta/: metadata files including runtime.yml
slide-12
SLIDE 12

INSERT CONFIDENTIAL designator

Introducing meta/runtime.yml

12

AKA “tombstoning” or “collection routing” Supports collection runtime metadata:

  • Plugin (action, modules) routing, redirection, removal, and deprecation for collections
  • new /meta directory that contains runtime.yml
  • Identifies supported Ansible versions
  • Slated for release in Ansible Base 2.10

See: https:/ /github.com/ansible/ansible/pull/67684 for more info

slide-13
SLIDE 13

INSERT CONFIDENTIAL designator

What you need to know about using Collections

Playbook Writing with Collections

13

slide-14
SLIDE 14

INSERT CONFIDENTIAL designator

What’s in an Ansible Version?

14

Understanding which Ansible versions to use with Collections 1. Ansible 2.9.10 or later via Ansible Automation Platform (AAP) (June 2020) a. Ansible-maintained Collections are fully supported b. Contains some content but “frozen” c. Content fixes and enhancements are delivered in collections 2. Ansible Base 2.10, Ansible 2.10 (August, September 2020) a. ansible base + minimal, limited plugins 3. Ansible releases in Certified Containers (Execution Environments + AAP) (2021) a. ansible base + select collections + containerized 1 2 3

slide-15
SLIDE 15

INSERT CONFIDENTIAL designator

Playbook Developer Recommendations

Automation and IT modernization

15

1. Update build and installation scripts to install collections after installing Ansible

○ pip install ansible ○ ansible-galaxy collection install cisco.ios

2. Update host inventories to reflect connection and plugin collection name

○ ansible_network_os: cisco.ios.ios ○ ansible_connection: ansible.netcommon.network_cli

3. Use fully qualified plugin names in all tasks

○ cisco.ios.ios_vlans ○ newfact: "{{ data|corg.cname.filter_plugin }}"

4. Migrate all stand-alone roles into collections

○ ansible_collections/corg/cname/roles/myrole ○ include_role: corg.cname.myrole

slide-16
SLIDE 16

INSERT CONFIDENTIAL designator

Playbook Examples

16

# meta/runtime.yml from the cisco.ios collection: # # vlans: # redirect: cisco.ios.ios_vlans # # allows the use of 'short names' # use FQCN to ensure the collection is used on 2.9 tasks:

  • cisco.ios.vlans:

config: "{{ vlans }}" state: merged # as shown in docs and examples # this works with: # - 2.9.10 + collections # - 2.10 Base + collections # - 2.10 + collections # - execution environments # does not rely on any runtime.yml entries tasks:

  • cisco.ios.ios_vlans:

config: "{{ vlans }}" state: merged

Recommended Today (short-term) Future Usage (long-term) NOTE: Please use FQCN per task due to potential duplicate naming/ordering conflicts with Playbooks referencing multiple collections . The collections directive has other limitations, therefore FQCN is recommended.

slide-17
SLIDE 17

INSERT CONFIDENTIAL designator

Collection Author Recommendations

Automation and IT modernization

17

1. Identify, document and maintain a collections’ scope 2. Scaffold new collections: ansible-galaxy collection init corg.cname 3. Use Semantic versioning for collection versions: https:/ /semver.org/ 4. Update the collection’s meta/runtime.yml to reflect Ansible version compatibility a. Supports PEP440 Version Specifiers b.

requires_ansible: '>=2.9.10,<2.11' #requires Ansible 2.9.10+ and 2.10.x

5. Maintain a README.md, include collection contents 6. Use meta/runtime.yml for deprecation and redirection of plugins 7. Populate tags in galaxy.yml for easier discoverability in galaxy and AH

slide-18
SLIDE 18

INSERT CONFIDENTIAL designator

Resources and Getting Started

Automation and IT modernization

18

  • Collections User Guide and Collections Developer Guide

https:/ /docs.ansible.com/ansible/devel/user_guide/collections_using.html https:/ /docs.ansible.com/ansible/devel/dev_guide/developing_collections.html

  • The Bullhorn - Ansible Community Newsletter

https:/ /bit.ly/thebullhorn

  • Community Collections Overview

https:/ /github.com/ansible-collections/overview

  • Ansible.com Blog

https:/ /www.ansible.com/blog search for “Collection” (many results)

slide-19
SLIDE 19

INSERT CONFIDENTIAL designator

linkedin.com/company/red-hat youtube.com/user/RedHatVideos facebook.com/redhatinc twitter.com/RedHat

19

Red Hat is the world’s leading provider of enterprise

  • pen source software solutions. Award-winning support,

training, and consulting services make Red Hat a trusted adviser to the Fortune 500.

Thank you