vamfoom
vamfoom

Reputation: 101

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?

Upvotes: 3

Views: 4700

Answers (1)

vamfoom
vamfoom

Reputation: 101

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

Upvotes: 5

Related Questions