Roles is valid for only one server
Closed this issue · 4 comments
If i don't have secondary and forward server but only master server, is posible use this role?
I test with this playbook:
- hosts: dns_server
become: "{{ sudo | default('yes') }}"
roles:
- ansible-role-bind
tags:
- bind-server
vars:
bind_statistics_channels: true
bind_statistics_allow:
- any
bind_zone_dir: /var/local/named-zones
bind_zone_file_mode: '0660'
bind_recursion: true
bind_dns64: true
bind_query_log: 'data/query.log'
bind_check_names: 'master ignore'
bind_zone_minimum_ttl: "2D"
bind_zone_ttl: "2W"
bind_zone_time_to_refresh: "2D"
bind_zone_time_to_retry: "2H"
bind_zone_time_to_expire: "2W"
bind_statistics_host: "{{ ansible_default_ipv4.address }}"
bind_allow_query:
- any
bind_listen_ipv4:
- any
bind_listen_ipv6:
- any
bind_acls:
- name: acl1
match_list:
- 10.27.0.0/16
bind_forwarders:
- '8.8.8.8'
- '8.8.4.4'
pre_tasks:
- name: Get dict for each zone
include_vars:
dir: zones
- name: Merge zone dicts
set_fact:
bind_zone_domains:
"{{ domain_1 }} +
{{ domain_2 }}"
I have the error:
TASK [ansible-role-bind : Check
primariesor
forwarderswas set for each zone] ********************************************************* fatal: [openwisp.basilicata.nnxx]: FAILED! => {"msg": "The conditional check 'item.primaries is defined or item.forwarders' failed. The error was: error while evaluating conditional (item.primaries is defined or item.forwarders): 'dict object' has no attribute 'forwarders'"}
@mikysal78 , the role can work on master only. Can you please share your bind_zone_domains
definition ?
@GR360RY my zone {{ domain_1 }} in playbook is {{ basilicata_nnxx }} is:
---
basilicata_nnxx:
- name: basilicata.nnxx
hostmaster_email: hostmaster
create_reverse_zones: true
primaries:
- 10.27.253.1
name_servers:
- ns1.basilicata.nnxx.
- ns2.basilicata.nnxx.
also_notify:
- 10.27.253.1
- 10.27.253.2
hosts:
- name: '@'
ip: 10.27.253.1
- name: 'ns1'
ip: 10.27.253.1
- name: 'ns2'
ip: 10.27.253.2
- name: 'nas'
ip: 10.27.22.2
ipv6: fd25:fc4:1261::2
- name: 'my-media'
ip: 10.27.22.6
ipv6: fd25:fc4:1261::6
- name: 'jenkins'
ip: 10.27.22.113
aliases:
- downloads
- name: pc-fisso
ip: 10.27.22.100
aliases:
- virtualbox
- vbox
I edit local role your PR #141 and is ok.
Only change bind_zone_domains is renamed to bind_zones.
But as a change to use only one server?
remove only nameserver ns2 and also_notify?
Thanks
@mikysal78 , you are absolutely correct - just keep only a single entry under name_servers
and remove also_notify
.
Thanks