Skip to content

Instantly share code, notes, and snippets.

@alanorth
Created June 25, 2014 11:33
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 alanorth/5e6f5a3d181cf4742419 to your computer and use it in GitHub Desktop.
Save alanorth/5e6f5a3d181cf4742419 to your computer and use it in GitHub Desktop.
Deploy Tomcat config and application contexts with Ansible!
- name: Copy Tomcat config(s)
template: src={{ item.src }} dest={{ item.dest }} mode={{ item.mode }} owner=root group=root
with_items:
- { src: 'tomcat/server.xml.j2', dest: '/etc/tomcat7/server.xml', mode: '0644' }
- { src: 'tomcat/tomcat-users.xml.j2', dest: '/etc/tomcat7/tomcat-users.xml', mode: '0640' }
notify:
- restart tomcat7
tags: tomcat
- name: Prepare Tomcat web application contexts
template: src=tomcat/context.xml.j2 dest={{ item.context_path }}
with_items: dspace_webapps
when: dspace_webapps is defined
tags: tomcat
@0x46616c6b
Copy link

I prefer the array like syntax instead of one liners of strings. For actions with a many arguments its much clearer.

- name: Copy Tomcat config(s)
  template:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    # ...

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