create vagrant file and adapt process

This commit is contained in:
vincent 2023-08-25 10:13:29 +02:00
parent 071ac98956
commit 8bfb3a1361
5 changed files with 93 additions and 10 deletions

3
.gitignore vendored
View File

@ -36,3 +36,6 @@ override.tf.json
.terraformrc .terraformrc
terraform.rc terraform.rc
site site
.vagrant

81
Vagrantfile vendored Normal file
View File

@ -0,0 +1,81 @@
Vagrant.configure('2') do |config|
if Vagrant.has_plugin?('vagrant-cachier')
config.cache.scope = 'machine'
end
config.vm.define "oscar-dev" do |c|
# Box definition
c.vm.box = "archlinux/archlinux"
# Config options
c.vm.synced_folder ".", "/vagrant", disabled: true
c.ssh.insert_key = true
c.vm.hostname = "oscar-dev"
# Network
# instance_raw_config_args
# Provider
c.vm.provider "libvirt" do |libvirt, override|
libvirt.memory = 1024
libvirt.cpus = 2
end
end
config.vm.define "merlin-dev" do |c|
# Box definition
c.vm.box = "generic/rocky9"
# Config options
c.vm.synced_folder ".", "/vagrant", disabled: true
c.ssh.insert_key = true
c.vm.hostname = "merlin-dev"
# Network
# instance_raw_config_args
# Provider
c.vm.provider "libvirt" do |libvirt, override|
libvirt.memory = 1024
libvirt.cpus = 2
end
end
config.vm.define "gerard-dev" do |c|
# Box definition
c.vm.box = "debian/bookworm64"
# Config options
c.vm.synced_folder ".", "/vagrant", disabled: true
c.ssh.insert_key = true
c.vm.hostname = "gerard-dev"
# Network
# instance_raw_config_args
# Provider
c.vm.provider "libvirt" do |libvirt, override|
libvirt.memory = 1024
libvirt.cpus = 2
end
end
config.vm.define "nas-dev" do |c|
# Box definition
c.vm.box = "archlinux/archlinux"
# Config options
c.vm.synced_folder ".", "/vagrant", disabled: true
c.ssh.insert_key = true
c.vm.hostname = "nas-dev"
# Network
# instance_raw_config_args
# Provider
c.vm.provider "libvirt" do |libvirt, override|
libvirt.memory = 1024
libvirt.cpus = 2
end
c.vm.provision "ansible" do |bootstrap|
bootstrap.playbook= "ansible/playbooks/bootstrap.yml"
bootstrap.galaxy_roles_path= "ansible/roles"
bootstrap.limit="all"
{ ansible_python_interpreter:"/usr/bin/python3" }
end
end
end

View File

@ -2,15 +2,12 @@
requirements: requirements:
ansible-galaxy install -g -r roles/requirements.yml ansible-galaxy install -g -r roles/requirements.yml
deploy_production: deploy_production: generate-token
ansible-playbook site.yml -i production -u ansible ansible-playbook site.yml -i production -u ansible
deploy_staging: generate-token
ansible-playbook site.yml -i staging -u ansible
generate-token: generate-token:
@echo export VAULT_TOKEN=`vault token create -policy=ansible -field="token" -period 6h` export VAULT_TOKEN=`vault token create -policy=ansible -field="token" -period 6h`
create-dev: requirements
PY_COLORS=1 molecule converge
destroy-dev:
PY_COLORS=1 molecule destroy

View File

@ -1,4 +1,5 @@
--- ---
- hosts: all - hosts: all
become: true
roles: roles:
- ansible_bootstrap - ansible_bootstrap

View File

@ -11,10 +11,11 @@ vault-dev:
fi fi
create-dev: create-dev:
make -C ansible create-dev vagrant up
make -C ansible deploy_staging
destroy-dev: destroy-dev:
make -C ansible destroy-dev vagrant destroy
serve: serve:
mkdocs serve mkdocs serve