Skip to content

Commit 940a381

Browse files
authored
Merge pull request #2 from jps-help/dev
Release 0.1.2
2 parents 3d717cb + 8d2e2fd commit 940a381

5 files changed

Lines changed: 33 additions & 36 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## Release 0.1.2
6+
### Changed
7+
- `netplan::config` resources include the top-level `network` key automatically [BREAKING]
8+
- Users will need to remove the top-level `network` key from their existing netplan hash/hiera
59
## Release 0.1.0
610

711
Initial release

README.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ include netplan
3131
This module is best used by supplying data via Hiera. Generating netplan YAML files with resource statements, although possible, can result in very complex manifests.
3232

3333
The below example shows both methods, although it's strongly recommended to just use Hiera to form your netplan config.
34+
35+
Please note, the `netplan::config` resource automatically adds the top-level `network` key to generated YAML files. You only need to define the settings under that key.
3436
### Basic usage
3537
Make sure to include netplan somewhere in your manifest. By default, this will only ensure that netplan is installed.
3638
```
@@ -42,24 +44,21 @@ Provide Hiera data to build your inteneded netplan YAML file.
4244
netplan::configs:
4345
example-config:
4446
settings:
45-
network:
46-
version: 2
47-
renderer: networkd
48-
ethernets:
49-
eth0:
50-
dhcp4: true
47+
version: 2
48+
renderer: networkd
49+
ethernets:
50+
eth0:
51+
dhcp4: true
5152
```
5253
And here is the same config using a `netplan::config` resource instead
5354
```
5455
netplan::config { 'example-config':
5556
settings => {
56-
network => {
57-
version => 2,
58-
renderer => networkd,
59-
ethernets => {
60-
eth0 => {
61-
dhcp4 => true,
62-
},
57+
version => 2,
58+
renderer => networkd,
59+
ethernets => {
60+
eth0 => {
61+
dhcp4 => true,
6362
},
6463
},
6564
},
@@ -87,16 +86,14 @@ netplan::configs:
8786
example-config:
8887
priority: 10
8988
settings:
90-
network:
91-
version: 2
92-
renderer: networkd
89+
version: 2
90+
renderer: networkd
9391
example-config-2:
9492
priority: 20
9593
settings:
96-
network:
97-
ethernets:
98-
eth0:
99-
dhcp4: true
94+
ethernets:
95+
eth0:
96+
dhcp4: true
10097
```
10198
The above will result in the following under `/etc/netplan/`
10299
- 10-example-config.yaml

REFERENCE.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,11 @@ Create netplan YAML files from a Hash of data.
9797
```puppet
9898
netplan::config { 'example-config':
9999
settings => {
100-
network => {
101-
version => 2,
102-
renderer => networkd,
103-
ethernets => {
104-
eth0 => {
105-
dhcp4 => true,
106-
},
100+
version => 2,
101+
renderer => networkd,
102+
ethernets => {
103+
eth0 => {
104+
dhcp4 => true,
107105
},
108106
},
109107
},

manifests/config.pp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
# @example Basic config
66
# netplan::config { 'example-config':
77
# settings => {
8-
# network => {
9-
# version => 2,
10-
# renderer => networkd,
11-
# ethernets => {
12-
# eth0 => {
13-
# dhcp4 => true,
14-
# },
8+
# version => 2,
9+
# renderer => networkd,
10+
# ethernets => {
11+
# eth0 => {
12+
# dhcp4 => true,
1513
# },
1614
# },
1715
# },
@@ -46,7 +44,7 @@
4644
file { $file:
4745
ensure => $ensure,
4846
mode => $file_mode,
49-
content => to_yaml($settings),
47+
content => to_yaml({ network => $settings }),
5048
notify => Exec['netplan_cmd'],
5149
}
5250
}

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jmckenzie-netplan",
3-
"version": "0.1.0",
3+
"version": "0.1.2",
44
"author": "James McKenzie",
55
"summary": "Manage netplan via Puppet",
66
"license": "Apache-2.0",

0 commit comments

Comments
 (0)