-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrate_host.yml
75 lines (65 loc) · 1.79 KB
/
crate_host.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
- name: CRATE Host Configuration
hosts: localhost
connection: local
roles:
- role: artis3n.tailscale
tags: [tailscale]
vars:
# TODO should this be an env var?
tailscale_authkey: "{{ lookup('env', 'TAILSCALE_KEY') }}"
- role: lenovo-power
tags: [lenovo]
tasks:
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
become: true
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu jammy stable
state: present
become: true
- name: Update apt and install openssh-server
apt:
name: openssh-server
update_cache: true
become: true
- name: Update apt and install docker-ce
apt:
name: docker-ce
state: latest
become: true
- name: Install Docker Module for Python
pip:
name: docker
- name: Create docker group
group:
name: "docker"
state: present
become: true
- name: Add user to docker group
user:
name: "{{ ansible_user_id }}"
groups: "docker"
append: true
become: true
- name: Create Container
docker_container:
name: crate-container-1
image: ubuntu:22.04
command: sleep 1d
become: true
- name: Install NoMachine
apt:
# TODO make version variable
deb: https://download.nomachine.com/download/8.5/Linux/nomachine_8.5.3_1_amd64.deb
become: true
# TODO set up public key auth for NX/SSH
- name: Setup Python within container
hosts: crate-container-1
connection: docker
gather_facts: false
tasks:
- name: Install python on docker
raw: apt -y update && apt install -y python3