Skip to content

Commit

Permalink
common: Add host domain to /etc/hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
JGoutin committed Aug 26, 2024
1 parent 418b5b1 commit 7c09c78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions roles/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ packages.
| `common_dns_servers` | | Space-separated list of DNS servers to use, if not set will use the default value generally provided by the DHCP server. If `common_dns_over_tls` is set to `"yes"`, it is recommended to servers values to `address#server_name` to allow certificate validation. |
| `common_dns_servers_fallback` | `"1.1.1.1 9.9.9.9 1.0.0.1 149.112.112.112 2606:4700:4700::1111 2620:fe::fe 2606:4700:4700::1001 2620:fe::9"` | Space-separated list of fallback DNS servers to use. The default use Cloudflare and Quad9 DNS servers (Google is replaced for privacy reason). |
| `common_dnssec` | | If `"yes"`, enforce DNSSEC validation locally, else use default configuration. The DNS server must support DNSSEC. |
| `common_domain` | | Domain/FQDN of the current machine. |
| `common_fail2ban_action` | `%(action_mwl)s` | Fail2ban default action. By default, ban user and send mail with detailed logs to root. |
| `common_grub_auto_hide` | false | If `true` configure Grub to auto-hide. |
| `common_grub_cmdline_linux_default` | | Space-separated list of extra Linux kernel options passed on boot using `GRUB_CMDLINE_LINUX_DEFAULT`. |
Expand Down
8 changes: 8 additions & 0 deletions roles/common/tasks/dns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@
name: systemd-resolved
state: restarted
changed_when: false

- name: Ensure host domain is set in /etc/hosts with localhost IPv6

Check failure on line 35 in roles/common/tasks/dns.yml

View workflow job for this annotation

GitHub Actions / static-analysis

fqcn[action-core]

Use FQCN for builtin module actions (lineinfile).
lineinfile:
path: /etc/hosts
regexp: '^::1\s+'
line: "::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 {{ common_domain | default(omit) }}"
state: present
when: common_domain is defined

0 comments on commit 7c09c78

Please sign in to comment.