Skip to content

Instantly share code, notes, and snippets.

@mgedmin
Created June 14, 2021 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgedmin/c13ccb467cf3b47f2a62e468d2cd64ef to your computer and use it in GitHub Desktop.
Save mgedmin/c13ccb467cf3b47f2a62e468d2cd64ef to your computer and use it in GitHub Desktop.
Example of an Ansible playbook that uses group_by
---
- hosts: all
tasks:
- group_by: key="{{ 'using_letsencrypt' if letsencrypt_certs|default([]) else 'not_using_letsencrypt' }}"
changed_when: no
tags: always
- group_by: key="{{ ansible_distribution.lower() ~ '_' ~ ansible_distribution_release }}"
changed_when: no
tags: always
- hosts: using_letsencrypt:&ubuntu_xenial
roles:
- deadsnakes
- hosts: using_letsencrypt
roles:
- letsencrypt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment