Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.0.0 remodel as library cookbook #133

Merged
merged 34 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3a6683d
Version bump to 7.0.0
bmhughes Mar 20, 2020
35bb024
Add vendor-option-space and options to class resource
bmhughes May 15, 2019
fa2d488
Only support Chef >= 14 from now
bmhughes Mar 29, 2020
55d21d1
Reorganise templates
bmhughes Mar 29, 2020
6e9ce10
Remove attributes and recipes
bmhughes Mar 30, 2020
dfaf743
Config and subnet resources with support for DHCP and DHCPv6
bmhughes Mar 31, 2020
0163d56
Class, group, host and shared_network resources with support for DHCP…
bmhughes Apr 6, 2020
f843973
DHCP kitchen enabled and move include list generation to helper method
bmhughes Apr 6, 2020
e3ca107
DHCP and DHCPv6 kitchen tests passing
bmhughes Apr 6, 2020
0ed1a70
Remove old spec tests
bmhughes Apr 7, 2020
4b7e23b
New style spec tests
bmhughes Apr 7, 2020
fb6bb42
Update CHANGELOG
bmhughes Apr 7, 2020
0afb8e4
Resource dynamic config directories
bmhughes Apr 7, 2020
4b8be94
Make IPv6 testing conditional
bmhughes Apr 7, 2020
722987a
All options and parameters properties accept Hash or Array
bmhughes Apr 8, 2020
c084b0a
Documentation updated for new resources
bmhughes Apr 10, 2020
28d555e
Kitchen test with disabled and deleted configurations
bmhughes Apr 11, 2020
c5bc2ba
Expand kitchen platforms
bmhughes Apr 11, 2020
1daa028
Add support for configuring unit environment file
bmhughes Apr 11, 2020
26f6c74
Switch IPv6 detection due to inspec bug with older iproute versions
bmhughes Apr 11, 2020
d1ca412
Kitchen testing with IPv6 on CircleCI
bmhughes Apr 12, 2020
cc70985
Kitchen test with latest Chef version
bmhughes Apr 13, 2020
835fb6e
Add UPGRADING guide and extend documentation
bmhughes Apr 13, 2020
42faea7
Fix bug in property sorting with more than one value
bmhughes Apr 14, 2020
5a07523
Alter wording of subnet pool verification error messages
bmhughes Apr 15, 2020
a97ec9a
Documentation corrections
bmhughes Apr 15, 2020
a714806
Remove sort from evals
bmhughes Apr 15, 2020
963502a
Amend failover configuration file template for explicit role definition
bmhughes Apr 15, 2020
359047c
Split property helper into a sorted and unsorted varient
bmhughes Apr 15, 2020
83d28db
Make subnet property optional on dhcp_subnet
bmhughes Apr 15, 2020
1bf3f40
Change dhcp_group to use nested host resources and group testing
bmhughes Apr 15, 2020
135baec
Dynamic zones conditional key authentication
bmhughes Apr 16, 2020
c044464
Subnet support multiple pools
bmhughes Apr 16, 2020
faa7a47
Fix template typos
bmhughes Apr 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,16 @@ workflows:
- kitchen/danger:
name: danger
context: Danger-Minimal
kitchen-v6:
jobs:
- kitchen/dokken-single:
enable-ipv6: true
matrix:
parameters:
suite:
- default-centos-6
- default-centos-7
- default-centos-8
- default-fedora-31
- default-debian-10
- default-ubuntu-1804
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ jobs:
strategy:
matrix:
os:
- 'debian-8'
- 'debian-10'
- 'centos-6'
- 'centos-7'
- 'ubuntu-1604'
- 'centos-8'
- 'fedora-31'
- 'ubuntu-1804'
suite:
- 'default'
- 'delete'
fail-fast: false

steps:
Expand Down
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# CHANGELOG

## Unreleased

- Migrated to github actions
## 7.0.0 (2020-04-13)

Version 7.0.0 is a **major** change! Please see [UPGRADING.md](./UPGRADING.md).

