Giter Site home page Giter Site logo

gdlyan / yc-playground Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 265 KB

A collection of sampleTerraform configurations & Ansible playbooks for various infrastructure and application bootstrapping scenarios using Yandex Cloud platform

Dockerfile 0.11% Python 0.26% Shell 12.26% HCL 87.37%

yc-playground's Introduction

yc-playground

A collection of sample Terraform configurations & Ansible playbooks for various infrastructure and application bootstrapping scenarios using Yandex Cloud platform

Contents

Each subdirectory in this repository contains the configuration files for a specific scenario

All the configurations are tailored for quickstart. The user does not need to install and configure Terraform and Ansible packages locally because each example comes with shell files, such as ./dterraform and occasionally ./dansible-playbook, that use "docker run" to run Terraform and Ansible within containers. To make the full setup work, you only need to have Docker installed. While aware that such a setup is not advised for use in production, this is done on purpose.

Additionally, if Terraform and Ansible are already installed locally, you can use the standard Terraform and Ansible instructions instead.

Requirements

  • Linux / MacOS / Windows with WSL2 machine connected to Internet
  • Docker and optionally Compose
  • Yandex Cloud account that has a payment method activated, see how-to
  • Yandex Cloud CLI installed with curl -sSL https://storage.yandexcloud.net/yandexcloud-yc/install.sh | bash and initialized with yc init as explained in the Getting started with the YC CLI manual.
  • A pair of ssh keys whereas a public key would be uploaded to the provisioned virtual machines. Please note that ./dansible-playbook will fail with passphrase protected keys, this is a known issue. The workaround is either to avoid passphrase-encrypted private keys or to have Ansible installed locally and use regular ansible-playbook command
  • You will need to create a file ./terraform.tfvars with the following content:
token             = "<Yandex Cloud OAuth token, available from `yc config list` command>"
cloud_id          = "<ID of the cloud where the VPC would be spawned, available from `yc config list` command"
folder_id         = "<ID of the folder where the VPC would be spawned, available from `yc config list` command>"
default_user      = "non-root user to be created on the target VMs, defaulted to `ubuntu`"
private_key_file  = "not passphrase-encrypted private key file located in `~./ssh` directory, defaulted to `id_rsa`"

Basic usage

1. Navigate to the desired subdirectory and execute the following command once

./dterraform init

This will pull Terraform image from Docker Hub, spawn the Terraform container and install the required Terraform providers

2. Create infrastructure such as VPC, subnets, VMs and their network interfaces run

./dterraform apply -auto-approve

3. Run the Ansible plays that deploy additional packages and configurations to provisioned instances, if applicable

./dansible-playbook -i <playbook>.yml

4. Explore and test the scenario

The details of this step are determined by the scenario

5. Destroy infrastructure if you no longer need it

Run ./dterraform destroy -auto-approve and look into cloud console to ensure that no unnecessary infrastructure is causing unexpected charges

Also time to time run docker container prune command to remove the exited containers as you will unlikely need them any more

yc-playground's People

Contributors

gdlyan avatar

Watchers

Kostas Georgiou avatar  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.