Skip to content

Automated provisioning of homelab servers powered by Ansible

Notifications You must be signed in to change notification settings

adwinying/server-provisioning

Repository files navigation

server-provisioning

Server infrastructure automation powered by terraform and ansible

Installation

Terraform (Infrastructure)

  1. Export Vultr's API key as environmental variable
$ export TF_VAR_api_key="[API key]"
  1. Init terraform
$ terraform init
  1. [If importing an existing infrastructure] Import terraform state
$ terraform import vultr_instance.tunnel [instanceID]
  1. Confirm infrastructure changes
$ terraform plan
  1. Apply infrastructure changes
$ terraform apply

Ansible (Software)

  1. Add password_file and skip to step 3, else continue to next step
$ touch password_file
  1. Copy group_vars/servers.yml.example to group_vars/servers.yml set the appropriate config

  2. Install roles from ansible galaxy

$ ansible-galaxy install -r requirements.yml
  1. Configure servers inventory file
[remote]
tunnel ansible_host=tunnel.example.org ansible_user=user ansible_become_pass=secret

[local]
nas ansible_host=nas.example.org ansible_user=user ansible_become_pass=secret

[servers:children]
remote
local
  1. Run deployment script
$ ansible-playbook --vault-password-file=password_file -i servers site.yml

Editing encrypted files

$ ansible-vault edit --vault-password-file=password_file group_vars/servers.yml

References

Terraform

Wireguard

Port forwarding

S.M.A.R.T

Firewall

About

Automated provisioning of homelab servers powered by Ansible

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published