/home

My home environment.

Primary LanguageHCL

home

Codacy Badge Ansible Lint Packer VyOS Rolling Update Notify

This is my home environment.

Diagram

Network

home

Requirements

Software Version Description
ESXi >= 7.0
VMware Ovf Tool >= 4.3
python >= 3.7
packer >= 1.7
terraform >= 0.15
ansible >= 3.3
rke >= 1.2
vagrant >= 2.2 Optional

Usage

Preparation

ESXi

Clone this repository

git clone git@github.com:ymmmtym/home.git
cd home

Set environment vars like .sample.env

create .env for your environment. and source .env

cp .sample.env .env
vi .env
. .env

Decrypt encrypted files(by searching following command) by ansible-vault

grep -r "ANSIBLE_VAULT" inventories/*

(Optional) Encrypt secret files by ansible-vault

echo "<your vault password>" > .vault_password
ansible-vault encrypt ${YOUR_SECRET_FILE_PATH}

Fix vars for your environment

Ansible

See inventories directory recursively. Then, fix inventories/base.yml and group_vars, host_vars for your environment.

Terraform

Create terraform/terraform.tfvars like following text.

ESXI_HOSTNAME = "<IP Address of your ESXi>"
ESXI_USERNAME = "<Username for ESXi login>"
ESXI_PASSWORD = "<Password for ESXi login>"
Packer

Fix packer/vairables.json for your environment.

Setup

Create Template VMs by Packer

Exec following command at current directory.

packer build packer/templates.json -var-file=packer/variables.json

If you want more template images, you need to add template config to packer/templates.json.

Exec terraform apply

Activate ansible environment.

ex)

python3 -m venv --clear .venv
. .venv/bin/activate
pip install -r requirements.txt

Add route to public network.

ip r add 192.168.100.0/24 via 192.168.0.4

Exec terraform apply.

cd terraform
terraform apply