forked from ScaleComputing/HyperCoreAnsibleCollection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloud-init-user-data-example.yml
73 lines (72 loc) · 2.48 KB
/
cloud-init-user-data-example.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
#cloud-config
# Tested with Ubuntu 20.04.4 LTS server ISO image
# https://releases.ubuntu.com/20.04.4/ubuntu-20.04.4-live-server-amd64.iso
# cp cloud-init-user-data.ubuntu-2004.yml /tmp/user-data
# echo -n '' > /tmp/meta-data
# sudo cloud-localds /var/lib/libvirt/boot/cloud-init-min.iso /tmp/user-data /tmp/meta-data
autoinstall:
version: 1
locale: en_US
storage:
layout:
name: lvm
swap:
filename: /swap.img
size: 100M
network:
network:
version: 2
renderer: networkd
ethernets:
# name can be different - eno1, eth0, enp1s0, ...
enp1s0:
addresses:
- 192.168.122.30/24
gateway4: 192.168.122.1
nameservers:
addresses: ['192.168.122.1']
ssh:
install-server: true
authorized-keys: ['ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE8SNzKoqj89P6Z9kiYEhgbDogY0Y7YXSS68W2B5b2u7 justin_cinkelj@jcnuc']
allow-pw: false
user-data:
hostname: mytestvm
disable_root: false
users:
-
name: myuser
# myuserp password
passwd: >-
$6$.igLISmqzw4hTyS4$4zAx6zWl5FnD3s8YSmn/UOvo0QDg6GuHJcmiB7EYwnbDn9SgZxvmyDeWN4WY6LRFDdChExALqyGfiPHmK1w.j/
shell: /bin/bash
lock_passwd: false
primary_group: myuser
groups: 'adm, cdrom, sudo, dip, plugdev, netdev, lxd'
ssh_authorized_keys: ['ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE8SNzKoqj89P6Z9kiYEhgbDogY0Y7YXSS68W2B5b2u7 justin_cinkelj@jcnuc']
ssh:
disable_root: false
write_files:
-
content: |
[Time]
NTP=0.pool.ntp.org
path: /etc/systemd/timesyncd.conf.d/60-mytestvm.conf
-
content: |
PasswordAuthentication no
path: /etc/ssh/sshd_config.d/60-mytestvm.conf
updates: security
packages:
- ntpdate
# nice to have utils
- bwm-ng
- sysstat
- net-tools
- vim
- iftop
- tmux
early-commands: []
late-commands:
# rootp password
- sed -i 's|^root:\*:|root:\$6\$2NMUxRBiMjQg.iwJ\$eyTXnMseF.N5a62F6rZnKJVGd72HPW6F.KGcq9oFNz7fvMzV5FOvYPkxf..hGxRChhS9CkICOdWSvV.Ldmq871:|' /target/etc/shadow
- poweroff