Commit e0f0255d58444aa58a055031757c5a050379b893
1 parent
d327915b
Exists in
master
and in
89 other branches
avoid cloud-init overwriting /etc/hosts
Showing
1 changed file
with
6 additions
and
0 deletions
Show diff stats
cookbooks/basics/recipes/default.rb
@@ -82,8 +82,14 @@ ruby_block 'fqdn:update' do | @@ -82,8 +82,14 @@ ruby_block 'fqdn:update' do | ||
82 | action :nothing | 82 | action :nothing |
83 | end | 83 | end |
84 | 84 | ||
85 | +execute 'avoid_etc_hosts_being_overwriten' do | ||
86 | + command 'sed -i -e \'/^\s*-\s*update_etc_hosts/d\' /etc/cloud/cloud.cfg' | ||
87 | + only_if { File.exist?('/etc/cloud/cloud.cfg') } | ||
88 | +end | ||
89 | + | ||
85 | template '/etc/hosts' do | 90 | template '/etc/hosts' do |
86 | owner 'root' | 91 | owner 'root' |
87 | mode 0644 | 92 | mode 0644 |
88 | notifies :run, 'ruby_block[fqdn:update]', :immediately | 93 | notifies :run, 'ruby_block[fqdn:update]', :immediately |
94 | + notifies :run, 'execute[avoid_etc_hosts_being_overwriten]', :immediately | ||
89 | end | 95 | end |