Add Ansible playbook to configure benchmarking servers

This commit is contained in:
Sam Al-Sapti 2023-04-17 13:56:18 +02:00
parent b5b8841a71
commit 4e9832408a
Signed by: samsapti
GPG Key ID: CBBBE7371E81C4EA
6 changed files with 93 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/ansible/inventory

4
ansible/ansible.cfg Normal file
View File

@ -0,0 +1,4 @@
[defaults]
remote_user = root
inventory = inventory
use_persistent_connections = True

View File

@ -0,0 +1,9 @@
$ANSIBLE_VAULT;1.1;AES256
61646431343934356439373261623036346335633430666537333165633934383032626664646330
3862383035666261643338356366313665613965343536340a396232666265356530623930366230
65363061323964386639623538363637396666353963366231643166396163623738633766306435
6664383430353334380a383764373662613236353836643463623236353866383334366533373261
36363439653064333836656330306235306535366364366636353535646337346636386531323637
61633762653032363031363264626136626337323138623132343836663836313566616136633432
32366330633964633537363434666565306132393530333264353538326439366532656362626531
64366635326664636135

View File

@ -0,0 +1,5 @@
# vim: ft=yaml.ansible
---
username: mpc-player
mp_spdz_dir: /home/{{ username }}/MP-SPDZ
ssh_key: sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFWZGLov8wPBNxuvnaPK+8vv6wK5hHUVEFzXKsN9QeuBAAAADHNzaDpzYW1zYXB0aQ== ssh:samsapti

25
ansible/playbook.yml Normal file
View File

@ -0,0 +1,25 @@
# vim: ft=yaml.ansible
---
- name: Set up MPC players
hosts: all
gather_facts: true
become: true
tasks:
- name: Create user {{ username }}
ansible.builtin.user:
name: "{{ username }}"
password: "{{ secrets.user_password | password_hash('sha512') }}"
groups:
- sudo
state: present
- name: Add public SSH key to user {{ username }}
ansible.posix.authorized_key:
user: "{{ username }}"
key: "{{ ssh_key }}"
exclusive: true
- name: Run role mp_spdz
ansible.builtin.import_role:
name: mp_spdz
become_user: "{{ username }}"

View File

@ -0,0 +1,49 @@
# vim: ft=yaml.ansible
---
- name: Install dependencies via apt
ansible.builtin.apt:
name: "{{ pkgs }}"
state: present
become_user: root
vars:
pkgs:
- automake
- build-essential
- clang
- cmake
- git
- libntl-dev
- libsodium-dev
- libssl-dev
- libtool
- m4
- python3
- texinfo
- yasm
- name: Clone MP-SPDZ
ansible.builtin.git:
repo: https://github.com/data61/MP-SPDZ
dest: "{{ mp_spdz_dir }}"
version: v0.3.5
clone: true
update: true
recursive: true
depth: 1
- name: Patch CONFIG
ansible.builtin.lineinfile:
path: "{{ mp_spdz_dir }}/CONFIG"
regexp: '^ARCH = -march=native$'
state: absent
- name: Build MP-SPDZ
community.general.make:
chdir: "{{ mp_spdz_dir }}"
jobs: "{{ ansible_processor_nproc }}"
target: "{{ item }}"
loop:
- boost
- libote
- mpir
- all