Skip to content

Instantly share code, notes, and snippets.

@danrough
Created November 27, 2013 22:37
Show Gist options
  • Save danrough/7684367 to your computer and use it in GitHub Desktop.
Save danrough/7684367 to your computer and use it in GitHub Desktop.
Shows an implementation of the ansible template task which is iterated upon using a list of dictionary objects.
- name: Create the service init scripts yo
template: src=service_init_script.j2 dest=/etc/init.d/{{ item.service_name }} owner=root group=root mode=755
with_items:
- { service_name: paymentHandler, service_description: 'Handles payments', service_user: blackjack_attack, service_exec: "{{ application_directory }}/apps/paymentHandler.js" }
- { service_name: tablePool, service_description: 'The pool of tables available', service_user: blackjack_attack, service_exec: "{{ application_directory }}/apps/tablePool.js" }
- { service_name: userManager, service_description: 'Manages users, apparently', service_user: blackjack_attack, service_exec: "{{ application_directory }}/apps/userManager.js" }
sudo: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment