Created
April 13, 2017 00:33
-
-
Save vinyar/a84df4c579f2ae3d8fd8c4d348f5d983 to your computer and use it in GitHub Desktop.
recipe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Note that IP address 2.2.2.2 is added as it should, but then hostname resource removes it. | |
Recipe: lk_base::via_hostfile | |
* hostsfile_entry[127.0.1.1] action create | |
Recipe: <Dynamically Defined Resource> | |
* file[/etc/hosts] action create | |
- update content in file /etc/hosts from 7e4391 to 6994f8 | |
--- /etc/hosts 2017-04-13 00:12:00.526652000 +0000 | |
+++ /etc/.chef-hosts20170413-20240-1njwh1c 2017-04-13 00:17:10.693658000 +0000 | |
@@ -9,9 +9,9 @@ | |
127.0.0.1 test-node localhost | |
127.0.1.1 local-testing.test.test local-testing | |
+10.0.2.15 local-testing local-testing | |
1.1.1.1 local-testing-ext local-testing-ext.labkey.com | |
ff02::1 ip6-allnodes | |
ff02::2 ip6-allrouters | |
::1 localhost ip6-localhost ip6-loopback | |
-10.0.2.15 local-testing local-testing | |
- Create hostsfile_entry[127.0.1.1] | |
Recipe: lk_base::via_hostfile | |
* hostsfile_entry[1.1.1.1] action create (up to date) | |
########### Created via the hostfile_entry resource | |
* hostsfile_entry[2.2.2.2] action create | |
Recipe: <Dynamically Defined Resource> | |
* file[/etc/hosts] action create | |
- update content in file /etc/hosts from 6994f8 to 4c6862 | |
--- /etc/hosts 2017-04-13 00:17:10.693658000 +0000 | |
+++ /etc/.chef-hosts20170413-20240-1bc2sgu 2017-04-13 00:17:10.701662000 +0000 | |
@@ -10,6 +10,7 @@ | |
127.0.0.1 test-node localhost | |
127.0.1.1 local-testing.test.test local-testing | |
10.0.2.15 local-testing local-testing | |
+2.2.2.2 local-testing local-testing-int local-testing.labkey.com local-testing-int.labkey.com | |
1.1.1.1 local-testing-ext local-testing-ext.labkey.com | |
ff02::1 ip6-allnodes | |
ff02::2 ip6-allrouters | |
- Create hostsfile_entry[2.2.2.2] | |
Recipe: lk_base::via_hostfile | |
####### Now the hostname resource removes it | |
* hostname[local-testing] action set | |
* ohai[reload hostname] action nothing (skipped due to action :nothing) | |
* execute[set hostname to local-testing] action run (skipped due to not_if) | |
* file[/etc/hosts] action create | |
- update content in file /etc/hosts from 4c6862 to 7e4391 | |
--- /etc/hosts 2017-04-13 00:17:10.701662000 +0000 | |
+++ /etc/.chef-hosts20170413-20240-1la4ypz 2017-04-13 00:17:10.737679999 +0000 | |
@@ -9,10 +9,9 @@ | |
127.0.0.1 test-node localhost | |
127.0.1.1 local-testing.test.test local-testing | |
-10.0.2.15 local-testing local-testing | |
-2.2.2.2 local-testing local-testing-int local-testing.labkey.com local-testing-int.labkey.com | |
1.1.1.1 local-testing-ext local-testing-ext.labkey.com | |
ff02::1 ip6-allnodes | |
ff02::2 ip6-allrouters | |
::1 localhost ip6-localhost ip6-loopback | |
##### Now it adds one of them back in | |
+10.0.2.15 local-testing local-testing | |
* execute[hostnamectl set-hostname local-testing] action run (skipped due to not_if) | |
* ohai[reload hostname] action reload | |
- re-run ohai and merge results into node attributes | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# was: 127.0.1.1 <%= @node[:ec2][:local_hostname] =%> <%= @local_hostname =%> <%= @app_url_hostname =%> | |
hostsfile_entry '127.0.1.1' do | |
hostname node['ec2']['local_hostname'] | |
aliases [ | |
node['ec2']['local_hostname'].split('.')[0], | |
node['lk_base']['customer_url_hostname'], | |
] | |
# unique true # needs discussion | |
action :create | |
not_if { node['lk_base']['set_hostname'] == 'not_set' } | |
end | |
# ############# | |
# # was: <%= @extIP =%> <%= @extString =%> | |
# ## This may be duplicate of what hostname cookbook does. | |
hostsfile_entry node['ec2']['public_ipv4'] do | |
hostname "#{node['lk_base']['set_hostname']}-ext" | |
aliases [node['lk_base']['set_fqdn_ext']] | |
action :create | |
not_if { node['lk_base']['set_hostname'] == 'not_set' } | |
end | |
# # was: <%= @intIP =%> <%= @intString =%> <%= @app_url_hostname =%> | |
hostsfile_entry node['ec2']['local_ipv4'] do | |
hostname node['lk_base']['set_hostname'] | |
aliases [ | |
"#{node['lk_base']['set_hostname']}-int", | |
node['lk_base']['set_fqdn'], | |
node['lk_base']['set_fqdn_int'], | |
node['lk_base']['customer_url_hostname'], | |
] | |
not_if { node['lk_base']['set_hostname'] == 'not_set' } | |
end | |
########## This is the resource that fucks things up | |
# # Update the /etc/hostname file, if required. | |
hostname "updating hostname to #{node['lk_base']['set_hostname']}" do | |
hostname node['lk_base']['set_hostname'] | |
only_if { node['lk_base']['set_hostname'] != 'not_set' } | |
# ipaddress nil | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Finally, I just noticed there is another issue:
having this resource definition throws a chef13 warning