This commit is contained in:
Richard Arends 2022-06-06 12:11:09 +02:00
parent 34108dfc43
commit 00e6636813
59 changed files with 1706 additions and 0 deletions

View File

@ -0,0 +1,12 @@
---
network_connections:
- name: eth0
type: ethernet
ip:
dhcp4: yes
- name: eth1
type: ethernet
ip:
dhcp4: no
address:
- 192.168.100.254/24

2
bootserver/inventory Normal file
View File

@ -0,0 +1,2 @@
[bootservers]
bootserver ansible_host=192.168.122.89

24
bootserver/playbook.yml Normal file
View File

@ -0,0 +1,24 @@
---
- hosts: bootservers
become: true
vars:
dhcpd_ipv4_interface: eth1
dhcpd_default_lease_time: 3600
dhcpd_max_lease_time: 7200
dhcpd_subnet_mask: 255.255.255.0
dhcpd_broadcast_address: 192.168.100.255
dhcpd_routers: 192.168.100.254
dhcpd_domain_name_servers:
- "192.168.10.1"
dhcpd_domain_search: install
dhcpd_filename: pxelinux.0
dhcpd_next_server: 192.168.100.254
dhcpd_subnets:
- network: 192.168.100.0
netmask: 255.255.255.0
range_start: 192.168.100.100
range_end: 192.168.100.200
roles:
- linux-system-roles.network
- robertdebock.dhcpd
- mosibi.pxe

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,13 @@
---
# defaults file for mosibi.pxe
iso_dest_directory: /var/www/html/isos
iso_mount_directory: /var/www/html/repos
iso_images:
- name: rhel86
description: "Red Hat Enterprise Linux 8.6"
url: http://192.168.122.89/isos/rhel-8.6-x86_64-dvd.iso
- name: rocky86
description: "Rocky Linux 8.6"
url: https://download.rockylinux.org/pub/rocky/8/isos/x86_64/Rocky-8.6-x86_64-dvd1.iso

View File

@ -0,0 +1,2 @@
---
# handlers file for mosibi.pxe

View File

@ -0,0 +1,52 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,31 @@
---
- name: Create directories to store OSTREE images and Kickstart files
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "/var/www/html/ostree"
- "/var/www/html/kickstart"
tags:
- apache
- webserver
- name: Copy kickstart files
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "/var/www/html/kickstart/{{ item }}"
mode: '0644'
loop:
- ostree.cfg
- rocky8-base.cfg
- name: Start and enable Apache
ansible.builtin.service:
name: "{{ apache_service }}"
state: started
enabled: yes
tags:
- apache
- webserver

View File

@ -0,0 +1,76 @@
---
- name: Create directories to store and mount ISO images
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ iso_dest_directory }}"
- "{{ iso_mount_directory }}"
tags:
- iso
- name: Download ISO images
ansible.builtin.get_url:
url: "{{ item['url'] }}"
dest: "{{ iso_dest_directory }}/{{ _filename }}"
mode: 0644
vars:
_filename: "{{ item['url'] | urlsplit('path') | basename }}"
loop: "{{ iso_images }}"
loop_control:
label: "{{ item['description'] }}"
register: _isos_downloaded
tags:
- iso
- name: Mount ISO images read-only
ansible.posix.mount:
path: "{{ iso_mount_directory }}/{{ _iso['item']['name'] }}"
src: "{{ _iso['dest'] }}"
fstype: iso9660
opts: loop,noauto
state: mounted
loop: "{{ _isos_downloaded['results'] }}"
loop_control:
label: "{{ _iso['item']['description'] }}"
loop_var: _iso
tags:
- iso
- name: Create TFTP directories
file:
path: /var/lib/tftpboot/{{ _iso['item']['name'] }}
state: directory
mode: 0755
loop: "{{ _isos_downloaded['results'] }}"
loop_control:
label: "{{ _iso['item']['description'] }}"
loop_var: _iso
tags:
- iso
- name: Copy bootable kernel images for all OSs
synchronize:
src: "{{ iso_mount_directory }}/{{ _iso['item']['name'] }}/images/pxeboot/vmlinuz"
dest: "/var/lib/tftpboot/{{ _iso['item']['name'] }}/vmlinuz"
delegate_to: "{{ inventory_hostname }}"
loop: "{{ _isos_downloaded['results'] }}"
loop_control:
label: "{{ _iso['item']['description'] }}"
loop_var: _iso
tags:
- iso
- name: Copy initrd images for all OSs
synchronize:
src: "{{ iso_mount_directory }}/{{ _iso['item']['name'] }}/images/pxeboot/initrd.img"
dest: "/var/lib/tftpboot/{{ _iso['item']['name'] }}/initrd.img"
delegate_to: "{{ inventory_hostname }}"
loop: "{{ _isos_downloaded['results'] }}"
loop_control:
label: "{{ _iso['item']['description'] }}"
loop_var: _iso
tags:
- iso

