Skip to content

Instantly share code, notes, and snippets.

@VerosK
Created March 29, 2014 12:53
Show Gist options
  • Save VerosK/9853931 to your computer and use it in GitHub Desktop.
Save VerosK/9853931 to your computer and use it in GitHub Desktop.
Ansible: Broke string to list
---
- hosts: localhost
vars:
facter_blockdevices: sda,sdb,sdc,sdd,sde,sdf
gather_facts: no
tasks:
- name: Separate facts
set_fact: blockdevices="{{facter_blockdevices.split(',')}}"
- name: Show the devices
shell: echo {{ item }}
with_items: blockdevices
@kenny-ngo
Copy link

Thank you for the useful information

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