-
Notifications
You must be signed in to change notification settings - Fork 20
/
cloud-config
161 lines (132 loc) · 5.21 KB
/
cloud-config
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#cloud-config
# Hostname of your CoreOS VM
hostname: mycoreos
# Stores the public key for SSH shared-key authentication, update with your SSH RSA public key
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAA...
coreos:
units:
# Creates an LVM thinpool for Docker storage, will only run if the logical volume does not exist
# Change /dev/sdb to the disk you want to use for Docker storage
- name: create-docker-lvm-thinpool.service
command: start
content: |
[Unit]
After=lvm2-monitor.service
Requires=lvm2-monitor.service
ConditionPathExists=!/dev/mapper/docker-thinpool
[Service]
Type=oneshot
ExecStart=/usr/sbin/pvcreate /dev/sdb
ExecStart=/usr/sbin/vgcreate docker /dev/sdb
ExecStart=/usr/sbin/lvcreate --wipesignatures y -n thinpool docker -l 95%VG
ExecStart=/usr/sbin/lvcreate --wipesignatures y -n thinpoolmeta docker -l 1%VG
ExecStart=/usr/sbin/lvconvert -y --zero n -c 512K --thinpool docker/thinpool --poolmetadata docker/thinpoolmeta
ExecStart=/usr/sbin/lvchange --metadataprofile docker-thinpool docker/thinpool
# Adds a TCP socket for Docker so docker can be managed remotely
- name: docker-tcp.socket
command: start
enable: true
content: |
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=2375
BindIPv6Only=both
Service=docker.service
[Install]
WantedBy=sockets.target
# Updates the systemd Docker service to use Direct LVM storage and changes the container size to 25GB
# Requires the LVM thinpool from the previous unit exists
- name: docker.service
drop-ins:
- name: 10.docker_opts.conf
content: |
[Service]
Environment="DOCKER_OPTS=--storage-driver=devicemapper --storage-opt=dm.thinpooldev=/dev/mapper/docker-thinpool --storage-opt=dm.use_deferred_removal=true --storage-opt=dm.basesize=25G"
# Creates a new LVM volume group for custom logical volumes, will only run if the volume group does not exist
# Change /dev/sdc to the disk you want to use for the data volume group
- name: create-data-volume-group.service
command: start
content: |
[Unit]
Description=Create data volume group
After=lvm2-activation.service
Requires=lvm2-activation.service
ConditionPathExists=/etc/check_vg.sh
[Service]
Type=oneshot
ExecStart=/bin/sh /etc/check_vg.sh data /dev/sdc
# Creates a new LVM volume and file system for storing installation files, will only run if the logical volume does not exist
- name: create-oracledata-volume.service
command: start
content: |
[Unit]
Description=Create oracledata logical volume and create an ext4 filesystem
After=create-data-volume-group.service
Requires=create-data-volume-group.service
ConditionPathExists=!/dev/mapper/data-oracledata
[Service]
Type=oneshot
ExecStart=/usr/sbin/lvcreate -y -n oracledata data -l 30%VG
ExecStart=/usr/sbin/mkfs.ext4 /dev/mapper/data-oracledata
# Mounts the file system for storing installation files from previous unit
- name: oracledata.mount
command: start
content: |
[Unit]
Description=Mount oracledata volume to /oracledata
Requires=dev-mapper-data\x2doracledata.device
After=dev-mapper-data\x2doracledata.device
[Mount]
What=/dev/mapper/data-oracledata
Where=/oracledata
Type=ext4
# Creates a new LVM volume and file system for using NFS files for an ASM disk group, will only run if the logical volume does not exist
- name: create-oraclenfs-volume.service
command: start
content: |
[Unit]
Description=Create oraclenfs logical volume and create an ext4 filesystem
After=create-data-volume-group.service
Requires=create-data-volume-group.service
ConditionPathExists=!/dev/mapper/data-oraclenfs
[Service]
Type=oneshot
ExecStart=/usr/sbin/lvcreate -y -n oraclenfs data -l 30%VG
ExecStart=/usr/sbin/mkfs.ext4 /dev/mapper/data-oraclenfs
# Mounts the file system for using NFS files for an ASM disk group from previous unit
- name: oraclenfs.mount
command: start
content: |
[Unit]
Description=Mount oraclenfs volume to /oraclenfs
Requires=dev-mapper-data\x2doraclenfs.device
After=dev-mapper-data\x2doraclenfs.device
[Mount]
What=/dev/mapper/data-oraclenfs
Where=/oraclenfs
Type=ext4
write_files:
# Required for the volume group check
- path: /etc/check_vg.sh
owner: root
content: |
if ! $(/usr/sbin/vgs $1 >/dev/null 2>&1); then
/usr/sbin/pvcreate $2
/usr/sbin/vgcreate $1 $2
/usr/sbin/vgs $1 >/dev/null 2>&1
fi
# Required for the Docker storage LVM thinpool
- path: /etc/lvm/profile/docker-thinpool.profile
permissions: 0644
owner: root
content: |
activation {
thin_pool_autoextend_threshold=80
thin_pool_autoextend_percent=20
}
# Add bash profile preferences
- path: /etc/profile.env
content: |
alias ll='ls -l --color=auto'