Giter Club home page Giter Club logo

ansible-role-dhcp's People

Contributors

aogier avatar asghaier avatar aztechian avatar bencromwell avatar bertvv avatar blofeldthefish avatar donvipre avatar frock81 avatar geva2072 avatar gparent avatar infra-ti-br avatar jameseck avatar jcgruenhage avatar jonesbusy avatar jrac avatar lijok avatar martenbe avatar minitriga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-dhcp's Issues

DHCP Host Options

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.

This can be seen here

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.

Install include task fails

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!

When using ansible with root account verification fails

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

Need to define network device in /etc/defaults

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.

captive portal options

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";

Package name changed in RHEL/Centos 8

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.

  • RedHat-8.yml

But it could be easier to allow override ( use this loading system only if package_name variable not set).

Support shared networks

At the moment there is no option to pack multiple subnets into a shared network.
It would be nice to have this option

Variable global_domain_name is only accepted when twice quoted

# 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.

version 3.0.3 not resolvable via galaxy install

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

Make interfaces configurable

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.