Hi,
I use a generic playbook for provisionning multiple tomcat instance
Many applications using this same playbook for provisionning tomcat
environnment.
Each application have a yaml file description of their own configuration
like this :
MyApplication.yml
_______________________________________________________________________________________________________
app_name: hr
app_version: 1.2
j2ee:
j2ee_listen_port: 8888
j2ee_jvm_xms: 512M
j2ee_jvm_xmx: 1024M
...
...
...
db:
sql:
oracle_db:
oracle_hostname: mydbhost
oracle_information: "a little information about application"
oracle_schema: MySchema
oracle_listener_port: 1521
oracle_j2ee_service_name: J2EE_SERVICE
oracle_j2ee_username: ********
oracle_j2ee_password: ********
oracle_j2ee_ds_maxActive: 20
oracle_j2ee_ds_maxIdle: 10
oracle_j2ee_ds_maxWait: -1
oracle_j2ee_hibernate_jpa_dialect:
org.hibernate.dialect.Oracle10gDialect
oracle_j2ee_hibernate_jpa_showsql: true
oracle_j2ee_jndi_name: jdbc/dba
_______________________________________________________________________________________________________
I have a first playbook named "main.yml" who test if host is in group of
application
_______________________________________________________________________________________________________
- include: install.yml app_file_config=MyApplication.yml
when: inventory_hostname in groups['appli-MyApplication']
- include: install.yml app_file_config=MyApplication2.yml
when: inventory_hostname in groups['appli-MyApplication2']
- include: install.yml app_file_config=MyApplication3.yml
when: inventory_hostname in groups['appli-MyApplication3']
_______________________________________________________________________________________________________
and a second playbook "install.yml" who run tasks for install and configure
tomcat instance
_______________________________________________________________________________________________________
- include_vars: "conf/{{ app_file_config}}" ## app_config_file=
"MyApplication.yml"
- file: path={{ data_project_directory }}/tomcat/{{ app_name}}/"{{ item }}
state=directory group={{ tomcat_os_group }} owner={{ tomcat_os_user }}
with_items:
- work
- webapps
- temp
- logs
- conf/hub
- bin
- lib
...
...
- template: src="{{item.directory}}/{{item.dest}}.j2" dest="{{
data_project_directory }}/tomcat/{{ tomcat_appname
}}/{{item.directory}}/{{item.dest}}" group={{ tomcat_os_group }} owner={{
tomcat_os_user }} mode={{item.mod}}
with_items:
- { directory: "bin", dest: "setenv.sh", mod: 740 }
- { directory: "bin", dest: "shutdown.sh" , mod: 740 }
- { directory: "bin", dest: "startup.sh" , mod: 740 }
- { directory: "conf", dest: "catalina.properties", mod: 640 }
- { directory: "conf", dest: "context.xml", mod: 640 }
- { directory: "conf", dest: "logging.properties", mod: 640 }
- { directory: "conf", dest: "server.xml", mod: 640 }
- { directory: "conf", dest: "tomcat-users.xml", mod: 640 }
- { directory: "conf", dest: "web.xml", mod: 640 }
....
_______________________________________________________________________________________________________
I Need to adapt playbook to integrate Different "channel / corridor" for
each application
the configuration file might look like this :
_______________________________________________________________________________________________________
app_name:
app_channel:
-
channel: 1
app_version: 1.2
sql:
- oracle_db:
.....
.....
-
channel: 2
app_version: 1.3
sql:
- oracle_db:
.....
.....
_______________________________________________________________________________________________________
I try to re-use my playbook for integrate channel support but I don't know
how to make ?
I need to use module include in combinaison of "with_items" but the option
is deprecated and now forbidden by ansible..
So I try to loop's over channel on each tasks but I don't know how to make
? (combinaison of with_items and with_dicts)
example :
- file: path={{ data_project_directory }}/tomcat/{{ app_name}}/{{channel}}/"{{
item }} state=directory group={{ tomcat_os_group }} owner={{ tomcat_os_user
}}
with_items:
- work
- webapps
- temp
- logs
- conf/hub
- bin
- lib
with_dicts: app_channel
Anyone have a Idea how to produce this ??
Thx
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/276e570b-d454-4026-aa8a-96cef825f073%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.