title: Using cloud-init to change resolv.conf
body: <p>I want my setup of openstack to work such that when I boot a new instance, 8.8.8.8 should be added to dns-nameservers.</p>
  
  <p>This is my old /etc/resolv.conf (in the new VM which was spawned in openstack)- </p>
  
  <pre><code>nameserver 10.0.0.2
  search openstacklocal
  </code></pre>
  
  <p>And this is the new resolv.conf that I want -</p>
  
  <pre><code>nameserver 8.8.8.8
  nameserver 10.0.0.2
  search openstacklocal
  </code></pre>
  
  <p>I followed <a href="https://www.digitalocean.com/community/tutorials/an-introduction-to-cloud-config-scripting" rel="noreferrer">this</a> tutorial, and
  I have added the necessary info. of resolv conf to my config file(/etc/cloud/cloud.cfg) of cloud-init -</p>
  
  <pre><code>manage_resolv_conf: true
  
  resolv_conf:
    nameservers: ['8.8.4.4', '8.8.8.8']
    searchdomains:
      - foo.example.com
      - bar.example.com
    domain: example.com
    options:
      rotate: true
      timeout: 1
  </code></pre>
  
  <p>These changes are made in /etc/cloud/cloud.cfg file of the openstack host.
  However, the changes don't seem to get reflected.</p>
  
  <p>Any suggestions?</p>