{"id":21664429,"url":"https://github.com/wayofdev/ansible-role-dnsmasq","last_synced_at":"2025-04-12T00:16:10.202Z","repository":{"id":38213028,"uuid":"473778181","full_name":"wayofdev/ansible-role-dnsmasq","owner":"wayofdev","description":"Ansible role installs Dnsmasq on macOS and configures *.docker hostname.","archived":false,"fork":false,"pushed_at":"2023-12-01T22:12:53.000Z","size":605,"stargazers_count":10,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T00:16:03.615Z","etag":null,"topics":["ansible","ansible-role","automation","dns","dnsmasq","macos","networking","osx-setup"],"latest_commit_sha":null,"homepage":"https://wayof.dev","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wayofdev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"wayofdev"}},"created_at":"2022-03-24T21:25:07.000Z","updated_at":"2023-08-03T21:48:58.000Z","dependencies_parsed_at":"2023-01-21T22:04:08.648Z","dependency_job_id":null,"html_url":"https://github.com/wayofdev/ansible-role-dnsmasq","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayofdev%2Fansible-role-dnsmasq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayofdev%2Fansible-role-dnsmasq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayofdev%2Fansible-role-dnsmasq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayofdev%2Fansible-role-dnsmasq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wayofdev","download_url":"https://codeload.github.com/wayofdev/ansible-role-dnsmasq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248497818,"owners_count":21113984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role","automation","dns","dnsmasq","macos","networking","osx-setup"],"created_at":"2024-11-25T10:38:35.700Z","updated_at":"2025-04-12T00:16:10.173Z","avatar_url":"https://github.com/wayofdev.png","language":"Makefile","funding_links":["https://github.com/sponsors/wayofdev"],"categories":[],"sub_categories":[],"readme":"\u003cbr\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg width=\"456\" src=\"https://raw.githubusercontent.com/wayofdev/ansible-role-dnsmasq/master/assets/logo.gh-light-mode-only.png#gh-light-mode-only\"\u003e\n\u003cimg width=\"456\" src=\"https://raw.githubusercontent.com/wayofdev/ansible-role-dnsmasq/master/assets/logo.gh-dark-mode-only.png#gh-dark-mode-only\"\u003e\n\u003c/div\u003e\n\n\n\n\u003cbr\u003e\n\n\u003cbr\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://actions-badge.atrox.dev/wayofdev/ansible-role-dnsmasq/goto\"\u003e\u003cimg alt=\"Build Status\" src=\"https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fwayofdev%2Fansible-role-dnsmasq%2Fbadge\u0026style=flat-square\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://galaxy.ansible.com/wayofdev/dnsmasq\"\u003e\u003cimg alt=\"Ansible Role\" src=\"https://img.shields.io/ansible/role/59601?style=flat-square\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/wayofdev/ansible-role-dnsmasq/tags\"\u003e\u003cimg src=\"https://img.shields.io/github/v/tag/wayofdev/ansible-role-dnsmasq?sort=semver\u0026style=flat-square\" alt=\"Latest Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://galaxy.ansible.com/wayofdev/dnsmasq\"\u003e\u003cimg alt=\"Ansible Quality Score\" src=\"https://img.shields.io/ansible/quality/59601?style=flat-square\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://galaxy.ansible.com/wayofdev/dnsmasq\"\u003e\u003cimg alt=\"Ansible Role\" src=\"https://img.shields.io/ansible/role/d/59601?style=flat-square\"/\u003e\u003c/a\u003e\n\u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/wayofdev/ansible-role-dnsmasq.svg?style=flat-square\u0026color=blue\" alt=\"Software License\"/\u003e\u003c/a\u003e\n\u003ca href=\"#\"\u003e\u003cimg alt=\"Commits since latest release\" src=\"https://img.shields.io/github/commits-since/wayofdev/ansible-role-dnsmasq/latest?style=flat-square\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\n\n\u003cbr\u003e\n\n# Ansible Role: Dnsmasq for MacOS\n\n![Screenshot](assets/screenshot.png)\n\nRole is used to automate installation and setup of [dnsmasq](https://thekelleys.org.uk/dnsmasq/doc.html). Dnsmasq provides network infrastructure for small networks: DNS, DHCP, router advertisement and network boot.\n\nBy default, role configures Dnsmasq to serve `*.docker` and `*.mac` domains as `localhost`. This allows you to use wildcard domains, like `your.subdomain.project.docker` for every of your project.\n\n### → Purpose\n\nDevelopers will be familiar with the process of updating your `/etc/hosts` file to direct traffic for `yourproject.docker` to `127.0.0.1`. Most will also be familiar with the problems of this approach:\n\n- it requires a configuration change every time you add or remove a project; and\n- it requires administration access to make the change.\n\nFor ***nix** and **MacOS** users there is a solution – **Dnsmasq**, which replaces the need for you, to edit the hosts file for each project you work with. Dnsmasq works good together with [Træfik](https://traefik.io/) and **Docker**.\n\nThere is a known issue with [Docker for Mac](https://www.docker.com/docker-mac) – \"[.localhost DNS doesn’t resolve in browsers other than Chrome](https://forums.docker.com/t/localhost-dns-doesnt-resolve-in-browsers-other-than-chrome/16300)\". Users who are working on Windows and using WSL or without it, will also have problems to get wildcard domains like `my.virtual.host.docker` working. For them, there is other thread and solutions described on [superuser.com](https://superuser.com/questions/135595/using-wildcards-in-names-in-windows-hosts-file).\n\n\u003cbr\u003e\n\nIf you **like/use** this role, please consider **starring** it. Thanks!\n\n\u003cbr\u003e\n\n## 📑 Requirements\n\n* Up-to-date version of ansible. During maintenance/development, we stick to ansible versions and will use new features if they are available (and update `meta/main.yml` for the minimum version).\n* Compatible OS. See [compatibility](#-compatibility) table.\n* `jmespath` library needs to be installed on the host running the playbook (needed for the `json_query` filter).\n* Role has dependencies on third-party roles on different operating systems. See `requirements.yml` and [dependencies](#-dependencies) section.\n\n\u003cbr\u003e\n\n## 🔧 Role Variables\n\nAvailable variables are listed below, along with example values (see `defaults/main.yml`). Additional variables are stored in `vars/main.yml`.\n\n### → Structure\n\nAdd domain names that will be mapped to ip addresses. Defaults should be fine, if you are using our wayofdev/mac-provisioner playbook:\n\n```yaml\ndnsmasq_hosts:\n  # Mapping some top level domains to localhost\n  - {domain: 'docker', ip: '127.0.0.1'}\n  - {domain: 'mac', ip: '127.0.0.1'}\n```\n\n\u003cbr\u003e\n\n## 📗 Example Playbook\n\n```yaml\n---\n- hosts: all\n\n  # is needed when running over SSH\n  environment:\n    - PATH: \"/usr/local/bin:/usr/local/sbin:/opt/homebrew/bin:{{ ansible_env.PATH }}\"\n\n  vars:\n    dnsmasq_hosts:\n      - {domain: 'docker', ip: '127.0.0.1'}\n      - {domain: 'mac', ip: '127.0.0.1'}\n\n  roles:\n    - wayofdev.homebrew\n    - wayofdev.dnsmasq\n```\n\n\u003cbr\u003e\n\n## ⚙️ Development\n\nTo install dependencies and start development you can check contents of our `Makefile`\n\n**Install** [poetry](https://github.com/python-poetry/poetry) using [poetry-bin](https://github.com/gi0baro/poetry-bin) and all dev python dependencies:\n\n```bash\n$ make install\n```\n\n**Install** only python dependencies, assuming that you already have poetry:\n\n```bash\n$ make install-deps\n```\n\n**Install** all git hooks:\n\n```bash\n$ make hooks\n```\n\n**Lint** all role files:\n\n```bash\n$ make lint\n```\n\n\u003cbr\u003e\n\n## 🧪 Testing\n\nYou can check `Makefile` to get full list of commands for remote and local testing. For local testing you can use these comands to test whole role or separate tasks:\n\n### → on localhost\n\n\u003e :warning: **Notice**: By defaut all tests are running against your local machine!\n\n```bash\n# run molecule tests on localhost\n$ poetry run molecule test --scenario-name defaults-restored-on-localhost -- -vvv\n\n# or with make command\n$ make m-local\n\n# choose which tags will be included\n$ export TASK_TAGS=\"dnsmasq-install,dnsmasq-configure\"; make m-local\n```\n\n\u003cbr\u003e\n\n### → over SSH\n\n```bash\n# run molecule scenarios against remote machines over SSH\n# this will need VM setup and configuration\n$ poetry run molecule test --scenario-name defaults-restored-over-ssh -- -vvv\n\n$ make m-remote\n\n# tags also can be passed\n$ export TASK_TAGS=\"dnsmasq-install,dnsmasq-configure\"\n$ make m-remote\n```\n\n\u003cbr\u003e\n\n## 📦 Dependencies\n\nInstallation handled by `Makefile` and requirements are defined in `requirements.yml`\n\n  - [wayofdev.homebrew](https://github.com/wayofdev/ansible-role-homebrew) - soft dependency, required if Homebrew isn't installed yet\n  - [ansible.community.general](https://docs.ansible.com/ansible/latest/collections/community/general/index.html)\n\n\u003cbr\u003e\n\n## 🧩 Compatibility\n\nThis role has been tested on these systems:\n\n| system / container | tag      |\n| :----------------- | -------- |\n| macos              | monterey |\n| macos              | big-sur  |\n\n\u003cbr\u003e\n\n## 🤝 License\n\n[![Licence](https://img.shields.io/github/license/wayofdev/ansible-role-dnsmasq?style=for-the-badge\u0026color=blue)](./LICENSE)\n\n\u003cbr\u003e\n\n## 🙆🏼‍♂️ Author Information\n\nThis role was created in **2022** by [lotyp / wayofdev](https://github.com/wayofdev).\n\n\u003cbr\u003e\n\n## 🧱 Credits and Resources\n\n**What I've found on internet:**\n\n* [robertdebock/ansible-role-dnsmasq](https://github.com/robertdebock/ansible-role-dnsmasq) ansible role to manage dnsmasq on Alpine, Debian, Fedora, Ubuntu...\n* Also Debian/Ubuntu users can take a look at [Debops](https://galaxy.ansible.com/debops/)'s [Dnsmasq role](https://galaxy.ansible.com/debops/dnsmasq/).\n* An Ansible role for managing Dnsmasq on RHEL/CentOS 7 of Fedora. [bertvv/ansible-dnsmasq](https://github.com/bertvv/ansible-dnsmasq)\n\n\u003cbr\u003e\n\n## 🫡 Contributors\n\n\u003cimg align=\"left\" src=\"https://img.shields.io/github/contributors-anon/wayofdev/ansible-role-dock?style=for-the-badge\"/\u003e\n\n\u003ca href=\"https://github.com/wayofdev/ansible-role-dock/graphs/contributors\"\u003e\n  \u003cimg src=\"https://opencollective.com/wod/contributors.svg?width=890\u0026button=false\"\u003e\n\u003c/a\u003e\n\n\u003cbr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwayofdev%2Fansible-role-dnsmasq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwayofdev%2Fansible-role-dnsmasq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwayofdev%2Fansible-role-dnsmasq/lists"}