View File

@ -0,0 +1,28 @@
---
# tasks file for mosibi.pxe
- name: Install all required software
ansible.builtin.package:
name: "{{ required_packages }}"
state: present
tags:
- pxe
- name: TFTP tasks
include_tasks: tftp.yml
tags:
- pxe
- tftp
- name: Webserver tasks
include_tasks: apache.yml
tags:
- pxe
- apache
- webserver
- name: ISO tasks
include_tasks: iso.yml
tags:
- pxe
- iso

View File

@ -0,0 +1,39 @@
---
- name: Copy bootloader files
ansible.builtin.synchronize:
src: /tftpboot/
dest: /var/lib/tftpboot/
delegate_to: "{{ inventory_hostname }}"
tags:
- tftp
- name: Create pxelinux.cfg directory
file:
path: /var/lib/tftpboot/pxelinux.cfg
state: directory
mode: 0755
owner: root
group: root
tags:
- tftp
- name: Copy default PXE config file
template:
src: "{{ item }}.j2"
dest: "/var/lib/tftpboot/pxelinux.cfg/{{ item }}"
mode: 0644
owner: root
group: root
loop:
- default
- 01-52-54-00-1e-59-6f
tags:
- tftp
- name: Start and enable tftpd
ansible.builtin.service:
name: "{{ tftpd_service }}"
state: started
enabled: yes
tags:
- tftp

View File

@ -0,0 +1,6 @@
DEFAULT linux
label linux
SAY Now booting the Rock Linux 8.6 OSTree
KERNEL rocky86/vmlinuz
APPEND vga=normal initrd=rocky86/initrd.img inst.stage2=http://{{ dhcpd_next_server }}/repos/rocky86 inst.ks=http://{{ dhcpd_next_server }}/kickstart/ostree.cfg ksdevice=bootif inst.loglevel=debug

View File

@ -0,0 +1,20 @@
# display a menu with a list of installation options
default menu.c32
# show prompt, 0 - disabled, 1 - enabled
prompt 0
# timeout, 1 second = 10
timeout 100
# pick label on timeout
ONTIMEOUT 1
menu title ########## PXE Boot Menu ##########
label 1
menu label ^1) Boot from local drive. Do not install anything.
localboot 0
menu default
label 2
menu label ^2) Rocky Linux 8.6 OStree
kernel rocky86/vmlinuz
append vga=normal initrd=rocky86/initrd.img inst.ks=http://{{ dhcpd_next_server }}/kickstart/ostree.cfg ksdevice=bootif

View File

@ -0,0 +1,14 @@
text
lang en_US.UTF-8
keyboard us
timezone --utc Etc/UTC
rootpw --plaintext rocky
user --name=ansible --password=rocky --plaintext --gecos="Ansible User"
ostreesetup --nogpg --url=http://{{ dhcpd_next_server }}/ostree/repo/ --osname=rocky-coreos --remote=rocky-coreos --ref=rocky/x86_64/coreos
# Disk
zerombr
clearpart --all --initlabel
autopart --type=plain
reboot

View File

@ -0,0 +1,60 @@
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --plaintext rocky
user --name=ansible --password=rocky --plaintext --gecos="Ansible User"
# System language
lang en_US.UTF-8
# Firewall configuration
firewall --enabled --ssh
# Power off after installation
poweroff
# Network information
#attempting to put it in the included ks file that accepts hostname from the virsh command.
# System timezone
timezone Europe/Amsterdam --isUtc --nontp
# System authorization information
auth --useshadow --passalgo=sha512
# Use network installation instead of CDROM installation media
url --url="http://mirror.nl.stackscale.com/rocky/8.6/BaseOS/x86_64/os"
# Use text mode install
text
# SELinux configuration
selinux --enforcing
# Do not configure the X Window System
skipx
firstboot --disabled
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
autopart --type=lvm
%packages
@^minimal-environment
@container-management
@system-tools
kexec-tools
vim
python3
%end
%post --nochroot
hostnamectl set-hostname myhost.example.com
hostnamectl --pretty set-hostname myhost.example.com
cp /etc/hostname /mnt/sysimage/etc/hostname
cp /etc/machine-info /mnt/sysimage/etc/machine-info
%end
%post
echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/user-ansible
chmod 0440 /etc/sudoers.d/user-ansible
%end

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- mosibi.pxe

