/attributes/default.rb

https://github.com/ClodoCorp/cookbook-bind · Ruby · 114 lines · 60 code · 16 blank · 38 comment · 4 complexity · 51d4324d336c2a2f3186bf4479cb84e4 MD5 · raw file

  1. #
  2. # Cookbook Name:: bind
  3. # Attributes:: default
  4. #
  5. # Copyright 2011, Eric G. Wolfe
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. #
  19. default['bind']['packages'] = %w(bind bind-utils bind-libs)
  20. default['bind']['vardir'] = '/var/named'
  21. default['bind']['sysconfdir'] = '/etc/named'
  22. default['bind']['conf_file'] = '/etc/named.conf'
  23. default['bind']['options_file'] = "named.conf.options"
  24. default['bind']['views_file'] = "#{node['bind']['sysconfdir']}/named.views"
  25. default['bind']['service_name'] = 'named'
  26. default['bind']['user'] = 'named'
  27. default['bind']['group'] = 'named'
  28. default['bind']['rndc-key'] = '/etc/rndc.key'
  29. # Allow usage with chef-solo-search, see https://github.com/edelight/chef-solo-search
  30. default['bind']['allow_solo_search'] = false
  31. # Set platform/version specific directories and settings
  32. case node['platform_family']
  33. when 'debian'
  34. default['bind']['packages'] = %w(bind9 bind9utils)
  35. default['bind']['sysconfdir'] = '/etc/bind'
  36. default['bind']['conf_file'] = "#{node['bind']['sysconfdir']}/named.conf"
  37. default['bind']['options_file'] = "named.conf.options"
  38. default['bind']['vardir'] = '/var/cache/bind'
  39. default['bind']['service_name'] = 'bind9'
  40. default['bind']['user'] = 'bind'
  41. default['bind']['group'] = 'bind'
  42. default['bind']['rndc-key'] = "#{node['bind']['sysconfdir']}/rndc.key"
  43. end
  44. # Files which should be included in named.conf
  45. default['bind']['included_files'] = %W(named.rfc1912.zones #{node['bind']['options_file']})
  46. # These are var files referenced by our rfc1912 zone and root hints (named.ca) zone
  47. default['bind']['var_cookbook_files'] = %w(named.empty named.ca named.loopback named.localhost)
  48. # This an array of masters, or servers which you transfer from.
  49. default['bind']['masters'] = []
  50. # Boolean to turn off/on IPV6 support
  51. default['bind']['ipv6_listen'] = false
  52. default['bind']['listen-on'] = []
  53. default['bind']['listen-on-v6'] = []
  54. default['bind']['listen-on-port'] = 53
  55. default['bind']['listen-on-v6-port'] = default['bind']['listen-on-port']
  56. # If this is a virtual machine, you need to use urandom as
  57. # any VM does not have a real CMOS clock for entropy.
  58. if node.key?('virtualization') && node['virtualization']['role'] == 'guest'
  59. default['bind']['rndc_keygen'] = 'rndc-confgen -a -r /dev/urandom'
  60. else
  61. default['bind']['rndc_keygen'] = 'rndc-confgen -a'
  62. end
  63. # These two attributes are used to load named ACLs from data bags.
  64. # The search key is the "acl-role", and defaults to internal-acl
  65. default['bind']['acl-role'] = 'internal-acl'
  66. default['bind']['acls'] = []
  67. # These attributes are for setting allow-* options. Each is a list of ACLs defined in data_bag.
  68. # If allow-query is not redefined, only requests from localhost and local networks will be served.
  69. #default['bind']['allow-query'] = [ :localhost, :localnets ]
  70. default['bind']['allow-query'] = nil
  71. default['bind']['allow-query-cache'] = nil
  72. default['bind']['allow-recursion'] = nil
  73. default['bind']['allow-transfer'] = nil
  74. default['bind']['allow-notify'] = nil
  75. # Enable/disable recursion in options block. Enabled by default.
  76. default['bind']['recursion'] = true
  77. # This attribute is for setting site-specific Global option lines
  78. # to be included in the template.
  79. default['bind']['options'] = []
  80. # Set an override at the role, or environment level for the bind.zones array.
  81. # bind.zonetype is used in the named.conf file for configured zones.
  82. default['bind']['zones']['attribute'] = []
  83. default['bind']['zones']['ldap'] = []
  84. default['bind']['zones']['databag'] = []
  85. default['bind']['zones']['zones'] = Mash.new
  86. default['bind']['zonetype'] = 'slave'
  87. default['bind']['zonesource'] = nil
  88. # This attribute enable logging
  89. default['bind']['enable_log'] = false
  90. default['bind']['log_file'] = '/var/log/bind9/query.log'
  91. default['bind']['log_options'] = []
  92. # These are for enabling statistics-channel on a TCP port.
  93. default['bind']['statistics-channel'] = true
  94. default['bind']['statistics-port'] = 8080
  95. case node['platform_family']
  96. when 'rhel'
  97. default['bind']['statistics-channel'] if node['platform_version'].to_i <= 5
  98. end