tomcat-instance: bootstrap instance are idempotent
This commit is contained in:
parent
139165ee58
commit
483d3a8a9e
|
@ -4,6 +4,8 @@
|
||||||
path: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}/{{ item }}"
|
path: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}/{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "2770"
|
mode: "2770"
|
||||||
|
owner: "{{ tomcat_instance_name }}"
|
||||||
|
group: "{{ tomcat_instance_name }}"
|
||||||
with_items:
|
with_items:
|
||||||
- 'conf'
|
- 'conf'
|
||||||
- 'logs'
|
- 'logs'
|
||||||
|
@ -12,25 +14,25 @@
|
||||||
- 'temp'
|
- 'temp'
|
||||||
- 'lib'
|
- 'lib'
|
||||||
|
|
||||||
- name: Copy conf dir
|
|
||||||
shell: "cp /usr/share/tomcat7/skel/conf/* {{ tomcat_instance_root }}/{{ tomcat_instance_name }}/conf/"
|
|
||||||
|
|
||||||
- name: Copy server.xml
|
- name: Copy server.xml
|
||||||
template:
|
template:
|
||||||
src: 'templates/server.xml.j2'
|
src: 'templates/server.xml.j2'
|
||||||
dest: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}/conf/server.xml"
|
dest: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}/conf/server.xml"
|
||||||
mode: "660"
|
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
|
- name: Copy env file
|
||||||
template:
|
template:
|
||||||
src: 'templates/env.j2'
|
src: 'templates/env.j2'
|
||||||
dest: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}/conf/env"
|
dest: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}/conf/env"
|
||||||
mode: "660"
|
mode: "660"
|
||||||
|
|
||||||
- name: Fix owner
|
|
||||||
file:
|
|
||||||
name: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}"
|
|
||||||
state: directory
|
|
||||||
owner: "{{ tomcat_instance_name }}"
|
owner: "{{ tomcat_instance_name }}"
|
||||||
group: "{{ tomcat_instance_name }}"
|
group: "{{ tomcat_instance_name }}"
|
||||||
recurse: yes
|
force: no
|
||||||
|
|
|
@ -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
|
- include: tomcat.yml
|
||||||
|
|
||||||
|
@ -16,7 +11,5 @@
|
||||||
- include: systemd.yml
|
- include: systemd.yml
|
||||||
|
|
||||||
- include: alias.yml
|
- include: alias.yml
|
||||||
when: not tomcat_instance_stat.stat.exists
|
|
||||||
|
|
||||||
- include: bootstrap.yml
|
- include: bootstrap.yml
|
||||||
when: not tomcat_instance_stat.stat.exists
|
|
||||||
|
|
Loading…
Reference in a new issue