2023-04-17 11:56:18 +00:00
|
|
|
# vim: ft=yaml.ansible
|
|
|
|
---
|
2023-04-18 13:34:11 +00:00
|
|
|
- name: Provision MPC players
|
2023-04-17 11:56:18 +00:00
|
|
|
hosts: all
|
|
|
|
gather_facts: true
|
|
|
|
become: true
|
|
|
|
tasks:
|
2023-04-19 15:13:56 +00:00
|
|
|
- name: Upgrade system packages
|
|
|
|
ansible.builtin.apt:
|
|
|
|
update_cache: true
|
|
|
|
upgrade: full
|
|
|
|
|
2023-04-19 16:46:41 +00:00
|
|
|
- name: Check if a reboot is needed
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: /var/run/reboot-required
|
|
|
|
register: needs_reboot
|
|
|
|
|
|
|
|
- name: Reboot host
|
|
|
|
ansible.builtin.reboot:
|
|
|
|
when: needs_reboot.stat.exists or
|
|
|
|
(force_reboot is defined and force_reboot)
|
|
|
|
|
2023-04-17 11:56:18 +00:00
|
|
|
- name: Create user {{ username }}
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: "{{ username }}"
|
2023-04-18 13:34:11 +00:00
|
|
|
password: "{{ secrets.user_password | ansible.builtin.password_hash('sha512') }}"
|
2023-04-18 22:56:27 +00:00
|
|
|
shell: /bin/bash
|
2023-04-17 11:56:18 +00:00
|
|
|
groups:
|
|
|
|
- sudo
|
2023-04-18 22:56:27 +00:00
|
|
|
update_password: on_create
|
2023-04-17 11:56:18 +00:00
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Add public SSH key to user {{ username }}
|
|
|
|
ansible.posix.authorized_key:
|
|
|
|
user: "{{ username }}"
|
2023-04-18 13:38:01 +00:00
|
|
|
key: "{{ ssh_keys | join('\n') }}"
|
2023-04-17 11:56:18 +00:00
|
|
|
exclusive: true
|
2023-04-18 13:38:01 +00:00
|
|
|
state: present
|
2023-04-17 11:56:18 +00:00
|
|
|
|
2023-04-18 13:34:11 +00:00
|
|
|
- name: Import role mp_spdz
|
2023-04-17 11:56:18 +00:00
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: mp_spdz
|
|
|
|
become_user: "{{ username }}"
|