-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from icatproject-contrib/install-icat-db-triggers
Add ability to install ICAT DB triggers via a variable
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
- name: "Import: Check payara is running" | ||
import_tasks: "{{ role_path }}/../payara/tasks/status.yml" | ||
|
||
- name: "Stop payara if it is running" | ||
shell: "/usr/local/bin/payara-init stop" | ||
become: true | ||
become_user: root | ||
args: | ||
chdir: /root | ||
executable: /bin/bash | ||
when: payaraStatus.rc == 0 | ||
|
||
- name: Attempt to install Maria DB triggers | ||
block: | ||
- name: "Install db triggers" | ||
shell: "mysql --user={{ db_root_username }} --password={{ db_root_password }} --database={{ icat_database }} < /home/{{ payara_user }}/install/icat.server/create_triggers_mysql_5_0.sql" | ||
become: true | ||
become_user: root | ||
args: | ||
chdir: /root | ||
executable: /bin/bash | ||
- name: "Set fact on host to record that database triggers have been instantiated" | ||
ini_file: | ||
path: /etc/ansible/facts.d/local.fact | ||
section: "instantiations" | ||
option: "icat_server_db_triggers" | ||
value: "true" | ||
no_extra_spaces: true | ||
create: false | ||
when: ansible_local.local.instantiations.mariadb is defined and ansible_local.local.instantiations.mariadb == 'true' | ||
always: | ||
- name: "Start payara if it was running at the beginning of this script" | ||
shell: "/usr/local/bin/payara-init start" | ||
become: true | ||
become_user: root | ||
args: | ||
chdir: /root | ||
executable: /bin/bash | ||
when: payaraStatus.rc == 0 |