bertvv / ansible-role-dhcp Goto Github PK
View Code? Open in Web Editor NEWAnsible role for setting up ISC DHCPD on RHEL/CentOS 7
Home Page: https://galaxy.ansible.com/bertvv/dhcp/
License: Other
Ansible role for setting up ISC DHCPD on RHEL/CentOS 7
Home Page: https://galaxy.ansible.com/bertvv/dhcp/
License: Other
It is not possible to use fixed address hosts in subnets.
It would be nice if the same existing behaviour to add dhcp_hosts option would be also possible in subnets.
Ahoi, we wanted to bump our dhcp role dependency to 3.0.3 (latest according to changelog).
Galaxy reports an error:
[WARNING]: - bertvv.dhcp was NOT installed successfully: - the specified version (v3.0.3) of bertvv.dhcp was not found in the list of available versions ([{u'download_url': u'https://github.com/bertvv
/ansible-role-dhcp/archive/v1.0.0.tar.gz', u'name': u'v1.0.0', u'created': u'2015-08-24T20:11:37.884448Z', u'url': u'', u'summary_fields': {}, u'modified': u'2017-11-21T10:11:33.709476Z', u'related': {},
u'commit_date': u'2015-08-24T16:09:28-04:00', u'version': u'1.0.0', u'commit_sha': None, u'active': None, u'id': 6034}, {u'download_url': u'https://github.com/bertvv/ansible-role-
dhcp/archive/v1.0.1.tar.gz', u'name': u'v1.0.1', u'created': u'2015-11-26T13:56:03.222703Z', u'url': u'', u'summary_fields': {}, u'modified': u'2017-11-21T10:11:33.590111Z', u'related': {},
u'commit_date': u'2015-11-26T08:50:16-05:00', u'version': u'1.0.1', u'commit_sha': None, u'active': None, u'id': 8139}, {u'download_url': u'https://github.com/bertvv/ansible-role-
dhcp/archive/v1.1.0.tar.gz', u'name': u'v1.1.0', u'created': u'2016-04-28T09:15:17.099464Z', u'url': u'', u'summary_fields': {}, u'modified': u'2017-11-21T10:11:33.462066Z', u'related': {},
u'commit_date': u'2016-04-28T05:13:38-04:00', u'version': u'1.1.0', u'commit_sha': None, u'active': None, u'id': 13575}, {u'download_url': u'https://github.com/bertvv/ansible-role-
dhcp/archive/v2.0.0.tar.gz', u'name': u'v2.0.0', u'created': u'2016-04-29T08:44:30.469686Z', u'url': u'', u'summary_fields': {}, u'modified': u'2017-11-21T10:11:33.334175Z', u'related': {},
u'commit_date': u'2016-04-29T04:43:54-04:00', u'version': u'2.0.0', u'commit_sha': None, u'active': None, u'id': 13651}, {u'download_url': u'https://github.com/bertvv/ansible-role-
dhcp/archive/v2.1.1.tar.gz', u'name': u'v2.1.1', u'created': u'2017-07-03T12:42:37.094161Z', u'url': u'', u'summary_fields': {}, u'modified': u'2017-11-21T10:11:33.127119Z', u'related': {},
u'commit_date': u'2017-07-03T08:41:00-04:00', u'version': u'2.1.1', u'commit_sha': None, u'active': None, u'id': 34456}, {u'download_url': u'https://github.com/bertvv/ansible-role-
dhcp/archive/v2.1.0.tar.gz', u'name': u'v2.1.0', u'created': u'2017-07-03T12:42:37.180662Z', u'url': u'', u'summary_fields': {}, u'modified': u'2017-11-21T10:11:33.219395Z', u'related': {},
u'commit_date': u'2017-06-26T04:19:19-04:00', u'version': u'2.1.0', u'commit_sha': None, u'active': None, u'id': 34457}, {u'download_url': u'https://github.com/bertvv/ansible-role-
dhcp/archive/v2.1.2.tar.gz', u'name': u'v2.1.2', u'created': u'2017-11-21T10:11:32.591355Z', u'url': u'', u'summary_fields': {}, u'modified': u'2017-11-21T10:11:32.654293Z', u'related': {},
u'commit_date': u'2017-11-21T05:10:52-05:00', u'version': u'2.1.2', u'commit_sha': None, u'active': None, u'id': 45157}, {u'download_url': u'https://github.com/bertvv/ansible-role-
dhcp/archive/v2.2.0.tar.gz', u'name': u'v2.2.0', u'created': u'2019-08-14T10:14:03.167591Z', u'url': u'', u'summary_fields': {}, u'modified': u'2019-08-14T10:14:03.167620Z', u'related': {},
u'commit_date': u'2018-10-13T11:44:33-04:00', u'version': u'2.2.0', u'commit_sha': u'210ddc395a4ec85cae0c845c8f972701fa9db812', u'active': None, u'id': 101543}, {u'download_url':
u'https://github.com/bertvv/ansible-role-dhcp/archive/v3.0.0.tar.gz', u'name': u'v3.0.0', u'created': u'2019-08-14T20:18:29.259659Z', u'url': u'', u'summary_fields': {}, u'modified':
u'2019-08-14T20:18:29.259687Z', u'related': {}, u'commit_date': u'2019-08-14T14:11:52-04:00', u'version': u'3.0.0', u'commit_sha': u'543ba48c4c2e05f0b4d2874d9dad8e55437c03b8', u'active': None, u'id':
101585}, {u'download_url': u'https://github.com/bertvv/ansible-role-dhcp/archive/v3.0.1.tar.gz', u'name': u'v3.0.1', u'created': u'2019-08-14T20:41:57.626418Z', u'url': u'', u'summary_fields': {},
u'modified': u'2019-08-14T20:41:57.626448Z', u'related': {}, u'commit_date': u'2019-08-14T16:40:22-04:00', u'version': u'3.0.1', u'commit_sha': u'cf1ec1d622049d8a773e050fab74f840735cc475', u'active':
None, u'id': 101586}]).
Am I missing something?
Here's the entry in requirements.yml
- name: bertvv.dhcp
src: bertvv.dhcp
version: v3.0.3
Foute link naar testplaybook in de README, goede staat hieronder:
https://github.com/bertvv/ansible-role-dhcp/blob/tests/test.yml
Currently the latest version seen by ansible-galaxy is 2.1.2. Please create a new release with the 2.2.0 version to be able to install from galaxy.
Thanks,
Stefan
When using this role to make a fresh install of isc-dhcp-server on raspian (stretch) I found that dhcpd failed when it was first started.
The reason is that /etc/init.d/isc-dhcp-server wants to know on which network device the server must listen. In my case I had to edit the /etc/defaults/isc-dhcp-server
file to contain the following:
INTERFACESv4="eth0"
because I want the server to listen to the wired ethernet device. I did that with a lineinfile
Ansible command, but ideally, it should be done before starting the server the first time, but after installing the isc-dhcp-server package.
Lijn 16: dhcp_global_nex_server: 192.168.222.3
Aanpassen naar: dhcp_global_next_server: 192.168.222.3
In RHEL/Centos 8, package name is now dhcp-server.
It could be possible to change task/mains.yml to have:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- "{{ default }}.yml"
And file with the good package name in it.
But it could be easier to allow override ( use this loading system only if package_name variable not set).
# expected:
dhcp_global_domain_name: example.com
# or:
dhcp_global_donain_name: 'example.com'
# currently accepted:
dhcp_global_donain_name: '"example.com"'
The fact that the domain name is quoted twice is silly. A small change in the config file template will fix this.
Hi,
this is a follow up to #25, I need the interfaces to be configurable.
I am deploying to a multihomed host, which should provide dhcp on two of its four network cards, but not on it's default card (ansible_default_ipv4.interface)
So I had to change the line in defaults-fix.yml to
line: 'INTERFACESv4="{{ dhcp_interfaces | default(ansible_default_ipv4.interface) }}"'
This should fallback to the current solution, but allows to define a variable dhcp_interfaces to override the default.
This dhcpd role seems to be very popular. IPv6 / dhcp6.conf support seems to be missing.
Will this role be extended?
Hello,
This is a great role, I'm looking to use it for a little project I have whereby I use it to specify network hosts for zero touch configuration on Juniper devices.
However, to use this you must use the vendor option space. Do you have any thoughts on how to easily add something like the following to part of the dhcp.conf
file?
option space NEW_OP; option;
option NEW_OP.image-file-name code 0 = text;
option NEW_OP.config-file-name code 1 = text;
option NEW_OP.image-file-type code 2 = text;
option NEW_OP.transfer-mode code 3 = text;
option NEW_OP.alt-image-file-name code 4= text;
option NEW_OP.http-port code 5= text;
option NEW_OP-encapsulation code 43 = encapsulate NEW_OP;
and then using variables such as (Cut down):
dhcp_hosts:
- name: Juniper1
mac: '00:11:22:33:44:55'
ip: 192.168.222.150
options:
- name: NEW_OP.image-file-name
value: /dist/images/jinstall-ex-4200-13.2R1.1-domestic-signed.tgz
- name:NEW_OP.config-file-name
value: /dist/config/jn-switch35.config
which would then result in the following config in ISC:
host jn-switch35 {
hardware ethernet ac:4b:c8:29:5d:02;
fixed-address 10.100.31.36;
option tftp-server-name "10.100.31.71";
option host-name "jn-switch35";
option log-servers 10.100.31.72;
option ntp-servers 10.100.31.73;
option NEW_OP.image-file-name "/dist/images/jinstall-ex-4200-13.2R1.1-domestic-signed.tgz";
option NEW_OP.transfer-mode "ftp";
option NEW_OP.config-file-name "/dist/config/jn-switch35.config";
option NEW_OP.jloader-file "jloader-qfx-5-14.1X53-D26-signed.tgz";
}
any thoughts would be helpful.
Since there is internet police officer in my homelab, I use the root account with ansible.
Verification of the dhcp configuration fails, because the AppArmor fix only applies to user directories located within /home.
Adding a task to apply the AppArmor fix to root's home directory, too, is necessary:
- name: AppArmor fix | Ensure dhcpd can acces temp config file for validation (3/3)
lineinfile:
dest: "{{ dhcp_apparmor_policy }}"
line: ' /root/.ansible/** r,'
insertbefore: '.*/etc/dhcp/ r,'
state: present
create: false
when: apparmor_policyfile.stat.exists
failed_when: false
#register: apparmor_fix_2
notify: restart apparmor
tags: dhcp
Hi thanks for the role
am trying to work out how to add options to support captive portals as described in RFC dated dec 2020
the options needed are.
option captive-portal code 114 = string;
option captive-portal "http://www.example.com/captive";
Hello!
I was using this in a redhat flavored linux (oracle linux) and found that the role dies in this task:
TASK [dhcp : Install includes] *************************************************
task path: /root/ovm_scripts/ansible/ovm_roles/opt/dhcp/tasks/main.yml:22
fatal: [localhost]: FAILED! => {
"failed": true,
"msg": "'dhcp_global_includes' is undefined"
}
It seems you are trying to shortcircuit with_items
with when
. As the docs state, the correct form here is to use the default([]) filter to return an empty list, which will skip the task.
Thank you!
Merge feature added by @birgitcroux
When we try to use multiple domain_search in subnets it complains that it is not a string.
I noticed there is a check supported for the global domain search but not for this.
At the moment there is no option to pack multiple subnets into a shared network.
It would be nice to have this option
In the template on line 75, the option is added for server-name however this results in an error that this option is unknown and fails the config file integration, the option should be removed making this work again for server-name.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.