Skip to content

Instantly share code, notes, and snippets.

@anjanx44
Forked from VerosK/list-breakdown.yml
Created July 24, 2018 12:59
Show Gist options
  • Save anjanx44/d2f09b7fa1ed9c0d372f658a180c7463 to your computer and use it in GitHub Desktop.
Save anjanx44/d2f09b7fa1ed9c0d372f658a180c7463 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment