From 3185fa5bd5a92318153e9f0a509e350d85795406 Mon Sep 17 00:00:00 2001 From: Michael Zalewski Date: Fri, 20 Oct 2017 17:20:14 -0400 Subject: [PATCH] quartz-scheduler creates the datasource in wildfly --- roles/quartz_scheduler/files/quartz-ds.cli | 22 ++++++++++++++++++++++ roles/quartz_scheduler/tasks/main.yml | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 roles/quartz_scheduler/files/quartz-ds.cli diff --git a/roles/quartz_scheduler/files/quartz-ds.cli b/roles/quartz_scheduler/files/quartz-ds.cli new file mode 100644 index 0000000..bbd77a3 --- /dev/null +++ b/roles/quartz_scheduler/files/quartz-ds.cli @@ -0,0 +1,22 @@ +connect + +if (outcome == failed) of /subsystem=datasources/data-source=quartz-ds:read-resource + \ + /subsystem=datasources/data-source=quartz-ds:add( \ + jndi-name=java:jboss/datasources/quartz-ds, \ + jta=true, \ + enabled=true, \ + use-ccm=false, \ + \ + driver-name=postgresql92-jdbc.jar, \ + driver-class=org.postgresql.Driver, \ + \ + connection-url=jdbc:postgresql://localhost:5432/DB_NAME, \ + user-name=DB_USER, \ + password=DB_PASS, \ + \ + share-prepared-statements=false, \ + validate-on-match=false, \ + background-validation=false \ + ) +end-if diff --git a/roles/quartz_scheduler/tasks/main.yml b/roles/quartz_scheduler/tasks/main.yml index ce8094c..c09783d 100644 --- a/roles/quartz_scheduler/tasks/main.yml +++ b/roles/quartz_scheduler/tasks/main.yml @@ -34,3 +34,23 @@ command: "psql -U vagrant -w -f {{ item }} -d {{ db_name }}" with_items: - ~/quartz_tables_postgres.sql + +- name: Copy Quartz Datasource CLI + copy: src=../files/quartz-ds.cli + dest=~ + mode=0775 + +- name: Update database name in Quartz Datasource CLI + replace: + path: ~/quartz-ds.cli + regexp: "{{ item.regexp }}" + replace: "{{ item.replace }}" + with_items: + - { regexp: 'DB_NAME', replace: "{{ db_name }}" } + - { regexp: 'DB_USER', replace: "{{ db_user }}" } + - { regexp: 'DB_PASS', replace: "{{ db_user_pw }}" } + +- name: Install Quartz Datasource + shell: chdir=~ {{ ansible_local.build_vars.wildfly.wildfly_prog_directory }}/jboss-cli.sh --file="{{ item }}" + with_items: + - quartz-ds.cli -- GitLab