-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
90 changed files
with
8,137 additions
and
5,970 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
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,13 @@ | ||
Copyright 2014 Lionel Laské | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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,44 @@ | ||
# creates the vm instance | ||
|
||
- hosts: localhost | ||
tasks: | ||
- name: Creating Disk for VM instance | ||
gcp_compute_disk: | ||
name: sugarizer-disk | ||
size_gb: "{{ disk_size_gb }}" | ||
source_image: "{{ image }}" | ||
zone: "{{ zone }}" | ||
project: "{{ project_id }}" | ||
auth_kind: serviceaccount | ||
service_account_file: "{{ credentials_file }}" | ||
state: present | ||
register: disk | ||
|
||
- include_vars: | ||
file: gcp-start-script.yml | ||
|
||
- name: Creating GCP VM instance | ||
gcp_compute_instance: | ||
name: "{{ instance_names }}" | ||
zone: "{{ zone }}" | ||
machine_type: "{{ machine_type }}" | ||
disks: | ||
- auto_delete: 'true' | ||
boot: 'true' | ||
source: "{{ disk }}" | ||
network_interfaces: | ||
- network: null | ||
access_configs: | ||
- name: External NAT | ||
type: ONE_TO_ONE_NAT | ||
state: present | ||
metadata: | ||
startup-script: "{{ script }}" | ||
auth_kind: serviceaccount | ||
service_account_file: "{{ credentials_file }}" | ||
project: "{{ project_id }}" | ||
register: gce | ||
|
||
- name: Getting External IPs of hosts | ||
debug: | ||
msg: "ExternalIP = {{ gce.networkInterfaces[0].accessConfigs[0].natIP }}" |
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,15 @@ | ||
# creates the firewall rule | ||
|
||
- name: create a firewall | ||
hosts: localhost | ||
tasks: | ||
- gcp_compute_firewall: | ||
name: firewall-role | ||
allowed: | ||
- ip_protocol: tcp | ||
project: "{{ project_id }}" | ||
priority: "65534" | ||
direction: "INGRESS" | ||
auth_kind: serviceaccount | ||
service_account_file: "{{ credentials_file }}" | ||
state: present |
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 @@ | ||
script: 'apt update; | ||
apt install -y git; | ||
git clone https://github.com/llaske/sugarizer; | ||
git clone https://github.com/llaske/sugarizer-server; | ||
curl -fsSL https://get.docker.com/ | sh; | ||
curl -L "https://github.com/docker/compose/releases/download/1.8.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose; | ||
chmod +x /usr/local/bin/docker-compose; | ||
cd sugarizer-server; | ||
sh generate-docker-compose.sh; | ||
sleep 30s; | ||
docker-compose up -d' |
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,16 @@ | ||
USER=ksraj123 | ||
BRANCH=patch-1 | ||
|
||
REPO=sugarizer-server | ||
RELPATH=./ansible/deploy-to-gcp | ||
|
||
sudo apt-get update | ||
sudo apt-get install -y subversion | ||
svn export https://github.com/$USER/$REPO/branches/$BRANCH/$RELPATH | ||
|
||
# Installing Ansible and other dependencies throug pip | ||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | ||
python get-pip.py --user | ||
pip install --user ansible | ||
pip install requests google-auth | ||
rm get-pip.py |
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,16 @@ | ||
# Enter name of service account key file | ||
credentials_file: | ||
|
||
# Enter Project id | ||
project_id: | ||
|
||
# Modify project zone | ||
zone: "us-central1-a" | ||
|
||
# Modify name of the instance | ||
instance_names: "sugarizer-server" | ||
|
||
|
||
machine_type: "n1-standard-1" | ||
disk_size_gb: 20 | ||
image: "projects/debian-cloud/global/images/family/debian-9" |
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,4 @@ | ||
# master playbook | ||
|
||
- import_playbook: create-gcp-firewall.yml | ||
- import_playbook: create-gce-instance.yml |
Oops, something went wrong.