Deploy cloud_init configuration files from attributes or LWRP.
The following platforms and versions are tested and supported using Opscode's test-kitchen.
Debian 8Debian 9Debian 10Ubuntu 16.04Ubuntu 18.04Ubuntu 20.04
| Key | Type | Description |
|---|---|---|
[cloud_init][cfgs] |
Hash | Hash of configuration files (default: {}) |
Include cloud_init in your node's run_list and set the cfgs attribute to install cloud-init package and create configuration files:
{
"name":"my_node",
"run_list": [
"recipe[cloud_init]"
],
"attributes": {
"cloud_init": {
"cfgs": {
"hostname": {
"priority": "90",
"config": {
"preserve_hostname": "true"
}
}
}
}
}
}This setup will create the configuration file /etc/cloud/cloud.cfg.d/90_hostname.cfg with following content:
preserve_hostname: true
Include cloud_init::upgrade in your node's run_list to upgrade cloud-init package.
{
"name":"my_node",
"run_list": [
"recipe[cloud_init::upgrade]"
]
}Include cloud_init::disable in your node's run_list to disable cloud-init.
{
"name":"my_node",
"run_list": [
"recipe[cloud_init::disable]"
]
}Include cloud_init::enable in your node's run_list to enable cloud-init.
{
"name":"my_node",
"run_list": [
"recipe[cloud_init::enable]"
]
}Include cloud_init::remove in your node's run_list to remove cloud-init package.
{
"name":"my_node",
"run_list": [
"recipe[cloud_init::remove]"
]
}Include cloud_init::purge in your node's run_list to purge cloud-init package and remove cloud directories (/etc/cloud, /var/lib/cloud).
{
"name":"my_node",
"run_list": [
"recipe[cloud_init::purge]"
]
}This LWRP can be used to manipulate cloud-init package.
| Action | Description |
|---|---|
:install |
Install cloud-init |
:upgrade |
Upgrade cloud-init |
:disable |
Disable cloud-init |
:enable |
Enable cloud-init |
:remove |
Remove cloud-init |
:purge |
Purge cloud-init and remove configuration files |
This LWRP doesn't have any attributes, the name attribute can be whatever.
Install cloud-init:
cloud_init 'default'Disable cloud-init:
cloud_init 'default' do
action :disable
endPurge cloud-init:
cloud_init 'default' do
action :purge
endThis LWRP can be used to deploy cloud-init configuration files.
| Action | Description |
|---|---|
:create |
Create a cloud-init configuration file |
:delete |
Delete a cloud-init configuration file |
| Attribute | Type | Description |
|---|---|---|
name |
String | Name of the configuration file, this is the name attribute |
priority |
Interger | Priority of configuration file, The config filename is prefixed by this value |
config |
Hash | Hash configuration, used by the template. |
cloud_init 'default'
cloud_init_cfg 'hostname' do
priority 90
config preserve_hostname: true
endSee TESTING.md
See CONTRIBUTING.md
Authors: Sliim [email protected]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.