Skip to content

Commit

Permalink
allow to set inventory group for dns hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
resmo committed Nov 13, 2024
1 parent c0adfd9 commit f53683d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ blocky__custom_domain: {}

# Add hosts from inventory to blocky custom dns (default=false)
blocky__hosts_dns_enabled: false
# Which inventory group for adding hosts
blocky__hosts_dns_invenory_group: all
# NOTE: to ignore an host, add `blocky__hosts_dns_ignore=true` to its host_vars
blocky__hosts_dns_ignore: false
# Optional domain to append to the custom DNS entry.
Expand Down
2 changes: 1 addition & 1 deletion templates/config.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# {{ ansible_managed }}
{% if blocky__hosts_dns_enabled -%}
# Added to blocky__custom_dns from inventory due to blocky__hosts_dns_enabled=true
{% for host in groups["all"] -%}
{% for host in groups[blocky__hosts_dns_invenory_group] -%}
{% set fqdn = host + blocky__hosts_dns_domain %}
{% if (hostvars[host]["blocky__hosts_dns_ignore"] is undefined or not hostvars[host]["blocky__hosts_dns_ignore"])
and fqdn not in blocky__custom_dns
Expand Down

0 comments on commit f53683d

Please sign in to comment.