feat(metal): add dev VM for local development or evaluation

This commit is contained in:
Khue Doan 2021-11-25 18:36:34 +07:00
parent 14ab5b24b6
commit 3d73d9efd9
6 changed files with 38 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.vagrant/
.venv/
book/
build/

View File

@ -4,18 +4,24 @@ default: boot cluster
boot:
ansible-playbook \
--inventory hosts.yml \
--inventory inventories/prod.yml \
main.yml
cluster:
ansible-playbook \
--inventory hosts.yml \
--inventory inventories/prod.yml \
cluster.yml
shutdown:
ansible-playbook \
--inventory hosts.yml \
--inventory inventories/prod.yml \
shutdown.yml
lint:
ansible-lint --project-dir .
dev:
vagrant up
ansible-playbook \
--inventory inventories/dev.yml \
cluster.yml

20
metal/Vagrantfile vendored Normal file
View File

@ -0,0 +1,20 @@
Vagrant.configure("2") do |config|
config.vm.box = "rockylinux/8"
config.vm.define "test" do |test|
test.vm.network "private_network", ip: "192.168.56.101"
test.vm.hostname = "dev0"
end
config.vm.provider "virtualbox" do |vb|
vb.cpus = 4
vb.memory = "8192"
end
config.vm.provision "file", source: "~/.ssh/id_ed25519.pub", destination: "/tmp/id_ed25519.pub"
config.vm.provision "shell", inline: <<-SHELL
mkdir /root/.ssh
cat /tmp/id_ed25519.pub >> /root/.ssh/authorized_keys
SHELL
end

View File

@ -1,3 +1,6 @@
ansible_user: root
ansible_ssh_private_key_file: ~/.ssh/id_ed25519
disk: "sda"
dns_server: "8.8.8.8"
network_interface: "eno1"

View File

@ -0,0 +1,5 @@
metal:
children:
masters:
hosts:
dev0: {ansible_host: 192.168.56.101}

View File

@ -8,6 +8,3 @@ metal:
workers:
hosts:
metal3: {ansible_host: 192.168.1.113, mac: '00:23:24:d1:f5:69'}
vars:
ansible_user: root
ansible_ssh_private_key_file: ~/.ssh/id_ed25519