Skip to content

Instantly share code, notes, and snippets.

@davidbirdsong
Created June 6, 2013 23:41
Show Gist options
  • Save davidbirdsong/5725936 to your computer and use it in GitHub Desktop.
Save davidbirdsong/5725936 to your computer and use it in GitHub Desktop.
attempt at building a variable on the end node of a list of mounts i'm interested in
---
- hosts: all
sudo: yes
tasks:
- name: mount filter
set_fact:
args:
mounts="{{ x['mount'] for x in ansible_mounts if x['mount'].endswith('da3') }}"
- name: echo each mount
debug: msg="{{'mount ' + item }}"
with_items: $mounts
- name: echo all mounts
debug: msg=$mounts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment