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 | 82 | action :nothing |
83 | 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 | 90 | template '/etc/hosts' do |
86 | 91 | owner 'root' |
87 | 92 | mode 0644 |
88 | 93 | notifies :run, 'ruby_block[fqdn:update]', :immediately |
94 | + notifies :run, 'execute[avoid_etc_hosts_being_overwriten]', :immediately | |
89 | 95 | end | ... | ... |