Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cloud-init manage_resolv_conf

I have the following in my user-data file for cloud-init, but this doesn't seem to work

#cloud-config
manage_resolv_conf: true
resolv_conf:
  nameservers: ['10.0.100.1']
  searchdomains:
    - myawesomedomain.com
  domain: myawesomedomain.com
  options:
    rotate: true
    timeout: 1

In my centos 7 resolv.conf after initial VM creation:

; Created by cloud-init on instance boot automatically, do not edit.
;
# Generated by NetworkManager
nameserver 10.0.2.3
search localdomain

I haven't the slightest idea where that IP for the nameserver came from. Any idea what I'm missing?

like image 799
vamfoom Avatar asked Oct 25 '25 23:10

vamfoom


1 Answers

I figured it out eventually.

Turns out that on CentOS 7, the resolv_conf cloud-init module doesn't run by default. I had to enable this in cloud_config_modules in my user-data file:

cloud_config_modules: 
  - resolv_conf
like image 144
vamfoom Avatar answered Oct 28 '25 03:10

vamfoom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!