- name: Add datasources
command: {{ jboss_home }}/bin/jboss-cli.sh -c controller={{ jboss_master }}:{{ jboss_master_port }} --user={{ admin_user }} --password={{ admin_password }} --command="data-source add --jndi-name={{ item.jndi_name }} --name={{ item.ds_name}} --connection-url={{ item.conn_url }} --driver-name={{ item.driver_name }} --user-name={{ item.dsusername }} --password={{ item.dspassword }} --profile={{ item.ds_profile }}"
with_items:
- { some vars }
- { another vars }
- ...ansible-playbook -i testing install-all.yml
ansible-playbook -i production install-all.yml command: some_command_with_vars
with_items:
- { some_item }
when: {{ env }}
command: some_command_with_vars
with_items_in:
- {{ env }}.yml
ansible-playbook -i testing install-all.yml
# Actual Wildfly master node
[master]
wfy01
# Actual Wildfly slave nodes
[slave]
wfy02
wfy03
- name: Configure the Wildfly master node
hosts: master #write three file with master-prd, master-dev, master-val ?
user: root
roles:
- master
[all:vars]
env=production #or validation, testing
datasources:
FirstDS:
jndi_name: 'FirstDSjndiName'
ds_name: 'FirstDSName'
conn_url: 'FirstDSConnURL'
driver_name: 'FirstDSdriver'
dsusername: 'FirstDSUser'
dspassword: 'FirstDSpassword'
SecondDS:
[...]
- name: Include "{{ env }}" datasources dict
include_vars: "vars/{{ env }}.yml"
Hope this helps,
Jon