GithubHelp home page GithubHelp logo

gcp_infra's Introduction

infra

Infrastructure repo for projects in GCP

To manually create instance with bash startup script deploy,run:

gcloud compute instances create --boot-disk-size=10GB --image=reddit-base-1505470643 --image-project=ubuntu-os-cloud --machine-type=g1-small --tags puma-server --restart-on-failure --zone=europe-west1-b --metadata-from-file startup-script=startup_script.sh reddit-app

To create instance image with installed MongoDB and Ruby,run:

packer build -var "project_id=%your_project_here%" -var "source_image=%your_source_image_here%" packer/ubuntu16.json

Заметки по использованию terraform

В main.tf описана либо напрямую конфигурация инфраструктуры,либо пути к модулям.Обязательным является описание провайдера. В outputs.tf описаны переменные,которые будут получены из созданной в результате работы terraform инфраструктуры (ip адреса,etc). В terraform.tfstate хранится текущая конфигурация инфраструктуры,исходя из которой при terraform plan вычисляются необходимые действия для приведения состояния в целевое. В variables.tf описаны переменные,которые используются в описаниях инфраструктуры,в terraform.tfvars находятся эти значения переменных.

Для использования ansible dynamic inventory c GCE :

  1. Создать Service Account (https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount)

  2. Скачать JSON credentials (https://support.google.com/cloud/answer/6158849?hl=en&ref_topic=6262490#serviceaccounts)

  3. Скачать gce.py gce.ini из гита ansible : https://github.com/ansible/ansible/tree/devel/contrib/inventory

  4. Положить скачанное в директорию (например, ./inventory),указать в ansible.cfg : inventory = ./inventory

  5. chmod +x gce.py

  6. Заполнить gce.ini (" и ' использовать не нужно): gce_service_account_email_address = данные из json gce_service_account_pem_file_path = /full_path_to_json(из пункта 2) gce_project_id = данные из json

  7. Проверка : ./gce.py --list

  8. Получение информации об инстансах: ansible all -m setup

gcp_infra's People

Contributors

gsergeevich avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.