1
0
Fork 0
mirror of https://github.com/samsapti/bachelor-project.git synced 2024-11-25 14:27:54 +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/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: ansible.builtin.user:
name: "{{ username }}" name: "{{ username }}"
password: "{{ secrets.user_password | ansible.builtin.password_hash('sha512') }}" password: "{{ secrets.user_password | ansible.builtin.password_hash('sha512') }}"
update_password: on_create shell: /bin/bash
groups: groups:
- sudo - sudo
update_password: on_create
state: present state: present
- name: Add public SSH key to user {{ username }} - name: Add public SSH key to user {{ username }}

View file

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