-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
forgot to add ubuntu ansible playbooks
- Loading branch information
Showing
14 changed files
with
644 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
install ansible | ||
sudo yum install epel-release | ||
sudo yum install ansible | ||
install ansible modules | ||
ansible-galaxy collection install ansible.utils | ||
Edit /etc/ansible/hosts and add 127.0.0.1 |
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,95 @@ | ||
--- | ||
- name: GOFR Installation into /var/lib/gofr | ||
hosts: all | ||
# gather_facts: false | ||
tasks: | ||
- pause: | ||
prompt: "Please enter the name of the site without space" | ||
register: result | ||
until: result.user_input is not search(' ') | ||
retries: 3 | ||
delay: 0 | ||
- set_fact: | ||
site: "{{ result.user_input }}" | ||
|
||
- name: Clonning GOFR github repo | ||
git: | ||
repo: 'https://github.com/intrahealth/gofr.git' | ||
dest: /var/lib/gofr | ||
clone: yes | ||
force: yes | ||
|
||
- name: Creating GOFR backend site | ||
file: | ||
path: /var/lib/gofr/gofr-backend/{{site}} | ||
state: directory | ||
|
||
- name: Copying GOFR backend site | ||
copy: | ||
src: /var/lib/gofr/gofr-backend/lib/gofr-backend-site/ | ||
dest: /var/lib/gofr/gofr-backend/{{site}} | ||
|
||
- name: Creating GOFR frontend site | ||
file: | ||
path: /var/lib/gofr/gofr-gui/src/site | ||
state: directory | ||
|
||
- name: Copying GOFR frontend site | ||
copy: | ||
src: /var/lib/gofr/gofr-gui/src/gofr-frontend-site/ | ||
dest: /var/lib/gofr/gofr-gui/src/site | ||
|
||
- name: Installing npm packages into gofr-backend | ||
shell: | | ||
cd /var/lib/gofr/gofr-backend | ||
npm install | ||
- name: Installing npm packages into {{site}} | ||
shell: | | ||
cd /var/lib/gofr/gofr-backend/{{site}} | ||
npm install | ||
- name: Installing npm packages into gofr-gui | ||
shell: | | ||
cd /var/lib/gofr/gofr-gui | ||
npm install | ||
- name: Installing configuration | ||
copy: | ||
src: /var/lib/gofr/gofr-backend/{{site}}/config/default.json.example | ||
dest: /var/lib/gofr/gofr-backend/{{site}}/config/default.json | ||
|
||
- name: Reading configuration file | ||
ansible.builtin.set_fact: | ||
configfile: "{{ lookup('file', '/var/lib/gofr/gofr-backend/{{site}}/config/default.json') }}" | ||
|
||
- name: Updating configuration file | ||
ansible.utils.update_fact: | ||
updates: | ||
- path: configfile.app.site.path | ||
value: /var/lib/gofr/gofr-backend/{{site}} | ||
- path: configfile.mCSD.server.basePath | ||
value: fhir | ||
register: updated | ||
|
||
- name: Saving configuration file | ||
copy: content="{{ updated.configfile | to_nice_json }}" dest="/var/lib/gofr/gofr-backend/{{site}}/config/default.json" | ||
|
||
- name: Getting path of node | ||
command: which node | ||
register: node_path | ||
ignore_errors: yes | ||
|
||
- name: Install systemd template for gofr service | ||
template: | ||
src: gofr.service.j2 | ||
dest: /etc/systemd/system/gofr.service | ||
mode: 0755 | ||
force: yes | ||
|
||
- name: Start and Enable GOFR | ||
service: | ||
name: gofr | ||
state: started | ||
enabled: yes | ||
daemon_reload: yes |
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,118 @@ | ||
--- | ||
- name: HAPI FHIR Server | ||
hosts: all | ||
# become: true | ||
tags: prep | ||
|
||
tasks: | ||
|
||
- name: Add the OS specific variables | ||
include_vars: | ||
file: index.yaml | ||
|
||
- name: hapi folder exists | ||
stat: | ||
path: /tmp/hapi-fhir-jpaserver-starter | ||
register: stat_result2 | ||
|
||
|
||
- name: git clone repo hapi-jpa-server-starter | ||
git: | ||
repo: 'https://github.com/hapifhir/hapi-fhir-jpaserver-starter.git' | ||
dest: /tmp/hapi-fhir-jpaserver-starter | ||
clone: yes | ||
force: yes | ||
when: stat_result2.stat.exists == False | ||
|
||
|
||
- name: git pull if updated | ||
git: | ||
repo: 'https://github.com/hapifhir/hapi-fhir-jpaserver-starter.git' | ||
dest: /tmp/hapi-fhir-jpaserver-starter | ||
update: yes | ||
force: yes | ||
|
||
|
||
- name: git checkout v{{hapi_ver}} | ||
shell: git checkout v{{hapi_ver}} | ||
args: | ||
chdir: /tmp/hapi-fhir-jpaserver-starter | ||
|
||
|
||
- name: install application.yaml template for hapi jpa Server | ||
template: | ||
src: ../570-application.yaml | ||
dest: /tmp/hapi-fhir-jpaserver-starter/src/main/resources/application.yaml | ||
owner: "tomcat" | ||
group: "tomcat" | ||
mode: 0755 | ||
force: yes | ||
|
||
|
||
- name: Building hapi-fhir | ||
shell: /opt/maven/bin/mvn clean install --no-transfer-progress --batch-mode package -DskipTests | ||
args: | ||
chdir: /tmp/hapi-fhir-jpaserver-starter | ||
environment: | ||
MAVEN_OPTS: -Xmx2048m | ||
|
||
|
||
# stop tomcat | ||
- name: stop tomcat | ||
service: | ||
name: tomcat | ||
state: stopped | ||
become: true | ||
|
||
# pause to let tomcat stop | ||
- pause: | ||
seconds: 10 | ||
|
||
|
||
# move default ROOT into ROOT-Closed | ||
- name: move default ROOT into ROOT-Closed | ||
file: | ||
path: /opt/tomcat{{tomcat_v_num}}/webapps/ROOT | ||
state: absent | ||
|
||
- name: move war file to /opt/tomcat{{tomcat_v_num}}/webapps/ | ||
shell: cp ROOT.war /opt/tomcat{{tomcat_v_num}}/webapps/ | ||
args: | ||
chdir: /tmp/hapi-fhir-jpaserver-starter/target/ | ||
become: true | ||
|
||
|
||
- name: create lucene target | ||
ansible.builtin.file: | ||
path: /opt/tomcat{{tomcat_v_num}}/target | ||
state: directory | ||
# needs broad perms | ||
mode: '0777' | ||
owner: tomcat | ||
group: tomcat | ||
become: true | ||
|
||
- name: create lucenefiles | ||
ansible.builtin.file: | ||
path: /opt/tomcat{{tomcat_v_num}}/target/lucenefiles | ||
state: directory | ||
mode: '0777' | ||
owner: tomcat | ||
group: tomcat | ||
become: true | ||
|
||
- name: restart tomcat | ||
systemd: | ||
name: tomcat | ||
state: started | ||
|
||
- pause: | ||
seconds: 10 | ||
|
||
- name: status | ||
command: systemctl status tomcat.service | ||
register: status | ||
|
||
|
||
- debug: | ||
msg: "{{ status.stdout_lines }}" |
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,42 @@ | ||
--- | ||
- name: Install Apache Maven on CentOS | ||
hosts: all | ||
|
||
tasks: | ||
- name: Add the OS specific variables | ||
include_vars: | ||
file: index.yaml | ||
|
||
- name: Download Apache Maven | ||
get_url: | ||
url: "https://archive.apache.org/dist/maven/maven-{{maven_v_num}}/{{maven_ver}}/binaries/apache-maven-{{maven_ver}}-bin.tar.gz" | ||
dest: "/tmp/apache-maven-{{maven_ver}}-bin.tar.gz" | ||
mode: '0644' | ||
|
||
- name: Extract Apache Maven | ||
ansible.builtin.unarchive: | ||
src: "/tmp/apache-maven-{{maven_ver}}-bin.tar.gz" | ||
dest: "/opt/" | ||
remote_src: yes | ||
creates: "/opt/apache-maven-{{maven_ver}}" | ||
|
||
- name: Create Symbolic Link for Maven | ||
ansible.builtin.file: | ||
src: "/opt/apache-maven-{{maven_ver}}" | ||
dest: "/opt/maven" | ||
state: link | ||
|
||
- name: Set Environment Variables for Maven | ||
ansible.builtin.copy: | ||
content: | | ||
export M2_HOME=/opt/maven | ||
export M2=$M2_HOME/bin | ||
export PATH=$M2:$PATH | ||
dest: "/etc/profile.d/maven.sh" | ||
notify: Reload Environment Variables | ||
|
||
handlers: | ||
- name: Reload Environment Variables | ||
shell: source /etc/profile.d/maven.sh | ||
args: | ||
executable: /bin/bash |
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,58 @@ | ||
--- | ||
- name: Install PostgreSQL 9 or above | ||
hosts: all | ||
remote_user: root | ||
become: yes | ||
|
||
tasks: | ||
|
||
- name: Install PostgreSQL | ||
apt: | ||
name: ['postgresql', 'postgresql-contrib'] | ||
state: present | ||
|
||
- name: Start and enable PostgreSQL | ||
systemd: | ||
name: postgresql | ||
enabled: yes | ||
state: started | ||
|
||
- name: Gather PostgreSQL Information | ||
become: true | ||
become_user: postgres | ||
community.postgresql.postgresql_info: | ||
register: postgres_info | ||
|
||
- name: Create a new database with name hapi | ||
postgresql_db: | ||
name: hapi | ||
become: true | ||
become_user: postgres | ||
|
||
- name: Create hapi user, and grant access to hapi database | ||
no_log: true | ||
postgresql_user: | ||
db: hapi | ||
name: hapi | ||
password: hapi | ||
priv: ALL | ||
become: true | ||
become_user: postgres | ||
|
||
- name: Allow md5 connection for the db user | ||
postgresql_pg_hba: | ||
dest: "/etc/postgresql/{{postgres_info.version.major}}/main/pg_hba.conf" | ||
contype: host | ||
databases: all | ||
method: md5 | ||
users: hapi | ||
create: true | ||
become: yes | ||
become_user: postgres | ||
notify: restart postgresql | ||
|
||
handlers: | ||
- name: restart postgresql | ||
systemd: | ||
name: postgresql | ||
state: restarted |
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,53 @@ | ||
--- | ||
- name: Installing supporting packages | ||
hosts: all | ||
become: yes | ||
|
||
tasks: | ||
|
||
- name: Updating apt cache | ||
apt: | ||
update_cache: yes | ||
|
||
- name: Install basic packages | ||
apt: | ||
name: ['git', 'python3-psycopg2'] | ||
state: present | ||
|
||
- name: Install Redis | ||
apt: | ||
name: redis-server | ||
state: present | ||
|
||
- name: Start redis | ||
service: | ||
name: redis | ||
state: started | ||
enabled: yes | ||
|
||
- name: Download NodeSource setup script | ||
get_url: | ||
url: https://deb.nodesource.com/setup_18.x | ||
dest: /tmp/setup_node.sh | ||
|
||
- name: Execute NodeSource setup script | ||
command: /bin/bash /tmp/setup_node.sh | ||
|
||
- name: Install Node.js | ||
apt: | ||
name: nodejs | ||
state: present | ||
|
||
- name: Remove temporary setup script | ||
file: | ||
path: /tmp/setup_node.sh | ||
state: absent | ||
|
||
# - name: Install npm | ||
# apt: | ||
# name: npm | ||
# state: present | ||
|
||
- name: Install fsh-sushi | ||
shell: | | ||
npm install -g fsh-sushi |
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,11 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
# this only works for vagrant ubuntu instances (localhost) | ||
# --forks 1 to stop hosts checking on first run: https://github.com/ansible/ansible/issues/25068 | ||
ansible-playbook prep.yaml --connection=local | ||
ansible-playbook postgresinstall.yaml --connection=local | ||
ansible-playbook tomcat.yaml --connection=local | ||
ansible-playbook maven.yaml --connection=local | ||
ansible-playbook hapi.yaml --connection=local | ||
ansible-playbook gofr.yaml --connection=local |
Oops, something went wrong.