diff --git a/defaults/main.yml b/defaults/main.yml index 1870587..f97a546 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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. diff --git a/templates/config.yaml.j2 b/templates/config.yaml.j2 index 3b59480..8263421 100644 --- a/templates/config.yaml.j2 +++ b/templates/config.yaml.j2 @@ -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