* cloud-init resolv.conf updates
@ 2015-06-11 21:37 Loic Dachary
2015-06-12 5:01 ` Alexandre DERUMIER
0 siblings, 1 reply; 5+ messages in thread
From: Loic Dachary @ 2015-06-11 21:37 UTC (permalink / raw
To: Mehdi Abaakouk; +Cc: Ceph Development
[-- Attachment #1: Type: text/plain, Size: 1379 bytes --]
Hi Mehdi,
I tried to
manage_resolv_conf: true
resolv_conf:
nameservers: ['8.8.4.4', '8.8.8.8']
but did not get any result and according to /var/log/cloud-init.log it does not seem to be taken into account.
It looks like this is still an open issue according to
https://answers.launchpad.net/ubuntu/+source/cloud-init/+question/234041
https://bugs.launchpad.net/cloud-init/+bug/1394061
even when you get past the misleading example that spells manage-resolv-conf instead of manag_resolv_conf at
http://cloudinit.readthedocs.org/en/stable/topics/examples.html#configure-an-instances-resolv-conf
It looks like there would be a need to add
cloud_config_modules:
- resolv_conf
according to http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/doc/examples/cloud-config.txt#L300 but I don't know which modules I need and which are optional and if the list is going to be merged with the default or override.
so I ended up doing:
#cloud-config
bootcmd:
- echo "nameserver 10.0.3.31" | sudo tee -a /etc/resolvconf/resolv.conf.d/head
- sudo resolvconf -u
Which works for Ubuntu 14.04 but isn't going to work for every operating system ;-)
I'm sure you faced something similar in the past and I'd very much appreciate a pointer in the right direction.
Cheers
--
Loïc Dachary, Artisan Logiciel Libre
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cloud-init resolv.conf updates
2015-06-11 21:37 cloud-init resolv.conf updates Loic Dachary
@ 2015-06-12 5:01 ` Alexandre DERUMIER
2015-06-12 5:57 ` Alexandre DERUMIER
2015-06-12 7:17 ` Loic Dachary
0 siblings, 2 replies; 5+ messages in thread
From: Alexandre DERUMIER @ 2015-06-12 5:01 UTC (permalink / raw
To: Loic Dachary; +Cc: Mehdi Abaakouk, ceph-devel
Hi Loic,
I'm always playing with cloudinit currently,
and I never can get working resolv_conf module too (with configdrive datasource)
Finaly, I manage it with this configdrive:
/latest/meta_data.json
{
"uuid": "c5240fed-76a8-48d9-b417-45b46599d999",
"network_config" :{ "content_path": "/content/0000"}
}
/content/0000
auto eth0
iface eth0 inet static
address x.X.X.X
netmask 255.255.255.0
gateway X.X.X.X
dns-nameservers X.X.X.X
dns-search mydomain
The config is at debian format, but each cloud-init agent on different os parse it,
and transform it to correct distro format. (/sysconfig/.. for redhat).
----- Mail original -----
De: "Loic Dachary" <loic@dachary.org>
À: "Mehdi Abaakouk" <sileht@sileht.net>
Cc: "ceph-devel" <ceph-devel@vger.kernel.org>
Envoyé: Jeudi 11 Juin 2015 23:37:39
Objet: cloud-init resolv.conf updates
Hi Mehdi,
I tried to
manage_resolv_conf: true
resolv_conf:
nameservers: ['8.8.4.4', '8.8.8.8']
but did not get any result and according to /var/log/cloud-init.log it does not seem to be taken into account.
It looks like this is still an open issue according to
https://answers.launchpad.net/ubuntu/+source/cloud-init/+question/234041
https://bugs.launchpad.net/cloud-init/+bug/1394061
even when you get past the misleading example that spells manage-resolv-conf instead of manag_resolv_conf at
http://cloudinit.readthedocs.org/en/stable/topics/examples.html#configure-an-instances-resolv-conf
It looks like there would be a need to add
cloud_config_modules:
- resolv_conf
according to http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/doc/examples/cloud-config.txt#L300 but I don't know which modules I need and which are optional and if the list is going to be merged with the default or override.
so I ended up doing:
#cloud-config
bootcmd:
- echo "nameserver 10.0.3.31" | sudo tee -a /etc/resolvconf/resolv.conf.d/head
- sudo resolvconf -u
Which works for Ubuntu 14.04 but isn't going to work for every operating system ;-)
I'm sure you faced something similar in the past and I'd very much appreciate a pointer in the right direction.
Cheers
--
Loïc Dachary, Artisan Logiciel Libre
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cloud-init resolv.conf updates
2015-06-12 5:01 ` Alexandre DERUMIER
@ 2015-06-12 5:57 ` Alexandre DERUMIER
2015-06-12 7:17 ` Loic Dachary
1 sibling, 0 replies; 5+ messages in thread
From: Alexandre DERUMIER @ 2015-06-12 5:57 UTC (permalink / raw
To: Loic Dachary; +Cc: Mehdi Abaakouk, ceph-devel
Looking at resolvconf cloud-init src:
https://github.com/number5/cloud-init/blob/74e61ab27addbfcceac4eba254f739ef9964b0ed/cloudinit/config/cc_resolv_conf.py
" As Debian/Ubuntu will, by default, utilize
# resovlconf, and similarly RedHat will use sysconfig, this module is
# likely to be of little use unless those are configured correctly.
"
...
"distros = ['fedora', 'rhel', 'sles']"
...
"def handle(name, cfg, cloud, log, _args):
"""
Handler for resolv.conf
@param name: The module name "resolv-conf" from cloud.cfg
"
I have check inside debian /etc/cloud/cloud.cfg, resolv-conf is not in the list of the modules.
I think that because ubuntu use resolvconf by default (which create a symlink /etc/resolv.conf),
the resolv-conf module is not used
----- Mail original -----
De: "aderumier" <aderumier@odiso.com>
À: "Loic Dachary" <loic@dachary.org>
Cc: "Mehdi Abaakouk" <sileht@sileht.net>, "ceph-devel" <ceph-devel@vger.kernel.org>
Envoyé: Vendredi 12 Juin 2015 07:01:44
Objet: Re: cloud-init resolv.conf updates
Hi Loic,
I'm always playing with cloudinit currently,
and I never can get working resolv_conf module too (with configdrive datasource)
Finaly, I manage it with this configdrive:
/latest/meta_data.json
{
"uuid": "c5240fed-76a8-48d9-b417-45b46599d999",
"network_config" :{ "content_path": "/content/0000"}
}
/content/0000
auto eth0
iface eth0 inet static
address x.X.X.X
netmask 255.255.255.0
gateway X.X.X.X
dns-nameservers X.X.X.X
dns-search mydomain
The config is at debian format, but each cloud-init agent on different os parse it,
and transform it to correct distro format. (/sysconfig/.. for redhat).
----- Mail original -----
De: "Loic Dachary" <loic@dachary.org>
À: "Mehdi Abaakouk" <sileht@sileht.net>
Cc: "ceph-devel" <ceph-devel@vger.kernel.org>
Envoyé: Jeudi 11 Juin 2015 23:37:39
Objet: cloud-init resolv.conf updates
Hi Mehdi,
I tried to
manage_resolv_conf: true
resolv_conf:
nameservers: ['8.8.4.4', '8.8.8.8']
but did not get any result and according to /var/log/cloud-init.log it does not seem to be taken into account.
It looks like this is still an open issue according to
https://answers.launchpad.net/ubuntu/+source/cloud-init/+question/234041
https://bugs.launchpad.net/cloud-init/+bug/1394061
even when you get past the misleading example that spells manage-resolv-conf instead of manag_resolv_conf at
http://cloudinit.readthedocs.org/en/stable/topics/examples.html#configure-an-instances-resolv-conf
It looks like there would be a need to add
cloud_config_modules:
- resolv_conf
according to http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/doc/examples/cloud-config.txt#L300 but I don't know which modules I need and which are optional and if the list is going to be merged with the default or override.
so I ended up doing:
#cloud-config
bootcmd:
- echo "nameserver 10.0.3.31" | sudo tee -a /etc/resolvconf/resolv.conf.d/head
- sudo resolvconf -u
Which works for Ubuntu 14.04 but isn't going to work for every operating system ;-)
I'm sure you faced something similar in the past and I'd very much appreciate a pointer in the right direction.
Cheers
--
Loïc Dachary, Artisan Logiciel Libre
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cloud-init resolv.conf updates
2015-06-12 5:01 ` Alexandre DERUMIER
2015-06-12 5:57 ` Alexandre DERUMIER
@ 2015-06-12 7:17 ` Loic Dachary
2015-06-12 8:02 ` Alexandre DERUMIER
1 sibling, 1 reply; 5+ messages in thread
From: Loic Dachary @ 2015-06-12 7:17 UTC (permalink / raw
To: Alexandre DERUMIER; +Cc: ceph-devel
[-- Attachment #1: Type: text/plain, Size: 2719 bytes --]
Hi Alexandre,
That's an interesting trick :-) Would it also work with
auto eth0
iface eth0 inet dhcp
dns-nameservers X.X.X.X
Where can I read more about this ?
Cheers
On 12/06/2015 07:01, Alexandre DERUMIER wrote:
> Hi Loic,
>
> I'm always playing with cloudinit currently,
> and I never can get working resolv_conf module too (with configdrive datasource)
>
>
> Finaly, I manage it with this configdrive:
>
> /latest/meta_data.json
> {
> "uuid": "c5240fed-76a8-48d9-b417-45b46599d999",
> "network_config" :{ "content_path": "/content/0000"}
> }
>
> /content/0000
>
> auto eth0
> iface eth0 inet static
> address x.X.X.X
> netmask 255.255.255.0
> gateway X.X.X.X
> dns-nameservers X.X.X.X
> dns-search mydomain
>
>
> The config is at debian format, but each cloud-init agent on different os parse it,
> and transform it to correct distro format. (/sysconfig/.. for redhat).
>
>
>
> ----- Mail original -----
> De: "Loic Dachary" <loic@dachary.org>
> À: "Mehdi Abaakouk" <sileht@sileht.net>
> Cc: "ceph-devel" <ceph-devel@vger.kernel.org>
> Envoyé: Jeudi 11 Juin 2015 23:37:39
> Objet: cloud-init resolv.conf updates
>
> Hi Mehdi,
>
> I tried to
>
> manage_resolv_conf: true
>
> resolv_conf:
> nameservers: ['8.8.4.4', '8.8.8.8']
>
> but did not get any result and according to /var/log/cloud-init.log it does not seem to be taken into account.
>
> It looks like this is still an open issue according to
>
> https://answers.launchpad.net/ubuntu/+source/cloud-init/+question/234041
> https://bugs.launchpad.net/cloud-init/+bug/1394061
>
> even when you get past the misleading example that spells manage-resolv-conf instead of manag_resolv_conf at
>
> http://cloudinit.readthedocs.org/en/stable/topics/examples.html#configure-an-instances-resolv-conf
>
> It looks like there would be a need to add
>
> cloud_config_modules:
> - resolv_conf
>
> according to http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/doc/examples/cloud-config.txt#L300 but I don't know which modules I need and which are optional and if the list is going to be merged with the default or override.
>
> so I ended up doing:
>
> #cloud-config
> bootcmd:
> - echo "nameserver 10.0.3.31" | sudo tee -a /etc/resolvconf/resolv.conf.d/head
> - sudo resolvconf -u
>
> Which works for Ubuntu 14.04 but isn't going to work for every operating system ;-)
>
> I'm sure you faced something similar in the past and I'd very much appreciate a pointer in the right direction.
>
> Cheers
>
--
Loïc Dachary, Artisan Logiciel Libre
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cloud-init resolv.conf updates
2015-06-12 7:17 ` Loic Dachary
@ 2015-06-12 8:02 ` Alexandre DERUMIER
0 siblings, 0 replies; 5+ messages in thread
From: Alexandre DERUMIER @ 2015-06-12 8:02 UTC (permalink / raw
To: Loic Dachary; +Cc: ceph-devel
>> Would it also work with
>>
>>auto eth0
>>iface eth0 inet dhcp
>>dns-nameservers X.X.X.X
yes it should work
>>Where can I read more about this ?
Well, cloud-init doc is pretty poor.
I have digged inside cloud-init git ;)
https://github.com/number5/cloud-init/blob/74e61ab27addbfcceac4eba254f739ef9964b0ed/cloudinit/sources/DataSourceConfigDrive.py
def on_first_boot(data, distro=None):
"""Performs any first-boot actions using data read from a config-drive."""
if not isinstance(data, dict):
raise TypeError("Config-drive data expected to be a dict; not %s"
% (type(data)))
net_conf = data.get("network_config", '')
if net_conf and distro:
LOG.debug("Updating network interfaces from config drive")
distro.apply_network(net_conf)
then
https://github.com/number5/cloud-init/blob/74e61ab27addbfcceac4eba254f739ef9964b0ed/cloudinit/distros/__init__.py
def apply_network(self, settings, bring_up=True):
# Write it out
dev_names = self._write_network(settings)
debian (simply write the /etc/network/interfaces)
-------------------------------------------------
https://github.com/number5/cloud-init/blob/74e61ab27addbfcceac4eba254f739ef9964b0ed/cloudinit/distros/debian.py
def _write_network(self, settings):
util.write_file(self.network_conf_fn, settings)
return ['all']
redhat (translate to redhat network conf file and resolv.conf)
------------------------------------------------------------------
https://github.com/number5/cloud-init/blob/74e61ab27addbfcceac4eba254f739ef9964b0ed/cloudinit/distros/rhel.py
def _write_network(self, settings):
# TODO(harlowja) fix this... since this is the ubuntu format
entries = net_util.translate_network(settings)
LOG.debug("Translated ubuntu style network settings %s into %s",
settings, entries)
# Make the intermediate format as the rhel format...
nameservers = []
searchservers = []
dev_names = entries.keys()
use_ipv6 = False
for (dev, info) in entries.items():
net_fn = self.network_script_tpl % (dev)
net_cfg = {
'DEVICE': dev,
'NETMASK': info.get('netmask'),
'IPADDR': info.get('address'),
'BOOTPROTO': info.get('bootproto'),
'GATEWAY': info.get('gateway'),
'BROADCAST': info.get('broadcast'),
'MACADDR': info.get('hwaddress'),
'ONBOOT': _make_sysconfig_bool(info.get('auto')),
}
if info.get('inet6'):
use_ipv6 = True
net_cfg.update({
'IPV6INIT': _make_sysconfig_bool(True),
'IPV6ADDR': info.get('ipv6').get('address'),
'IPV6_DEFAULTGW': info.get('ipv6').get('gateway'),
})
rhel_util.update_sysconfig_file(net_fn, net_cfg)
if 'dns-nameservers' in info:
nameservers.extend(info['dns-nameservers'])
if 'dns-search' in info:
searchservers.extend(info['dns-search'])
if nameservers or searchservers:
rhel_util.update_resolve_conf_file(self.resolve_conf_fn,
nameservers, searchservers)
if dev_names:
net_cfg = {
'NETWORKING': _make_sysconfig_bool(True),
}
# If IPv6 interface present, enable ipv6 networking
if use_ipv6:
net_cfg['NETWORKING_IPV6'] = _make_sysconfig_bool(True)
net_cfg['IPV6_AUTOCONF'] = _make_sysconfig_bool(False)
rhel_util.update_sysconfig_file(self.network_conf_fn, net_cfg)
return dev_names
----- Mail original -----
De: "Loic Dachary" <loic@dachary.org>
À: "aderumier" <aderumier@odiso.com>
Cc: "ceph-devel" <ceph-devel@vger.kernel.org>
Envoyé: Vendredi 12 Juin 2015 09:17:47
Objet: Re: cloud-init resolv.conf updates
Hi Alexandre,
That's an interesting trick :-) Would it also work with
auto eth0
iface eth0 inet dhcp
dns-nameservers X.X.X.X
Where can I read more about this ?
Cheers
On 12/06/2015 07:01, Alexandre DERUMIER wrote:
> Hi Loic,
>
> I'm always playing with cloudinit currently,
> and I never can get working resolv_conf module too (with configdrive datasource)
>
>
> Finaly, I manage it with this configdrive:
>
> /latest/meta_data.json
> {
> "uuid": "c5240fed-76a8-48d9-b417-45b46599d999",
> "network_config" :{ "content_path": "/content/0000"}
> }
>
> /content/0000
>
> auto eth0
> iface eth0 inet static
> address x.X.X.X
> netmask 255.255.255.0
> gateway X.X.X.X
> dns-nameservers X.X.X.X
> dns-search mydomain
>
>
> The config is at debian format, but each cloud-init agent on different os parse it,
> and transform it to correct distro format. (/sysconfig/.. for redhat).
>
>
>
> ----- Mail original -----
> De: "Loic Dachary" <loic@dachary.org>
> À: "Mehdi Abaakouk" <sileht@sileht.net>
> Cc: "ceph-devel" <ceph-devel@vger.kernel.org>
> Envoyé: Jeudi 11 Juin 2015 23:37:39
> Objet: cloud-init resolv.conf updates
>
> Hi Mehdi,
>
> I tried to
>
> manage_resolv_conf: true
>
> resolv_conf:
> nameservers: ['8.8.4.4', '8.8.8.8']
>
> but did not get any result and according to /var/log/cloud-init.log it does not seem to be taken into account.
>
> It looks like this is still an open issue according to
>
> https://answers.launchpad.net/ubuntu/+source/cloud-init/+question/234041
> https://bugs.launchpad.net/cloud-init/+bug/1394061
>
> even when you get past the misleading example that spells manage-resolv-conf instead of manag_resolv_conf at
>
> http://cloudinit.readthedocs.org/en/stable/topics/examples.html#configure-an-instances-resolv-conf
>
> It looks like there would be a need to add
>
> cloud_config_modules:
> - resolv_conf
>
> according to http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/doc/examples/cloud-config.txt#L300 but I don't know which modules I need and which are optional and if the list is going to be merged with the default or override.
>
> so I ended up doing:
>
> #cloud-config
> bootcmd:
> - echo "nameserver 10.0.3.31" | sudo tee -a /etc/resolvconf/resolv.conf.d/head
> - sudo resolvconf -u
>
> Which works for Ubuntu 14.04 but isn't going to work for every operating system ;-)
>
> I'm sure you faced something similar in the past and I'd very much appreciate a pointer in the right direction.
>
> Cheers
>
--
Loïc Dachary, Artisan Logiciel Libre
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-06-12 8:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-11 21:37 cloud-init resolv.conf updates Loic Dachary
2015-06-12 5:01 ` Alexandre DERUMIER
2015-06-12 5:57 ` Alexandre DERUMIER
2015-06-12 7:17 ` Loic Dachary
2015-06-12 8:02 ` Alexandre DERUMIER
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.