Skip to content

Instantly share code, notes, and snippets.

View ernesen's full-sized avatar

Ernese Norelus ernesen

  • Synpulse
View GitHub Profile
cd ~/artefacts/employee/src/main/java/com/ibm/example/employee/api
cp HealthApiController.java HealthApiController.java.old
cp EmployeesApiController.java EmployeesApiController.java.old
sed -i "s/NOT_IMPLEMENTED/OK/" HealthApiController.java
sed -i "s/NOT_IMPLEMENTED/OK/" EmployeesApiController.java
#!/bin/sh
sudo apt-get update && sudo apt-get upgrade -y
# jq is a sed-like tool that is specifically built to deal with JSON format.
sudo apt-get install jq -y
# install the latest version of the IBM Cloud CLI tool by issuing the command, make sure you have a minimum version of Docker 1.13.1 installed before installing this tool.
curl -sL http://ibm.biz/idt-installer | bash
---
swagger: '2.0' #version of Swagger
info: # High Level information of API
description: Sample Swagger Demo #Give the description of API
version: 1.0.0 #API version
title: Swagger Employee Demo # API title
license: #Swagger license info
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
host: localhost # Host Name
ssh-keygen -t rsa -b 2048 -f ~/.ssh/MyKeyPair.pem -q -P ''
chmod 400 ~/.ssh/MyKeyPair.pem
ssh-keygen -y -f ~/.ssh/MyKeyPair.pem > ~/.ssh/MyKeyPair.pub
# This is where we configure the instance with ansible-playbook
# Jenkins requires Java to be installed
provisioner "local-exec" {
command = <<EOT
sleep 30;
>java.ini;
echo "[java]" | tee -a java.ini;
echo "${aws_instance.jenkins-ci.public_ip} ansible_user=${var.ansible_user} ansible_ssh_private_key_file=${var.private_key}" | tee -a java.ini;
export ANSIBLE_HOST_KEY_CHECKING=False;
ansible-playbook -u ${var.ansible_user} --private-key ${var.private_key} -i java.ini ../playbooks/install_java.yaml
# Ansible requires Python to be installed on the remote machine as well as the local machine.
provisioner "remote-exec" {
inline = ["sudo apt-get -qq install python -y"]
}
connection {
private_key = "${file(var.private_key)}"
user = "ubuntu"
}
---
- name: Install GitLab
hosts: gitLab
become: true
tasks:
- name: Checking to make sure postfix is installed
apt:
name:
- postfix
---
- name: Install Jenkins
hosts: jenkins-ci
gather_facts: false
become: true
tasks:
- name: Ensure the jenkins apt repository key is installed
apt_key:
url: https://pkg.jenkins.io/debian-stable/jenkins.io.key
---
- name: Install Oracle Java version 8
hosts: java
become: true
tasks:
- name: Install dependencies
become: yes
apt:
name: "{{ packages }}"
variable "profile" {
default = "terraform_iam_user"
}
variable "region" {
default = "ap-southeast-1"
}
variable "instance" {
default = "t2.nano"