View File

@ -0,0 +1,11 @@
---
# vars file for mosibi.pxe
required_packages:
- rsync
- tftp-server
- syslinux-tftpboot
- syslinux
- httpd
tftpd_service: tftp.service
apache_service: httpd.service

View File

@ -0,0 +1,13 @@
---
#
# Ansible managed
#
exclude_paths:
- ./meta/exception.yml
- ./meta/preferences.yml
- ./molecule/default/prepare.yml
- ./molecule/default/converge.yml
- ./molecule/default/verify.yml
- ./molecule/default/collections.yml
- ./.tox
- ./.cache

View File

@ -0,0 +1,2 @@
---
github: robertdebock

View File

@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help me improve
---
## Describe the bug
A clear and concise description of what the bug is.
## Playbook
Please paste the playbook you are using. (Consider `requirements.yml` and
optionally the command you've invoked.)
```yaml
---
YOUR PLAYBOOK HERE
```
## Output
Show at least the error, possible related output, maybe just all the output.
## Environment
- Control node OS: [e.g. Debian 9] (`cat /etc/os-release`)
- Control node Ansible version: [e.g. 2.9.1] (`ansible --version`)
- Managed node OS: [e.g. CentOS 7] (`cat /etc/os-release`)
Please consider [sponsoring me](https://github.com/sponsors/robertdebock).

View File

@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
---
## Proposed feature
A clear and concise description of what you want to happen.
## Rationale
Why is this feature required?
## Additional context
Add any other context about the feature request here.
Please consider [sponsoring me](https://github.com/sponsors/robertdebock).

View File

@ -0,0 +1,11 @@
---
name: Pull request
about: Describe the proposed change
---
**Describe the change**
A clear and concise description of what the pull request is.
**Testing**
In case a feature was added, how were tests performed?

View File

@ -0,0 +1,8 @@
---
#
# Ansible managed
#
repository:
description: Install and configure dhcpd on your system.
homepage: https://robertdebock.nl/
topics: dhcp, network, iscdhcpserver, dhcpd, server, networking, ansible, molecule, tox, playbook, hacktoberfest

View File

@ -0,0 +1,18 @@
---
#
# Ansible managed
#
name: Release to Ansible Galaxy
on:
release:
types: [created, edited, published, released]
jobs:
release:
runs-on: ubuntu-20.04
steps:
- name: galaxy
uses: robertdebock/galaxy-action@1.1.0
with:
galaxy_api_key: ${{ secrets.galaxy_api_key }}

View File

@ -0,0 +1,69 @@
---
#
# Ansible managed
#
name: Ansible Molecule
on:
push:
tags_ignore:
- '*'
pull_request:
schedule:
- cron: '7 4 4 * *'
jobs:
lint:
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v2
with:
path: "${{ github.repository }}"
- name: molecule
uses: robertdebock/molecule-action@2.7.2
with:
command: lint
test:
needs:
- lint
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
config:
- image: "alpine"
tag: "latest"
- image: "amazonlinux"
tag: "latest"
- image: "enterpriselinux"
tag: "latest"
- image: "debian"
tag: "latest"
- image: "debian"
tag: "bookworm"
- image: "fedora"
tag: "34"
- image: "fedora"
tag: "latest"
- image: "fedora"
tag: "rawhide"
- image: "ubuntu"
tag: "latest"
- image: "ubuntu"
tag: "bionic"
steps:
- name: checkout
uses: actions/checkout@v2
with:
path: "${{ github.repository }}"
- name: disable apparmor for mysql
run: sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
- name: parse apparmor for mysql
run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
- name: molecule
uses: robertdebock/molecule-action@2.7.2
with:
image: ${{ matrix.config.image }}
tag: ${{ matrix.config.tag }}

View File

@ -0,0 +1,34 @@
---
#
# Ansible managed
#
on:
- push
name: Ansible Graphviz
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v2
with:
path: ${{ github.repository }}
- name: create png
uses: robertdebock/graphviz-action@1.0.7
- name: Commit files
run: |
cd ${{ github.repository }}
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add requirements.dot requirements.png
git commit -m "Add generated files"
- name: save to png branch
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: ${{ github.repository }}
force: true
branch: png

View File

@ -0,0 +1,20 @@
---
#
# Ansible managed
#
name: "TODO 2 Issue"
on:
push:
jobs:
build:
runs-on: "ubuntu-20.04"
steps:
- uses: "actions/checkout@master"
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@v2.3"
id: "todo"
with:
TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -0,0 +1,6 @@
.molecule
*.log
*.swp
.tox
.cache
.DS_Store

View File

@ -0,0 +1,44 @@
---
image: "robertdebock/github-action-molecule:3.3.1"
services:
- docker:dind
variables:
DOCKER_HOST: "tcp://docker:2375"
PY_COLORS: 1
molecule:
script:
- image=${image} tag=${tag} molecule test
rules:
- if: $CI_COMMIT_REF_NAME == "master"
retry: 1
parallel:
matrix:
- image: "alpine"
tag: "latest"
- image: "amazonlinux"
tag: "latest"
- image: "enterpriselinux"
tag: "latest"
- image: "debian"
tag: "latest"
- image: "debian"
tag: "bookworm"
- image: "fedora"
tag: "34"
- image: "fedora"
tag: "latest"
- image: "fedora"
tag: "rawhide"
- image: "ubuntu"
tag: "latest"
- image: "ubuntu"
tag: "bionic"
galaxy:
script:
- ansible-galaxy role import --api-key ${GALAXY_API_KEY} ${CI_PROJECT_NAMESPACE} ${CI_PROJECT_NAME}
rules:
- if: $CI_COMMIT_TAG != null

View File

@ -0,0 +1,12 @@
---
rules:
version: "0.2"
exclude_files:
- meta/argument_specs.yml
- meta/exception.yml
- meta/preferences.yml
- meta/version.yml
- requirements.txt
exclude_filter:
- LINT0009
- ANSIBLE0007

View File

@ -0,0 +1,24 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.3
hooks:
- id: yamllint
args: [-c=.yamllint]
- repo: https://github.com/robertdebock/pre-commit
rev: v1.4.4
hooks:
- id: ansible_role_find_unused_variable
- id: ansible_role_find_empty_files
- id: ansible_role_find_empty_directories
- id: ansible_role_fix_readability
- id: ansible_role_find_undefined_handlers
- id: ansible_role_find_unquoted_values

View File

@ -0,0 +1,29 @@
---
#
# Ansible managed
#
language: python
os: linux
dist: xenial
python:
- "3.9"
services:
- docker
cache:
- pip
install:
- pip install --upgrade pip
- pip install ansible ansible-lint yamllint
script:
- yamllint .
- ansible-lint
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
email: false

View File

@ -0,0 +1,16 @@
---
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
truthy: disable
ignore: |
.tox/
.cache/

View File

@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behaviour that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behaviour by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behaviour and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behaviour.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviours that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behaviour may be reported by contacting the project team at robert@meinit.nl. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@ -0,0 +1,76 @@
# [Please contribute](#please-contribute)
You can really make a difference by:
- [Making an issue](https://help.github.com/articles/creating-an-issue/). A well described issue helps a lot. (Have a look at the [known issues](https://github.com/search?q=user%3Arobertdebock+is%3Aissue+state%3Aopen).)
- [Making a pull request](https://services.github.com/on-demand/github-cli/open-pull-request-github) when you see the error in code.
I'll try to help and take every contribution seriously.
It's a great opportunity for me to learn how you use the role and also an opportunity to get into the habit of contributing to open source software.
## [Step by step](#step-by-step)
Here is how you can help, a lot of steps are related to GitHub, not specifically my roles.
### [1. Make an issue.](#1-make-an-issue)
When you spot an issue, [create an issue](https://github.com/robertdebock/ansible-role-dhcpd/issues).
Making the issue help me and others to find similar problems in the future.
### [2. Fork the project.](#2-fork-the-project)
On the top right side of [the repository on GitHub](https://github.com/robertdebock/ansible-role-dhcpd), click `fork`. This copies everything to your GitHub namespace.
### [3. Make the changes](#3-make-the-changes)
In you own GitHub namespace, make the required changes.
I typically do that by cloning the repository (in your namespace) locally:
```
git clone git@github.com:YOURNAMESPACE/ansible-role-dhcpd.git
```
Now you can start to edit on your laptop.
### [4. Optionally: test your changes](#4-optionally-test-your-changes)
Install [molecule](https://molecule.readthedocs.io/en/stable/) and [Tox](https://tox.readthedocs.io/):
```
pip install molecule tox ansible-lint docker
```
And run `molecule test`. If you want to test a specific distribution, set `image` and optionally `tag`:
```
image=centos tag=7 molecule test
```
Once it start to work, you can test multiple version of Ansible:
```
image=centos tag=7 tox
```
### [5. Optionally: Regenerate all dynamic content](#5-optionally-regenerate-all-dynamic-content)
You can use [Ansible Generator](https://github.com/robertdebock/ansible-generator) to regenerate all dynamic content.
If you don't do it, I'll do it later for you.
### [6. Make a pull request](#6-make-a-pull-request)
[GitHub](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) on pull requests.
In the comment-box, you can [refer to the issue number](https://help.github.com/en/github/writing-on-github/autolinked-references-and-urls) by using #123, where 123 is the issue number.
### [7. Wait](#7-wait)
Now I'll get a message that you've added some code. Thank you, really.
CI starts to test your changes. You can follow the progress on Travis.
Please consider [sponsoring me](https://github.com/sponsors/robertdebock).

View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2021 Robert de Bock (robert@meinit.nl)
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.

View File

@ -0,0 +1,139 @@
# [dhcpd](#dhcpd)
Install and configure dhcpd on your system.
|GitHub|GitLab|Quality|Downloads|Version|
|------|------|-------|---------|-------|
|[![github](https://github.com/robertdebock/ansible-role-dhcpd/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-dhcpd/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-dhcpd/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-dhcpd)|[![quality](https://img.shields.io/ansible/quality/21853)](https://galaxy.ansible.com/robertdebock/dhcpd)|[![downloads](https://img.shields.io/ansible/role/d/21853)](https://galaxy.ansible.com/robertdebock/dhcpd)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-dhcpd.svg)](https://github.com/robertdebock/ansible-role-dhcpd/releases/)|
## [Example Playbook](#example-playbook)
This example is taken from `molecule/default/converge.yml` and is tested on each push, pull request and release.
```yaml
---
- name: Converge
hosts: all
become: yes
gather_facts: yes
vars:
dhcpd_subnets:
- network: "{{ ansible_default_ipv4.network }}"
netmask: "255.255.255.0"
roles:
- role: robertdebock.dhcpd
```
The machine needs to be prepared. In CI this is done using `molecule/default/prepare.yml`:
```yaml
---
- name: Prepare
hosts: all
gather_facts: no
become: yes
roles:
- role: robertdebock.bootstrap
- role: robertdebock.apt_autostart
- role: robertdebock.core_dependencies
```
Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles.
## [Role Variables](#role-variables)
The default values for the variables are set in `defaults/main.yml`:
```yaml
---
# defaults file for dhcpd
# Configuration settings for the daemon.
dhcpd_ipv4_interface: "{{ ansible_default_ipv4.interface | default('eth0') }}"
# Setting applicable for the global scope.
dhcpd_default_lease_time: 600
dhcpd_max_lease_time: 7200
dhcpd_subnet_mask: "255.255.255.0"
dhcpd_broadcast_address: "10.0.2.255"
dhcpd_routers: "10.0.2.254"
dhcpd_domain_name_servers:
- "192.168.1.1"
- "192.168.1.2"
dhcpd_domain_search: example.com
# The image to serve for PXE booting.
dhcpd_filename: "pxelinux.0"
# Where the image can be downloaded from.
dhcpd_next_server: "10.0.2.254"
# DHCP works with subnets, a list containing properties per subnet.
dhcpd_subnets:
- network: "10.0.2.0"
netmask: "255.255.255.0"
range_start: "10.0.2.200"
range_end: "10.0.2.210"
```
## [Requirements](#requirements)
- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-dhcpd/blob/master/requirements.txt).
## [Status of used roles](#status-of-requirements)
The following roles are used to prepare a system. You can prepare your system in another way.
| Requirement | GitHub | GitLab |
|-------------|--------|--------|
|[robertdebock.apt_autostart](https://galaxy.ansible.com/robertdebock/apt_autostart)|[![Build Status GitHub](https://github.com/robertdebock/ansible-role-apt_autostart/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-apt_autostart/actions)|[![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-apt_autostart/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-apt_autostart)|
|[robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap)|[![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions)|[![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap)|
|[robertdebock.core_dependencies](https://galaxy.ansible.com/robertdebock/core_dependencies)|[![Build Status GitHub](https://github.com/robertdebock/ansible-role-core_dependencies/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-core_dependencies/actions)|[![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-core_dependencies/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-core_dependencies)|
## [Context](#context)
This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information.
Here is an overview of related roles:
![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-dhcpd/png/requirements.png "Dependencies")
## [Compatibility](#compatibility)
This role has been tested on these [container images](https://hub.docker.com/u/robertdebock):
|container|tags|
|---------|----|
|alpine|all|
|amazon|Candidate|
|el|8|
|debian|all|
|fedora|all|
|ubuntu|all|
The minimum version of Ansible required is 2.10, tests have been done to:
- The previous version.
- The current version.
- The development version.
## [Exceptions](#exceptions)
Some roles can't run on a specific distribution or version. Here are some exceptions.
| variation | reason |
|---------------------------|------------------------|
| Suse | Starting ISC DHCPv4 Server chown: invalid user: 'dhcpd:root
shadow
... |
If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-dhcpd/issues)
## [License](#license)
Apache-2.0
## [Author Information](#author-information)
[Robert de Bock](https://robertdebock.nl/)
Please consider [sponsoring me](https://github.com/sponsors/robertdebock).

View File

@ -0,0 +1,25 @@
# [Security Policy](#security-policy)
This software implements other software, it's not very likely that this software introduces new vulnerabilities.
## [Supported Versions](#supported-versions)
The current major version is supported. For example if the current version is 3.4.1:
| Version | Supported |
| ------- | ------------------ |
| 3.4.1 | :white_check_mark: |
| 3.4.x | :white_check_mark: |
| 3.x.x | :white_check_mark: |
| 2.0.0 | :x: |
| 1.0.0 | :x: |
## [Reporting a Vulnerability](#reporting-a-vulnarability)
Please [open an issue](https://github.com/robertdebock/ansible-role-dhcpd/issues) describing the vulnerability.
Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
Please consider [sponsoring me](https://github.com/sponsors/robertdebock).

View File

@ -0,0 +1,28 @@
---
# defaults file for dhcpd
# Configuration settings for the daemon.
dhcpd_ipv4_interface: "{{ ansible_default_ipv4.interface | default('eth0') }}"
# Setting applicable for the global scope.
dhcpd_default_lease_time: 600
dhcpd_max_lease_time: 7200
dhcpd_subnet_mask: "255.255.255.0"
dhcpd_broadcast_address: "10.0.2.255"
dhcpd_routers: "10.0.2.254"
dhcpd_domain_name_servers:
- "192.168.1.1"
- "192.168.1.2"
dhcpd_domain_search: example.com
# The image to serve for PXE booting.
dhcpd_filename: "pxelinux.0"
# Where the image can be downloaded from.
dhcpd_next_server: "10.0.2.254"
# DHCP works with subnets, a list containing properties per subnet.
dhcpd_subnets:
- network: "10.0.2.0"
netmask: "255.255.255.0"
range_start: "10.0.2.200"
range_end: "10.0.2.210"

View File

@ -0,0 +1,9 @@
---
# handlers file for dhcpd
- name: restart dhcpd
ansible.builtin.service:
name: "{{ dhcpd_service }}"
state: restarted
when:
- not ansible_check_mode | bool

View File

@ -0,0 +1,2 @@
install_date: 'Fri 27 May 2022 09:48:26 AM '
version: 4.0.0

View File

@ -0,0 +1,4 @@
---
exceptions:
- variation: Suse
reason: "Starting ISC DHCPv4 Server chown: invalid user: 'dhcpd:root\nshadow\n..."

View File

@ -0,0 +1,39 @@
---
galaxy_info:
author: Robert de Bock
namespace: robertdebock
role_name: dhcpd
description: Install and configure dhcpd on your system.
license: Apache-2.0
company: none
min_ansible_version: "2.10"
platforms:
- name: Alpine
versions:
- all
- name: Amazon
versions:
- Candidate
- name: EL
versions:
- 8
- name: Debian
versions:
- all
- name: Fedora
versions:
- all
- name: Ubuntu
versions:
- all
galaxy_tags:
- dhcp
- network
- iscdhcpserver
- dhcpd
- server
- networking
dependencies: []

View File

@ -0,0 +1,2 @@
---
tox_parallel: yes

View File

@ -0,0 +1,4 @@
---
collections:
- name: community.docker
- name: community.general

View File

@ -0,0 +1,13 @@
---
- name: Converge
hosts: all
become: yes
gather_facts: yes
vars:
dhcpd_subnets:
- network: "{{ ansible_default_ipv4.network }}"
netmask: "255.255.255.0"
roles:
- role: ansible-role-dhcpd

View File

@ -0,0 +1,27 @@
---
#
# Ansible managed
#
dependency:
name: galaxy
options:
role-file: requirements.yml
lint: |
set -e
yamllint .
ansible-lint
ansible-later
driver:
name: docker
platforms:
- name: "dhcpd-${image:-fedora}-${tag:-latest}${TOX_ENVNAME}"
image: "${namespace:-robertdebock}/${image:-fedora}:${tag:-latest}"
command: /sbin/init
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: yes
pre_build_image: yes
provisioner:
name: ansible
verifier:
name: ansible

View File

@ -0,0 +1,10 @@
---
- name: Prepare
hosts: all
gather_facts: no
become: yes
roles:
- role: robertdebock.bootstrap
- role: robertdebock.apt_autostart
- role: robertdebock.core_dependencies

View File

@ -0,0 +1,9 @@
---
- name: Verify
hosts: all
become: yes
gather_facts: no
tasks:
- name: check if connection still works
ansible.builtin.ping:

View File

@ -0,0 +1,10 @@
# These role have been tested with these PIP component.
# To install the required version yourself, use a command as:
# `python -m pip --user install -r requirements.txt`
# See the pip requirements file documentation for details:
# https://pip.pypa.io/en/stable/user_guide/#requirements-files
#
# Tests run on the previous and current (latest) version of Ansible.
ansible>=2.10
# Some Jinja2 filters are used that are available in the newer releases.
jinja2>=2.11.2

View File

@ -0,0 +1,7 @@
---
roles:
- name: robertdebock.apt_autostart
- name: robertdebock.bootstrap
- name: robertdebock.core_dependencies
collections:
- name: community.general

View File

@ -0,0 +1,96 @@
---
- name: test if dhcpd_ipv4_interface is set correctly
ansible.builtin.assert:
that:
- dhcpd_ipv4_interface is defined
- dhcpd_ipv4_interface is string
quiet: yes
- name: test if dhcpd_default_lease_time is set correctly
ansible.builtin.assert:
that:
- dhcpd_default_lease_time is defined
- dhcpd_default_lease_time is number
- dhcpd_default_lease_time > 0
quiet: yes
- name: test if dhcpd_max_lease_time is set correctly
ansible.builtin.assert:
that:
- dhcpd_max_lease_time is defined
- dhcpd_max_lease_time is number
- dhcpd_max_lease_time > 0
quiet: yes
- name: test if dhcpd_subnet_mask is set correctly
ansible.builtin.assert:
that:
- dhcpd_subnet_mask is defined
- dhcpd_subnet_mask is string
quiet: yes
- name: test if dhcpd_broadcast_address is set correctly
ansible.builtin.assert:
that:
- dhcpd_broadcast_address is defined
- dhcpd_broadcast_address is string
quiet: yes
- name: test if dhcpd_routers is set correctly
ansible.builtin.assert:
that:
- dhcpd_routers is defined
- dhcpd_routers is string
quiet: yes
- name: test if dhcpd_domain_name_servers is set correctly
ansible.builtin.assert:
that:
- dhcpd_domain_name_servers is defined
- dhcpd_domain_name_servers is iterable
quiet: yes
- name: test if dhcpd_domain_search is set correctly
ansible.builtin.assert:
that:
- dhcpd_domain_search is defined
- dhcpd_domain_search is string
quiet: yes
- name: test if dhcpd_filename is set correctly
ansible.builtin.assert:
that:
- dhcpd_filename is defined
- dhcpd_filename is string
quiet: yes
- name: test if dhcpd_next_server is set correctly
ansible.builtin.assert:
that:
- dhcpd_next_server is defined
- dhcpd_next_server is string
quiet: yes
- name: test if dhcpd_subnets is set correctly
ansible.builtin.assert:
that:
- dhcpd_subnets is iterable
quiet: yes
when:
- dhcpd_subnets is defined
- dhcpd_subnets is string
- name: test if item in dhcpd_subnets is set correctly
ansible.builtin.assert:
that:
- item.network is defined
- item.network is string
- item.netmask is defined
- item.netmask is string
quiet: yes
loop: "{{ dhcpd_subnets }}"
loop_control:
label: "{{ item.network }}"
when:
- dhcpd_subnets is defined

View File

@ -0,0 +1,59 @@
---
# tasks file for dhcpd
- name: import assert.yml
ansible.builtin.import_tasks: assert.yml
run_once: yes
delegate_to: localhost
- name: install dhcpd software
ansible.builtin.package:
name: "{{ dhcpd_packages }}"
state: present
- name: configure defaults
ansible.builtin.template:
src: "{{ dhcpd_defaults_src }}"
dest: "{{ dhcpd_defaults_dest }}"
backup: yes
mode: "0640"
when:
- ansible_os_family == "Debian" or
ansible_distribution == "openSUSE Leap"
notify: restart dhcpd
- name: configure software
ansible.builtin.template:
src: dhcpd.conf.j2
dest: "{{ dhcpd_confdir }}/dhcpd.conf"
backup: yes
mode: "0640"
notify: restart dhcpd
- name: start and enable software
block:
- name: start and enable software
ansible.builtin.service:
name: "{{ dhcpd_service }}"
state: started
enabled: yes
rescue:
- name: install procps
ansible.builtin.package:
name: procps
state: present
- name: stop dhcpd
ansible.builtin.command:
cmd: pkill dhcpd
- name: remove pid file
ansible.builtin.file:
path: /var/run/dhcpd.pid
state: absent
- name: start and enable software again
ansible.builtin.service:
name: "{{ dhcpd_service }}"
state: started
enabled: yes

View File

@ -0,0 +1,20 @@
{{ ansible_managed | comment }}
default-lease-time {{ dhcpd_default_lease_time }};
max-lease-time {{ dhcpd_max_lease_time }};
option subnet-mask {{ dhcpd_subnet_mask }};
option broadcast-address {{ dhcpd_broadcast_address }};
option routers {{ dhcpd_routers }};
option domain-name-servers {{ dhcpd_domain_name_servers | join(', ') }};
option domain-search "{{ dhcpd_domain_search }}";
{% for subnet in dhcpd_subnets %}
subnet {{ subnet.network }} netmask {{ subnet.netmask }} {
{% if subnet.range_start is defined and subnet.range_end is defined %}
range {{ subnet.range_start }} {{ subnet.range_end }};
{% endif %}
{% if dhcpd_filename is defined %} filename "{{ dhcpd_filename }}";
{% endif %}
{% if dhcpd_next_server is defined %} next-server {{ dhcpd_next_server }};
{% endif %}
}
{% endfor %}

View File

@ -0,0 +1,13 @@
{{ ansible_managed | comment }}
DHCPD_INTERFACE="{{ dhcpd_ipv4_interface }}"
DHCPD6_INTERFACE=""
DHCPD_IFUP_RESTART=""
DHCPD6_IFUP_RESTART=""
DHCPD_RUN_CHROOTED="yes"
DHCPD6_RUN_CHROOTED="yes"
DHCPD_CONF_INCLUDE_FILES="/etc/dhcpd.d"
DHCPD6_CONF_INCLUDE_FILES="/etc/dhcpd6.d"
DHCPD_RUN_AS="dhcpd"
DHCPD6_RUN_AS="dhcpd"
DHCPD_OTHER_ARGS=""
DHCPD6_OTHER_ARGS=""

View File

@ -0,0 +1,4 @@
{{ ansible_managed | comment }}
INTERFACESv4="{{ dhcpd_ipv4_interface }}"
INTERFACESv6=""

View File

@ -0,0 +1,25 @@
#
# Ansible managed
#
[tox]
minversion = 3.21.4
envlist = py{39}-ansible-{2.9,2.10,2.11}
skipsdist = true
[testenv]
deps =
2.9: ansible == 2.9.*
2.10: ansible-base == 2.10.*
2.11: ansible-core == 2.11.*
molecule[docker]
docker == 4.*
ansible-lint == 5.*
commands = molecule test
setenv =
TOX_ENVNAME={envname}
PY_COLORS=1
ANSIBLE_FORCE_COLOR=1
ANSIBLE_ROLES_PATH=../
passenv = namespace image tag DOCKER_HOST

View File

@ -0,0 +1,45 @@
---
# vars file for dhcpd
_dhcpd_packages:
default:
- dhcp
Amazon:
- dhcp
Debian:
- isc-dhcp-server
CentOS-7:
- dhcp
Red Hat Enterprise Linux-7:
- dhcp
RedHat: &redhat_packages
- dhcp-server
Rocky: *redhat_packages
Suse:
- dhcp-server
dhcpd_packages: "{{ _dhcpd_packages[ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default(_dhcpd_packages[ansible_distribution] | default(_dhcpd_packages[ansible_os_family] | default(_dhcpd_packages['default'] ))) }}"
_dhcpd_defaults_src:
Debian: isc-dhcp-server.j2
Suse: dhcpd.j2
dhcpd_defaults_src: "{{ _dhcpd_defaults_src[ansible_os_family] }}"
_dhcpd_defaults_dest:
Debian: /etc/default/isc-dhcp-server
Suse: /etc/sysconfig/dhcpd
dhcpd_defaults_dest: "{{ _dhcpd_defaults_dest[ansible_os_family] }}"
_dhcpd_service:
default: dhcpd
Debian: isc-dhcp-server
dhcpd_service: "{{ _dhcpd_service[ansible_os_family] | default (_dhcpd_service['default'] ) }}"
_dhcpd_confdir:
default: /etc/dhcp
Suse: /etc
dhcpd_confdir: "{{ _dhcpd_confdir[ansible_os_family] | default (_dhcpd_confdir['default'] ) }}"