-
Notifications
You must be signed in to change notification settings - Fork 4
/
server-user-data.yaml
73 lines (65 loc) · 2.02 KB
/
server-user-data.yaml
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
heat_template_version: 'rocky'
parameters:
CloudUser:
description: Default cloud user created by cloud-init
default: cloud-user
type: string
PackageManagerName:
type: string
default: dnf
resources:
ServerClougConfig:
type: OS::Heat::CloudConfig
properties:
cloud_config:
users:
- default
- name: stack
primary_group: stack
groups: wheel
# password is also stack
passwd: $6$VpnieDsSxBslbEGB$KAA22RhRMUAiCA8e1DOkSCf5cbre5GRrCpwvt.nIaelm7zSXPuP1B5x0N5itF4gUZauu.7/1zlA0nWJZMGsXD0
RepoConfig:
type: OS::OSPHeatTemplates::RepoConfig
BootstrapConfig:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
template: |
#!/usr/bin/bash
PACKAGE_MANAGER_NAME -y install tmux
# Hmm..not sure how else to pull this off
mkdir -p /home/stack/.ssh
chmod 0700 /home/stack/.ssh
/bin/cp /home/CLOUDUSER/.ssh/authorized_keys /home/stack/.ssh
chmod 0600 /home/stack/.ssh/authorized_keys
cp /etc/skel/.bash* /home/stack/
chown -R stack: /home/stack
echo stack | passwd --stdin stack
params:
CLOUDUSER: {get_param: CloudUser}
PACKAGE_MANAGER_NAME: {get_param: PackageManagerName}
SudoConfig:
type: OS::Heat::SoftwareConfig
properties:
config: |
#!/usr/bin/bash
sudo sed -i "s/# %wheel/%wheel/" /etc/sudoers
ServerUserData:
type: OS::Heat::Value
properties:
value:
- config: {get_resource: ServerClougConfig}
- config: {get_resource: RepoConfig}
subtype: x-shellscript
- config: {get_resource: BootstrapConfig}
subtype: x-shellscript
- config: {get_resource: SudoConfig}
subtype: x-shellscript
outputs:
OS::stack_id:
value: {get_resource: ServerUserData}
ServerUserData:
description: ServerUserData
value: {get_attr: [ServerUserData, value]}