Skip to content

Instantly share code, notes, and snippets.

@jctanner
Last active December 28, 2015 06:29
Show Gist options
  • Save jctanner/7457226 to your computer and use it in GitHub Desktop.
Save jctanner/7457226 to your computer and use it in GitHub Desktop.
language examples
=====================================================================
- name: install formulas
action: >
homebrew
{% if item is mapping %}
name={{item.name}} state=present
{% if 'options' in item %}
install_options={{item.options}}
{% endif %}
{% else %}
name={{item}} state=present
{% endif %}
with_items:
- macvim
- { name: aspell, options: "with-lang-fr,with-lang-en" }
=====================================================================
# LOOP LININFILE UNTIL NO MATCHES FOUND
- hosts: localhost
connection: local
gather_facts: False
vars:
lines:
- a
- a
- a
- a
tasks:
- shell: rm /tmp/listfile
ignore_errors: True
- shell: echo {{ item }} >> /tmp/listfile
with_items: lines
- lineinfile: dest=/tmp/listfile line="b" regexp='^a'
register: result
until: result.msg != "line replaced"
retries: 100
delay: 0
- debug: var=result
=====================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment