forked from cliniconex/oscarEmrAnsible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oscar.yaml
70 lines (54 loc) · 2.73 KB
/
oscar.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# oscar.yaml
# Main run script that install all base software needed before
# install the oscar.deb package.
#===================================================================
# Copyright Jake Swart 2017 released under the MIT License
#===================================================================
---
# To run: ansible-playbook oscarEmrAnsible/oscar.yaml --ask-become-pass -i "localhost," -c local
- hosts: localhost
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_connection: local
become: true
become_user: root
roles:
- oscar
tasks:
#-----------------------------------------------------------------------
# Oscar 15 Download, Install, Configure
#-----------------------------------------------------------------------
- name: Allow OSCAR to be able to login without using the plugin to pass linux {{MYSQL_USER}} credentials
command: mysql -u{{MYSQL_USER}} -p{{MYSQL_PASSWORD}} -e "use mysql; update user set plugin='' where User='{{MYSQL_PASSWORD}}'; flush privileges;"
changed_when: false
- name: Ensure directory exists {{DOWN}}
file: path={{DOWN}} state=directory
- name: Prevent Redownload
stat: path={{DOWN}}/{{OSCAR_PACKAGE}}
register: stOscarDebFile
- name: Download Oscar
get_url:
dest: "{{DOWN}}/{{OSCAR_PACKAGE}}"
url: "http://sourceforge.net/projects/oscarmcmaster/files/Oscar%20Debian%2BUbuntu%20deb%20Package/{{OSCAR_PACKAGE}}"
validate_certs: no
when: stOscarDebFile.stat.exists is defined and not stOscarDebFile.stat.exists
- name: Prevent ReInstall
stat: path={{OSCAR_PROPERTIES}}
register: stOscarPropertiesFile
- block:
- name: Temporarily Store oscar-emr/password in debconf database
shell: echo "oscar-emr oscar-emr/password password {{MYSQL_PASSWORD}}" | debconf-set-selections
- name: Temporarily Store oscar-emr/demo=false in debconf database
shell: echo "oscar-emr oscar-emr/demo boolean false" | debconf-set-selections
- name: Install Oscar Debian Package
shell: DEBIAN_FRONTEND=noninteractive dpkg -i {{DOWN}}/{{OSCAR_PACKAGE}}
- name: Cleanup oscar-emr/password in debconf database
shell: echo "RESET oscar-emr/password" | debconf-communicate oscar-emr &>/dev/null
ignore_errors: yes
- name: Cleanup oscar-emr/demo in debconf database
shell: echo "RESET oscar-emr/demo" | debconf-communicate oscar-emr &>/dev/null
ignore_errors: yes
when: stOscarPropertiesFile.stat.exists is defined and not stOscarPropertiesFile.stat.exists and OSCAR_DEB_VERSION|int >= 694
- name: Install {{DOWN}}/{{OSCAR_PACKAGE}}
debug: msg="\n PRE-INSTALLATION COMPLETE. You must run 'sudo dpkg -i {{DOWN}}/{{OSCAR_PACKAGE}}' to install oscar!"
when: OSCAR_DEB_VERSION|int < 694