Skip to content

Instantly share code, notes, and snippets.

@krdlab
Created May 2, 2022 09:44
Show Gist options
  • Save krdlab/415b32889e3b3e124baae0f7d06613e9 to your computer and use it in GitHub Desktop.
Save krdlab/415b32889e3b3e124baae0f7d06613e9 to your computer and use it in GitHub Desktop.
Ansible で差集合を作る
- hosts: localhost
connection: local
gather_facts: false
vars_files:
- group_vars/{{ stage }}/all.yml
- group_vars/{{ stage }}/aws.yml
tasks:
- set_fact:
r5: "{{ aws.ec2.searches | selectattr('instance_type', 'match', '^r5\\..+') | list }}"
- debug:
msg: "{{ aws.ec2.searches | reject('in', r5) | list }}" # NOTE: searches - r5 になる
@krdlab
Copy link
Author

krdlab commented May 2, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment