Fix resolver for EL7 systems 48/26748/1
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Wed, 9 Sep 2015 21:38:06 +0000 (14:38 -0700)
committerAndrew Grimberg <agrimberg@linuxfoundation.org>
Wed, 9 Sep 2015 21:38:06 +0000 (14:38 -0700)
EL7 systems were having issues with the resolv.conf not being created
properly. Dropping resolv.conf and setting imutable causes problems for
Fedora and Ubuntu systems so we needed to find a more consistent and
safe alternative.

Change-Id: I7c2904021721102d96bd4153233ce5122f573bc0
Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
vagrant/lf-networking/confignetwork.pp
vagrant/lf-networking/system_reseal.sh

index 6e295e8ec091f66856924d71d1b30d380965806b..b6cdd8aacb783fd9c027603c8e2258366b5e645a 100644 (file)
@@ -76,12 +76,39 @@ options timeout:2
 ",
 }
 
-# set routing
+file { '/etc/cloud/cloud.cfg.d/00_lf_resolv.cfg':
+  content => "#cloud-config
+
+manage_resolv_conf: true
+
+resolv_conf:
+  nameservers: ['127.0.0.1', '${ns1}', '${ns2}']
+  searchdomains:
+    - ${::subdomain}
+  options:
+    timeout: 2
+",
+}
+
+file_line { 'add_resolver':
+  path  => '/etc/cloud/cloud.cfg.d/10_rackspace.cfg',
+  line  => ' - resolv_conf',
+  after => ' - update_etc_hosts',
+}
+
+# OS specific configuration
 case $::operatingsystem {
   'CentOS', 'Fedora', 'RedHat': {
     file { '/etc/sysconfig/network-scripts/route-eth0':
       content => "default via ${router} dev eth0",
     }
+
+    # disable the DNS peerage so that our resolv.conf doesn't
+    # get destroyed
+    file_line { 'disable_peerdns':
+      path => '/etc/sysconfig/network',
+      line => 'PEERDNS=no',
+    }
   }
   'Ubuntu': {
     file { '/etc/network/if-up.d/0000routing':
index 07a0531777d120e61a4d1fd83ac5a85009f86e2a..87d60c30582aea2c0175b459ec40da351e827a27 100644 (file)
@@ -12,7 +12,7 @@ if [ -f /.autorelabel ]; then
 fi
 
 # clean-up from any prior cloud-init networking
-rm -rf /etc/sysconfig/network-scripts/{ifcfg,route}-eth*
+rm -rf /etc/sysconfig/network-scripts/ifcfg-eth*
 
 rm -rf /etc/Pegasus/*.cnf /etc/Pegasus/*.crt /etc/Pegasus/*.csr /etc/Pegasus/*.pem /etc/Pegasus/*.srl /root/anaconda-ks.cfg /root/anaconda-post.log /root/initial-setup-ks.cfg /root/install.log /root/install.log.syslog /var/cache/fontconfig/* /var/cache/gdm/* /var/cache/man/* /var/lib/AccountService/users/* /var/lib/fprint/* /var/lib/logrotate.status /var/log/*.log* /var/log/BackupPC/LOG /var/log/ConsoleKit/* /var/log/anaconda.syslog /var/log/anaconda/* /var/log/apache2/*_log /var/log/apache2/*_log-* /var/log/apt/* /var/log/aptitude* /var/log/audit/* /var/log/btmp* /var/log/ceph/*.log /var/log/chrony/*.log /var/log/cron* /var/log/cups/*_log /var/log/debug* /var/log/dmesg* /var/log/exim4/* /var/log/faillog* /var/log/gdm/* /var/log/glusterfs/*glusterd.vol.log /var/log/glusterfs/glusterfs.log /var/log/httpd/*log /var/log/installer/* /var/log/jetty/jetty-console.log /var/log/journal/* /var/log/lastlog* /var/log/libvirt/libvirtd.log /var/log/libvirt/lxc/*.log /var/log/libvirt/qemu/*.log /var/log/libvirt/uml/*.log /var/log/lightdm/* /var/log/mail/* /var/log/maillog* /var/log/messages* /var/log/ntp /var/log/ntpstats/* /var/log/ppp/connect-errors /var/log/rhsm/* /var/log/sa/* /var/log/secure* /var/log/setroubleshoot/*.log /var/log/spooler* /var/log/squid/*.log /var/log/syslog* /var/log/tallylog* /var/log/tuned/tuned.log /var/log/wtmp* /var/named/data/named.run