Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/openhie/facility-recon in…
Browse files Browse the repository at this point in the history
…to facility-recon-datim
  • Loading branch information
ashaban committed Aug 15, 2018
2 parents e6cc163 + e0435e2 commit 5b734ee
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packaging/ansible/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Ansible (CentOS only)

To use Ansible, your SSH public key should be in `.ssh/authorized_keys` on the remote host and you must also create an /etc/ansible/hosts or similar with the IP address or hostname of the remote host. An `ansible/hosts` file that has an entry for localhost and one server would be:

```sh
[local]
localhost ansible_connection=local

[servers]
172.16.174.137
```
The above example includes a working example for localhost configuration.

## Installation

Prerequisites (designed for CentoOS only):
```sh
ansible-playbook -i /usr/local/etc/ansible/hosts prep_centos.yaml
```

Install the backend, frontend, and prepare the DHIS2 web application (in-progress):
```sh
ansible-playbook --ask-become-pass -i /usr/local/etc/ansible/hosts install.yaml
```

44 changes: 44 additions & 0 deletions packaging/ansible/install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
- name: Install facility reconciliation tool
hosts: all
remote_user: "{{ user }}"
tags: install

vars_prompt:
- name: "user"
prompt: "Please enter the username (without sudo)"
private: no

tasks:

- git:
repo: 'https://github.com/intrahealth/hearth.git'
dest: $HOME/hearth
clone: yes
update: yes

- git:
repo: 'https://github.com/openhie/facility-recon.git'
dest: $HOME/facility-recon
clone: yes
update: yes

- name: Backend - Update packages based on package.json.
npm:
path: $HOME/facility-recon/facility-recon-backend
state: latest

# run

- name: Frontend - Update packages based on package.json.
npm:
path: $HOME/facility-recon/facility-recon-gui
state: latest

# run



# cp -r facility-recon/facility-recon-gui/dist/* facility-reco/dhis2App/
# cd facility-recon/dhis2App
# zip GOFR.zip ./*
76 changes: 76 additions & 0 deletions packaging/ansible/prep_centos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
- name: Preparation for facility reconciliation
hosts: all
remote_user: "{{ user }}"
become: true
tags: prep

vars_prompt:
- name: "user"
prompt: "Please enter the username (with sudo)"
private: no

tasks:

- name: Ensure git
yum:
name: git
state: present


- name: Ensure wget
yum:
name: wget
state: present


- name: Ensure unzip
yum:
name: unzip
state: present


- name: Download nodesource script for node v8
get_url:
url: https://rpm.nodesource.com/setup_8.x
dest: $HOME/nodesource.sh
mode: 0644


- name: Install nodesource and node 8
command: bash $HOME/nodesource.sh
register: hello


- debug: msg="{{ hello.stdout_lines }}"


- name: Ensure node
yum:
name: nodejs
state: present


# this ties the version to 3.6
# see https://docs.mongodb.com/v3.6/tutorial/install-mongodb-on-red-hat/
- name: Add repository for mongo
yum_repository:
name: mongodb-org-3.6
description: MongoDB Repository
baseurl: https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/
gpgcheck: yes
gpgkey: https://www.mongodb.org/static/pgp/server-3.6.asc
enabled: yes


- name: install mongodb
yum:
name: mongodb-org
state: present


- name: run mongodb
service:
name: mongod
state: started
enabled: yes

0 comments on commit 5b734ee

Please sign in to comment.