1
0
Fork 0
mirror of https://github.com/samsapti/bachelor-project.git synced 2024-11-22 04:47:53 +00:00

Add Vagrantfile and test in Vagrant

This commit is contained in:
Sam A. 2023-04-19 00:56:27 +02:00
parent a2c3219ed0
commit 9384176bf2
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA
4 changed files with 33 additions and 2 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/ansible/inventory
/ansible/.vagrant/

27
ansible/Vagrantfile vendored Normal file
View file

@ -0,0 +1,27 @@
Vagrant.require_version ">= 2.0.0"
N = 2
Vagrant.configure("2") do |config|
(0..N).each do |player_id|
vm_name = "mpc-player-#{player_id}"
config.vm.define vm_name do |player|
player.vm.box = "ubuntu/jammy64"
player.vm.hostname = vm_name
player.vm.network :private_network, ip: "192.168.56.#{20 + player_id}"
player.vm.provider :virtualbox do |vb|
vb.cpus = 4
vb.memory = 8192
end
if player_id == N
player.vm.provision :ansible do |ansible|
ansible.limit = "all"
ansible.playbook = "playbook.yml"
ansible.ask_vault_pass = true
end
end
end
end
end

View file

@ -9,9 +9,10 @@
ansible.builtin.user:
name: "{{ username }}"
password: "{{ secrets.user_password | ansible.builtin.password_hash('sha512') }}"
update_password: on_create
shell: /bin/bash
groups:
- sudo
update_password: on_create
state: present
- name: Add public SSH key to user {{ username }}

View file

@ -3,10 +3,12 @@
- name: Install dependencies via apt
ansible.builtin.apt:
name: "{{ pkgs }}"
update_cache: true
state: present
become_user: root
vars:
pkgs:
- acl
- automake
- build-essential
- clang
@ -46,4 +48,4 @@
- boost
- libote
- mpir
- all
- semi-party.x