Skip to content

Instantly share code, notes, and snippets.

@deekayen
Created August 7, 2018 21:38
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 deekayen/d0660cdeec2cb5ab55996d21a5e887bf to your computer and use it in GitHub Desktop.
Save deekayen/d0660cdeec2cb5ab55996d21a5e887bf to your computer and use it in GitHub Desktop.
Ansible: loop through a string list. Could be useful for creating lots of EC2 instances passed from a textarea in Ansible Tower.
---
- hosts: all
connection: local
vars:
stuff: "asdf
asdfasdf
asdfasdfasdf
asdfasdfasdf
asdfasdfasdf
asdfasdf"
tasks:
- name: with_nested -> loop
debug:
msg: "{{ item }}"
loop: "{{ stuff.split(' ') }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment