amazon web services - Chef reciepe update route53 records -
i have recipe running in chef server gets ec2 node hostname , public dns , creates cname point hostname.mydomain.com easier access. i'm moving vpc , there no more public dns sense in private network , uses private ip address in class a. need have chef create record instead of cname pointing private ip address.
here recipe:
aws=hash.new aws['aws_access_key_id'] = node[:base][:aws [:access_key_id] aws['aws_secret_access_key'] = node[:base][:aws][:secret_access_key] if node[:base][:aws][:route53][:update_cname_records] == true cnames = [] cnames << "#{node.name}" unless node[:base][:aws][:route53][:additional_cnames].nil? node[:base][:aws][:route53][:additional_cnames].each |n| cnames << n end end cnames.each |cname| cname_fqdn = "#{cname}.#{node[:base][:aws][:route53][:management_zone_name]}" log ("updating route53 cname record #{cname_fqdn}") { level :warn } aws_route53_record "create route53 cname record #{cname_fqdn}" name cname_fqdn value node[:cloud][:public_hostname] type "cname" ttl node[:base][:aws][:route53][:ttl] zone_id node[:base][:aws][:route53][:management_zone_id] aws_access_key aws['aws_access_key_id'] aws_secret_access_key aws['aws_secret_access_key'] action :create end end else log ("not updating route53 cname records because node[:base][:aws][:route53][:update_cname_records] = #{node[:base][:aws][:route53][:update_cname_records]}") { level :warn } end
Comments
Post a Comment