Giter VIP home page Giter VIP logo

dnsmasq-formula's Introduction

dnsmasq-formula

Travis CI Build Status Semantic Release pre-commit

dnsmasq provides DNS services, as well as optional DHCP and TFTP services.

Table of Contents

General notes

See the full SaltStack Formulas installation and usage instructions.

If you are interested in writing or contributing to formulas, please pay attention to the Writing Formula Section.

If you want to use this formula, please pay attention to the FORMULA file and/or git tag, which contains the currently released version. This formula is versioned according to Semantic Versioning.

See Formula Versioning Section for more details.

If you need (non-default) configuration, please refer to:

Contributing to this repo

Commit messages

Commit message formatting is significant!!

Please see How to contribute for more details.

pre-commit

pre-commit is configured for this formula, which you may optionally use to ease the steps involved in submitting your changes. First install the pre-commit package manager using the appropriate method, then run bin/install-hooks and now pre-commit will run automatically on each git commit. :

$ bin/install-hooks
pre-commit installed at .git/hooks/pre-commit
pre-commit installed at .git/hooks/commit-msg

Special notes

None.

Available states

dnsmasq

Install the dnsmasq package, start the service and apply custom settings.

dnsmasq.absent

Remove the dnsmasq package, and stop the associated dnsmasq service.

Testing

Linux testing is done with kitchen-salt.

Requirements

  • Ruby
  • Docker
$ gem install bundler
$ bundle install
$ bin/kitchen test [platform]

Where [platform] is the platform name defined in kitchen.yml, e.g. debian-9-2019-2-py3.

bin/kitchen converge

Creates the docker instance and runs the dnsmasq main state, ready for testing.

bin/kitchen verify

Runs the inspec tests on the actual instance.

bin/kitchen destroy

Removes the docker instance.

bin/kitchen test

Runs all of the stages above in one go: i.e. destroy + converge + verify + destroy.

bin/kitchen login

Gives you SSH access to the instance for manual testing.

Testing with Vagrant

FreeBSD testing is done with kitchen-salt.

Requirements

  • Ruby
  • Virtualbox
  • Vagrant

Setup

$ gem install bundler
$ bundle install --with=vagrant
$ bin/kitchen test [platform]

Where [platform] is the platform name defined in kitchen.vagrant.yml, e.g. windows-81-latest-py3.

Note

When testing using Vagrant you must set the environment variable KITCHEN_LOCAL_YAML to kitchen.vagrant.yml. For example:

$ KITCHEN_LOCAL_YAML=kitchen.vagrant.yml bin/kitchen test      # Alternatively,
$ export KITCHEN_LOCAL_YAML=kitchen.vagrant.yml
$ bin/kitchen test

Then run the following commands as needed.

bin/kitchen converge

Creates the Vagrant instance and runs the salt main states, ready for testing.

bin/kitchen verify

Runs the inspec tests on the actual instance.

bin/kitchen destroy

Removes the Vagrant instance.

bin/kitchen test

Runs all of the stages above in one go: i.e. destroy + converge + verify + destroy.

bin/kitchen login

Gives you RDP/SSH access to the instance for manual testing.

dnsmasq-formula's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

dnsmasq-formula's Issues

Refactor formula to match template-formula

  • use defaults.yaml & Co.
  • reduce Pillar data
    i.e. this needs to go:
dnsmasq:
  dnsmasq_conf: salt://dnsmasq/files/dnsmasq.conf
  dnsmasq_hosts: salt://dnsmasq/files/dnsmasq.hosts
  dnsmasq_cnames: salt://dnsmasq/files/dnsmasq.cnames
  dnsmasq_conf_dir: salt://dnsmasq/files/dnsmasq.d

Option to ignore resolvconf

Is your feature request related to a problem?

If the resolvconf package is installed (enabled by default for Debian based distributions), dnsmasq will use its output rather than the contents of '/etc/resolv.conf' to find upstream nameservers. Uncommenting the "IGNORE_RESOLVCONF=yes" line in '/etc/default/dnsmasq' inhibits this behaviour. Note that including a "resolv-file=" line in '/etc/dnsmasq.conf' is not enough to override resolvconf if it is installed: the line "IGNORE_RESOLVCONF=yes" must be uncommented.

Describe the solution you'd like

A file.uncomment state does the job.

/etc/default/dnsmasq:
  file.uncomment:
    - regex: 'IGNORE_RESOLVCONF=yes'
    - char: '#'
    - backup: False
  • Use (OS) defaults instead of hardcoded file path;
  • Enable/disable ignore_resolvconf based on pillar config, with a default value.

Describe alternatives you've considered

An alternative solution might be to optionally remove the resolvconf package - something that imo shouldn't be managed in this dnsmasq formula - or to use the resolver formula to manage/remove it.

Additional context

Sorry, I lack the knowledge to create a PR myself.

Add support for FreeBSD

Support for FreeBSD is lacking in this formula, and map.jinja doesn't seem to allow a way to slime it in via pillar lookup, unless you're running a very old Salt.

Subsidiary files not being included

I have a Debian config that includes additional hosts and cnames. The additional dnsmasq.{cnames,hosts} are generated in /etc, but there is nothing in dnsmasq.conf to include them. The dnsmasq.d file in files contains jinja that refers to addn-hosts, but nothing gets processed.

The init.d service spec contains an entry to add in files from /etc/dnsmasq.d but the files aren't in there.

DNSMASQ does not start since last 1 week

The package dns-root-data has been updated in repository and the new root.ds file has tabs instead of spaces as in version u1.

The below condition now fails because the sed editor is looking for spaces and does not find them resulting in non standard startup options, hence resulting in error "Junk found on command line"

ROOT_DS="/usr/share/dns/root.ds"

if [ -f $ROOT_DS ]; then
DNSMASQ_OPTS="$DNSMASQ_OPTS sed -e s/". IN DS "/--trust-anchor=.,/ -e s/" "/,/g $ROOT_DS | tr '\n' ' '"
fi

the sed editor options need to change and one of the working set is this.

DNSMASQ_OPTS="$DNSMASQ_OPTS sed -e s/".\t[0-9]*\tIN\tDS\t"/--trust-anchor=.,/ -e s/" "/,/g $ROOT_DS | tr '\n' ' '"

We can have another regex pattern which takes care of any white space, i am not good at regex hence someone will need to fix this.

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.