tomcat-instance: bootstrap instance are idempotent

This commit is contained in:
Victor LABORIE 2017-03-02 17:22:33 +01:00
parent 139165ee58
commit 483d3a8a9e
2 changed files with 11 additions and 16 deletions

View file

@ -4,6 +4,8 @@
path: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}/{{ item }}"
state: directory
mode: "2770"
owner: "{{ tomcat_instance_name }}"
group: "{{ tomcat_instance_name }}"
with_items:
- 'conf'
- 'logs'
@ -12,25 +14,25 @@
- 'temp'
- 'lib'
- name: Copy conf dir
shell: "cp /usr/share/tomcat7/skel/conf/* {{ tomcat_instance_root }}/{{ tomcat_instance_name }}/conf/"
- name: Copy server.xml
template:
src: 'templates/server.xml.j2'
dest: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}/conf/server.xml"
mode: "660"
owner: "{{ tomcat_instance_name }}"
group: "{{ tomcat_instance_name }}"
force: no
- name: Copy conf dir
shell: "cp /usr/share/tomcat7/skel/conf/* {{ tomcat_instance_root }}/{{ tomcat_instance_name }}/conf/"
args:
creates: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}/conf/catalina.properties"
- name: Copy env file
template:
src: 'templates/env.j2'
dest: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}/conf/env"
mode: "660"
- name: Fix owner
file:
name: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}"
state: directory
owner: "{{ tomcat_instance_name }}"
group: "{{ tomcat_instance_name }}"
recurse: yes
force: no

View file

@ -1,9 +1,4 @@
---
- stat:
path: "{{ tomcat_instance_root | mandatory }}/{{ tomcat_instance_name | mandatory }}"
#check_mode: no (for migration to Ansible 2.2)
always_run: yes
register: tomcat_instance_stat
- include: tomcat.yml
@ -16,7 +11,5 @@
- include: systemd.yml
- include: alias.yml
when: not tomcat_instance_stat.stat.exists
- include: bootstrap.yml
when: not tomcat_instance_stat.stat.exists