...
|
...
|
@@ -1,89 +1,86 @@
|
1
|
1
|
Overview
|
2
|
2
|
=================
|
3
|
|
-`cloud-init` is the defacto multi-distribution package that handles early initialization of a cloud instance.
|
|
3
|
+```cloud-init``` is the defacto multi-distribution package that handles early initialization of a cloud instance.
|
4
|
4
|
|
5
|
5
|
In-depth documentation for cloud-init is available here: https://cloudinit.readthedocs.org/en/latest/
|
6
|
6
|
|
7
|
7
|
Supported installations
|
8
|
8
|
=================
|
9
|
|
-<dl>
|
10
|
|
-<dt><code>Photon Container OS (Minimal)</code></dt>
|
11
|
|
-<dt><code>Photon Full OS (All)</code></dt>
|
12
|
|
-</dl>
|
|
9
|
+```Photon Container OS (Minimal)```
|
|
10
|
+
|
|
11
|
+```Photon Full OS (All)```
|
13
|
12
|
|
14
|
13
|
Supported capabilities
|
15
|
14
|
=================
|
16
|
|
-`Photon` supports `cloud-init` starting with the following capabilities
|
|
15
|
+```Photon``` supports ```cloud-init``` starting with the following capabilities
|
17
|
16
|
<dl>
|
18
|
|
-<dt><code>run commands</code></dt>
|
|
17
|
+<dt>```run commands```</dt>
|
19
|
18
|
<dd>execute a list of commands with output to console.</dd>
|
20
|
|
-<dt><code>configure ssh keys</code></dt>
|
|
19
|
+<dt>```configure ssh keys```</dt>
|
21
|
20
|
<dd>add entry to ~/.ssh/authorized_keys for the configured user</dd>
|
22
|
|
-<dt><code>install package</code></dt>
|
|
21
|
+<dt>```install package```</dt>
|
23
|
22
|
<dd>install additional packages on first boot</dd>
|
24
|
|
-<dt><code>configure networking</code></dt>
|
|
23
|
+<dt>```configure networking```</dt>
|
25
|
24
|
<dd>update /etc/hosts, hostname etc</dd>
|
26
|
|
-<dt><code>write files</code></dt>
|
|
25
|
+<dt>```write files```</dt>
|
27
|
26
|
<dd>write arbitrary file(s) to disk</dd>
|
28
|
|
-<dt><code>add yum repo</code></dt>
|
|
27
|
+<dt>```add yum repo```</dt>
|
29
|
28
|
<dd>add a yum repository to /etc/yum.repos.d</dd>
|
30
|
|
-<dt><code>create groups and users</code></dt>
|
|
29
|
+<dt>```create groups and users```</dt>
|
31
|
30
|
<dd>add groups and users to the system. set user/group properties</dd>
|
32
|
|
-<dt><code>run yum upgrade</code></dt>
|
|
31
|
+<dt>```run yum upgrade```</dt>
|
33
|
32
|
<dd>upgrade all packages</dd>
|
34
|
|
-<dt><code>reboot</code></dt>
|
|
33
|
+<dt>```reboot```</dt>
|
35
|
34
|
<dd>reboot or power off when done with cloud-init</dd>
|
36
|
35
|
</dl>
|
37
|
36
|
|
38
|
37
|
Getting Started
|
39
|
38
|
=================
|
40
|
|
-photon cloud config has `ec2 datasource` turned on by default so an `ec2` configuration is accepted.
|
41
|
|
-However, for testing, the following methods provide ways to do `cloud-init` with `photon` standalone.
|
|
39
|
+photon cloud config has ```ec2 datasource``` turned on by default so an ```ec2``` configuration is accepted.
|
|
40
|
+However, for testing, the following methods provide ways to do ```cloud-init``` with ```photon``` standalone.
|
42
|
41
|
|
43
|
42
|
Using a seed iso
|
44
|
43
|
----------------
|
45
|
|
-This will be using the `nocloud` datasource. In order to init this way, an iso file needs to be created
|
46
|
|
-with a meta-data and an user-data file as shown below
|
47
|
|
-<code><pre>
|
|
44
|
+This will be using the ```nocloud``` datasource. In order to init this way, an iso file needs to be created with a meta-data and an user-data file as shown below
|
|
45
|
+```
|
48
|
46
|
$ { echo instance-id: iid-local01; echo local-hostname: cloudimg; } > meta-data
|
49
|
47
|
$ printf "#cloud-config\nhostname: testhost\n" > user-data
|
50
|
48
|
$ genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
|
51
|
|
-</pre>
|
52
|
|
-</code>
|
|
49
|
+```
|
53
|
50
|
|
54
|
|
-Attach the above generated seed.iso to your machine and reboot for the init to take effect.
|
55
|
|
-In this case, the hostname is set to `testhost`
|
|
51
|
+Attach the above generated seed.iso to your machine and reboot for the init to take effect.
|
|
52
|
+In this case, the hostname is set to ```testhost```
|
56
|
53
|
|
57
|
54
|
Using a seed disk file
|
58
|
55
|
----------------
|
59
|
56
|
To init using local disk files, do the following
|
60
|
|
-<code><pre>
|
|
57
|
+```
|
61
|
58
|
mkdir /var/lib/cloud/seed/nocloud
|
62
|
59
|
cd /var/lib/cloud/seed/nocloud
|
63
|
60
|
$ { echo instance-id: iid-local01; echo local-hostname: cloudimg; } > meta-data
|
64
|
61
|
$ printf "#cloud-config\nhostname: testhost\n" > user-data
|
65
|
|
-</pre></code>
|
|
62
|
+```
|
66
|
63
|
Reboot the machine and the hostname will be set to `testhost`
|
67
|
64
|
|
68
|
65
|
Frequencies
|
69
|
66
|
-----------
|
70
|
|
-cloud-init modules have pre-determined frequencies. Based on the frequency setting, multiple runs will yield different results.
|
|
67
|
+cloud-init modules have pre-determined frequencies. Based on the frequency setting, multiple runs will yield different results.
|
71
|
68
|
For the scripts to run always, remove instances folder before reboot.
|
72
|
|
-<code><pre>
|
|
69
|
+```
|
73
|
70
|
rm -rf /var/lib/cloud/instances
|
74
|
|
-</code></pre>
|
|
71
|
+```
|
75
|
72
|
|
76
|
73
|
Module frequency info
|
77
|
|
-Name | Frequency
|
|
74
|
+------------------------------------
|
|
75
|
+Name | Frequency
|
|
76
|
+----------------------|-------------
|
78
|
77
|
disable_ec2_metadata | Always
|
79
|
|
-users_groups | Instance
|
80
|
|
-write_files | Instance
|
81
|
|
-update_hostname | Always
|
82
|
|
-final_message | Always
|
83
|
|
-resolv_conf | Instance
|
84
|
|
-growpart | Always
|
85
|
|
-update_etc_hosts | Always
|
86
|
|
-power_state_change | Instance
|
87
|
|
-phone_home | Instance
|
|
78
|
+users_groups | Instance
|
|
79
|
+write_files | Instance
|
|
80
|
+update_hostname | Always
|
|
81
|
+final_message | Always
|
|
82
|
+resolv_conf | Instance
|
|
83
|
+growpart | Always
|
|
84
|
+update_etc_hosts | Always
|
|
85
|
+power_state_change | Instance
|
|
86
|
+phone_home | Instance
|