blob: 8d94f28f886cea0c7efeba2d3e932b6e350b0e67 (
plain)
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
|
- hosts: image
tasks:
- shell: |
echo "{{ host }}" > /etc/hostname
sed -i '/^127\.0\.0.*localhost.*/s/.*/127.0.0.1 localhost {{ host }}/' \
/etc/hosts
sed -i '/^root:[^:]:/s//root::/' /etc/passwd
- copy:
content: |
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
dest: /etc/network/interfaces
- apt:
name:
- build-essential
- user:
comment: "Worker"
name: worker
shell: /bin/bash
- file:
state: directory
path: /home/worker/.ssh
owner: worker
group: worker
mode: 0700
- copy:
src: manager.key.pub
dest: /home/worker/.ssh/authorized_keys
owner: worker
group: worker
mode: 0600
- copy:
content: |
worker ALL=(ALL:ALL) NOPASSWD: ALL
dest: /etc/sudoers.d/worker
owner: root
group: root
mode: 0600
vars:
host: worker
ansible_python_interpreter: /usr/bin/python3
|