- DHCPv6 server configuration support - [@bmhughes](https://github.com/bmhughes)
- Migrated to github actions - [@Xorima](https://github.com/Xorima)
- Remodel cookbook as resource library - [@bmhughes](https://github.com/bmhughes)
- Remove - [@bmhughes](https://github.com/bmhughes)
- Attributes
- Recipes
- Data bag functionality
- Add resources to manage install and services for dhcpd/dhcpd6 - [@bmhughes](https://github.com/bmhughes)
- Rewrite resources to current standard removing pure ruby code - [@bmhughes](https://github.com/bmhughes)

## 6.1.0 (2019-10-19)

Expand Down
468 changes: 59 additions & 409 deletions README.md

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Upgrading

This document will give you help on upgrading major versions of dhcp

## 7.0.0

Version 7.0.0 is a major rewrite of the cookbook to current standards, remodelling as a resource library cookbook and the addition of DHCPv6 support.

### Removed

- All attributes
- All recipes
- Enumeration of resources from data bags with this cookbook is not longer supported, you will have to write your own wrapper cookbook if you
depend on this functionality.
- Resource `dhcp_pool`
- Pool verification is now provided by the `dhcp_subnet` resource

### Added

- Resource `dhcp_config` - [Documentation](./documentation/dhcp_config.md)
- Replacement for the `_config` recipe
- Global configuration
- DHCP failover configuration
- Configuration of service environment file

- Resource `dhcp_package` - [Documentation](./documentation/dhcp_package.md)
- Replacement for the `_package` recipe
- Installs the relevant packages for platform

- Resource `dhcp_service` - [Documentation](./documentation/dhcp_service.md)
- Replacement for the `_service` recipe
- Creates a systemd unit file for the platform
- Controls service activation

### Changed

- Common
- Custom resources have been rewritten in current style
- Relevant resources have `options` and `parameters` properties to allow more flexible user defined configuration
- Template files are overrideable with `cookbook` and `template` parameters to allow user template selection
- `owner`, `group` and `mode` properties to control the resultant permissions and mode of the generated files
- DHCPv6 support for all resources, use `ip_version` to select

- Resource `dhcp_class` - [Documentation](./documentation/dhcp_class.md)
- `:delete` action added
- `subclasses` are now specified via `Hash` rather than a `Block`

- Resource `dhcp_group` - [Documentation](./documentation/dhcp_group.md)
- `:delete` action added

- Resource `dhcp_host` - [Documentation](./documentation/dhcp_host.md)
- `:delete` action added
- `hostname` property removed, specify it via `options`
- `macaddress` property is renamed to `identifier`
- `ipaddress` property is renamed to `address`

- Resource `dhcp_shared_network` - [Documentation](./documentation/dhcp_shared_network.md)
- `:delete` action added
- Subnets are provided via included nested `dhcp_subnet` resources
- `subnets` are now specified via `Hash` rather than a `Block`

- Resource `dhcp_subnet` - [Documentation](./documentation/dhcp_subnet.md)
- `:delete` action added
- `broadcast`, `routers`, `ddns` and `next-server` properties have been removed, specify them via `options` and `parameters`
- `pools` are now specified via `Hash` rather than a `Block`
73 changes: 0 additions & 73 deletions attributes/default.rb

This file was deleted.

3 changes: 0 additions & 3 deletions attributes/dns.rb

This file was deleted.

60 changes: 60 additions & 0 deletions documentation/dhcp_class.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# dhcp_class

[Back to resource list](../README.md#resources)

Create a DHCPD class configuration. (<https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcpdconf#client-classing>)

Introduced: v7.0.0

## Actions

- `:create`
- `:delete`

## Properties

| Name | Type | Default | Description | Allowed Values |
| ---------------------- | ------------- | -------------------------------- | ------------------------------------------------------------------- | ------------------- |
| `comment` | String | `nil` | Comment to add to the configuration file | |
| `ip_version` | Symbol | `:ipv4` | Select DHCP or DHCPv6 server to configure | `:ipv4`, `:ipv6` |
| `conf_dir` | String | `/etc/dhcp/dhcpd(6).d/classes.d` | Directory to create configuration file in | |
| `cookbook` | String | `/etc/dhcp/dhcpd(6).d/classes.d` | Cookbook to source configuration file template from | |
| `template` | String | `/etc/dhcp/dhcpd(6).d/classes.d` | Template to use to generate the configuration file | |
| `owner` | String | Platform dependant | Owner of the generated configuration file | |
| `group` | String | Platform dependant | Group of the generated configuration file | |
| `mode` | String | `'0640'` | Filemode of the generated configuration file | |
| `match` | String | `nil` | DHCPD match statement | |
| `options` | Array, Hash | `nil` | DHCPD options for the class | |
| `parameters` | Array, Hash | `nil` | DHCPD parameters for the class | |
| `subclass` | Array | `nil` | Subclasses to include within the class | |

## Examples

```ruby
dhcp_class 'BlankClass' do
match 'hardware'
end
```

```ruby
dhcp_class 'RegisteredHosts' do
match 'hardware'
subclass [
'1:10:bf:48:42:55:01',
'1:10:bf:48:42:55:02',
]
end
```

```ruby
dhcp_class 'SpecialHosts' do
match 'hardware'
subclass [
'1:10:bf:48:42:56:01',
'1:10:bf:48:42:56:02',
]
option(
'special-option' => 'value'
)
end
```
94 changes: 94 additions & 0 deletions documentation/dhcp_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# dhcp_config

[Back to resource list](../README.md#resources)

Create and manage the main DHCPD configuration. (<https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcpdconf>)

Introduced: v7.0.0

## Actions

- `:create`
- `:delete`

## Properties

| Name | Type | Default | Description | Allowed Values |
| ---------------------- | ------------- | -------------------------------- | ------------------------------------------------------------------- | ------------------- |
| `comment` | String | `nil` | Comment to add to the configuration file | |
| `ip_version` | Symbol | `:ipv4` | Select DHCP or DHCPv6 server to configure | `:ipv4`, `:ipv6` |
| `conf_dir` | String | `/etc/dhcp/dhcpd(6).d/classes.d` | Directory to create configuration file in | |
| `cookbook` | String | `/etc/dhcp/dhcpd(6).d/classes.d` | Cookbook to source configuration file template from | |
| `template` | String | `/etc/dhcp/dhcpd(6).d/classes.d` | Template to use to generate the configuration file | |
| `owner` | String | Platform dependant | Owner of the generated configuration file | |
| `group` | String | Platform dependant | Group of the generated configuration file | |
| `mode` | String | `'0640'` | Filemode of the generated configuration file | |
| `config_failover_file` | String | `/etc/dhcp/dhcpd.failover.conf` | DHCP failover configuration file path | |
| `config_includes_directory` | String | `/etc/dhcp/dhcpd(6).d` | Directory to create included configuration files in | |
| `lib_dir` | String | Platform dependant | DHCPD lib directory path | |
| `lease_file` | String | Platform dependant | DHCPD lease file path | |
| `allow` | Array | `nil` | | |
| `deny` | Array | `nil` | | |
| `ignore` | Array | `nil` | | |
| `parameters` | Array, Hash | `nil` | DHCPD global parameters | |
| `options` | Array, Hash | `nil` | DHCPD global options | |
| `evals` | Array | `nil` | DHCPD conditional statements (see dhcp-eval(5)) | |
| `keys` | Hash | `nil` | TSIG keys configuration | |
| `zones` | Hash | `nil` | Dynamic DNS zone configuration | |
| `hooks` | Hash | `nil` | Server event action configuration | |
| `failover` | Hash | `nil` | DHCP failover configuration | |
| `include_files` | Array | `nil` | Additional configuration files to include | |
| `extra_lines` | String, Array | `nil` | Extra lines to append to the configuration file | |

## Examples

```ruby
dhcp_config '/etc/dhcp/dhcpd.conf' do
allow %w(booting bootp unknown-clients)
parameters(
'default-lease-time' => 7200,
'ddns-update-style' => 'interim',
'max-lease-time' => 86400,
'update-static-leases' => true,
'one-lease-per-client' => true,
'authoritative' => '',
'ping-check' => true
)
options(
'domain-name' => '"test.domain.local"',
'domain-name-servers' => '8.8.8.8',
'host-name' => ' = binary-to-ascii (16, 8, "-", substring (hardware, 1, 6))'
)
hooks(
'commit' => ['use-host-decl-names on'],
'release' => ['use-host-decl-names on']
)
include_files [
'/etc/dhcp/extra1.conf',
'/etc/dhcp/extra2.conf',
'/etc/dhcp_override/list.conf',
]
action :create
end
```

```ruby
dhcp_config '/etc/dhcp/dhcpd6.conf' do
ip_version :ipv6
deny %w(duplicates)
parameters(
'default-lease-time' => 7200,
'ddns-updates' => 'on',
'ddns-update-style' => 'interim',
'max-lease-time' => 86400,
'update-static-leases' => true,
'one-lease-per-client' => 'on',
'authoritative' => '',
'ping-check' => true
)
options(
'dhcp6.name-servers' => '2001:4860:4860::8888, 2001:4860:4860::8844'
)
action :create
end
```
39 changes: 39 additions & 0 deletions documentation/dhcp_group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# dhcp_group

[Back to resource list](../README.md#resources)

Create a DHCPD group configuration. (<https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcpdconf#reference-declarations> - *The **group** statement*)

Introduced: v7.0.0

## Actions

- `:create`
- `:delete`

## Properties

| Name | Type | Default | Description | Allowed Values |
| ---------------------- | ------------- | -------------------------------- | ------------------------------------------------------------------- | ------------------- |
| `comment` | String | `nil` | Comment to add to the configuration file | |
| `ip_version` | Symbol | `:ipv4` | Select DHCP or DHCPv6 server to configure | `:ipv4`, `:ipv6` |
| `conf_dir` | String | `/etc/dhcp/dhcpd(6).d/groups.d` | Directory to create configuration file in | |
| `cookbook` | String | `/etc/dhcp/dhcpd(6).d/groups.d` | Cookbook to source configuration file template from | |
| `template` | String | `/etc/dhcp/dhcpd(6).d/groups.d` | Template to use to generate the configuration file | |
| `owner` | String | Platform dependant | Owner of the generated configuration file | |
| `group` | String | Platform dependant | Group of the generated configuration file | |
| `mode` | String | `'0640'` | Filemode of the generated configuration file | |
| `parameters` | Array, Hash | `nil` | DHCPD parameters for the group | |
| `options` | Array, Hash | `nil` | DHCPD options for the group | |
| `evals` | Array | `nil` | DHCPD conditional statements for the group (see dhcp-eval(5)) | |
| `hosts` | Hash | `nil` | Hosts configuration to include within the group | |

## Examples

```ruby
dhcp_group 'IPPgones' do
options(
'tftp-server-name' => '192.0.2.10'
)
end
```
Loading