Git Product home page Git Product logo

cloud-init's People

Contributors

aciba90 avatar anhvoms avatar ani-sinha avatar blackboxsw avatar catmsred avatar cjp256 avatar cpaelzer avatar dermotbradley avatar eb3095 avatar goneri avatar harlowja avatar harmw avatar holmanb avatar igalic avatar juergh avatar larsks avatar oddbloke avatar otubo avatar paride avatar raharper avatar rjschwei avatar s-makin avatar smoser avatar sorenisanerd avatar sshedi avatar therealfalcon avatar vholer avatar warsaw avatar wiedenmeier avatar xnox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud-init's Issues

DHCP - namerservers not defined to expected ones when initializing a VM.

I am struggling when setting up nameservers at server boot time.

Setup

My setup is a virtual machine (CentOS8 - qemu version) managed by libvirt.

Cloud init version in CentOS8 vm

[root@services log]# cloud-init -v
/bin/cloud-init 18.5

Network setup:

<network xmlns:dnsmasq='http://libvirt.org/schemas/network/dnsmasq/1.0'>
    <name>okd_network</name>
    <bridge name="virbr1" />
    <forward mode="nat">
        <nat>
            <port start='0' end='65535'/>
        </nat>
    </forward>
    <ip address='10.0.5.1' netmask='255.255.255.0'>
        <dhcp>
            <host mac="52:54:10:00:05:57" name="services.sandbox.okd.local" ip="10.0.5.57"/>
            <host mac="52:54:10:00:05:58" name="bootstrap.sandbox.okd.local" ip="10.0.5.58"/>
            <host mac="52:54:10:00:05:59" name="control-plane-0.sandbox.okd.local" ip="10.0.5.59"/>
        </dhcp>
    </ip>
    <dnsmasq:options>
        <dnsmasq:option value="dhcp-option=option:dns-server,10.0.5.57,8.8.8.8"/>
        <dnsmasq:option value="log-dhcp"/>
    </dnsmasq:options>
</network>

By running this command under my host dhcping -s 10.0.5.1 -c 10.0.5.57 -h 52:54:10:00:05:57 I obtain this in my log journalctl -f -u libvirtd

déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 available DHCP subnet: 10.0.5.1/255.255.255.0
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 DHCPREQUEST(virbr1) 10.0.5.57 52:54:10:00:05:57
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 tags: known, virbr1
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: Ignoring domain sandbox.okd.local for DHCP host name services
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 DHCPACK(virbr1) 10.0.5.57 52:54:10:00:05:57 services
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 next server: 10.0.5.1
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 sent size:  1 option: 53 message-type  5
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 sent size:  4 option: 54 server-identifier  10.0.5.1
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 sent size:  4 option: 51 lease-time  1h
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 sent size:  4 option: 58 T1  30m
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 sent size:  4 option: 59 T2  52m30s
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 sent size:  4 option:  1 netmask  255.255.255.0
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 sent size:  4 option: 28 broadcast  10.0.5.255
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 sent size:  4 option:  3 router  10.0.5.1
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 sent size:  8 option: 12 hostname  services
déc. 25 21:46:52 linux-4.home dnsmasq-dhcp[746134]: 3159352927 sent size:  8 option:  6 dns-server  10.0.5.57, 8.8.8.8

=> the dns-server returned by the netmasq dhcp is well defined to 10.0.5.57 and 8.8.8.8.

After the VM has booted I've got this log cloud-init.log

2020-12-25 15:12:41,143 - stages.py[DEBUG]: applying net config names for {'version': 2, 'ethernets': {'eth0': {'match': {'mac_address': '52:54:10:00:05:57'}, 'addresses': ['10.0.5.57'], 'gateway4': '10.0.5.1', 'nameservers': {'addresses': ['127.0.0.1', '8.8.8.8']}}}}

IP and gateway addresses are well defined, however I expect to have 10.0.5.57 and 8.8.8.8 for nameservers.

Checking the network /etc/sysconfig/network-scripts/ifcfg-eth0 I've got this:

# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
DNS1=127.0.0.1
DNS2=8.8.8.8
GATEWAY=10.0.5.1
IPADDR=10.0.5.57
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

DNS1 and DNS2 do not match my expected value from dhcp setup.

If I check the /etc/resolv.conf content I have got :

[root@services log]# cat /etc/resolv.conf 
# Generated by NetworkManager
search sandbox.okd.local
nameserver 127.0.0.1
nameserver 8.8.8.8

Which correspond to the DNS1 and DNS2 values unwanted values.

If I ran dhclient my resolv.conf is defined with expected nameservers

[root@services log]# cat /etc/resolv.conf 
; generated by /usr/sbin/dhclient-script
nameserver 10.0.5.57
nameserver 8.8.8.8

So the dhcp is well defined.

What can I do to ensure that DNS1 and DNS2 will correspond to the nameservers defined in DHCP libvirt network setup ?

cloud not generate the authkey fingerprints

Generation complete.

 * Stopping System V runlevel compatibility�[74G[ OK ]

Cloud-init v. 0.7.5 running 'modules:final' at Wed, 12 Nov 2014 05:43:10 +0000. Up 27.73 seconds.
2014-11-12 05:43:10,646 - util.py[WARNING]: Running ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python2.7/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.pyc'>) failed
ec2: 
ec2: #############################################################
ec2: -----BEGIN SSH HOST KEY FINGERPRINTS-----
ec2: -----END SSH HOST KEY FINGERPRINTS-----
ec2: #############################################################
-----BEGIN SSH HOST KEY KEYS-----
-----END SSH HOST KEY KEYS-----
Cloud-init v. 0.7.5 finished at Wed, 12 Nov 2014 05:43:10 +0000. Datasource DataSourceEc2.  Up 27.88 seconds

the "chef_license" entry in CHEF_RB_TPL_PATH_KEYS causes failure

'chef_license',

Hello - I noticed while getting cloud-init to bootstrap Chef that the "chef_license" entry caused Cloud-init to fail:

2021-02-23 18:36:24,030 - util.py[DEBUG]: Running module chef (<module 'cloudinit.config.cc_chef' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_chef.py'>) failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 848, in _run_modules
    ran, _r = cc.run(run_name, mod.handle, func_args,
  File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
  File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 185, in run
    results = functor(*args)
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_chef.py", line 445, in handle
    util.ensure_dirs(param_paths)
  File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1504, in ensure_dirs
    ensure_dir(d, mode)
  File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1557, in ensure_dir
    os.makedirs(path)
  File "/usr/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''

Please let me know if you have any issues replicating.

/etc/hosts keeps changing after reboot

Hi,

we're managing VMs that are initialized via cloud-init and noticed that after each reboot, the /etc/hosts is back to its "templated version" rather than what the config management system had updated it to.

I suppose that this line https://github.com/number5/cloud-init/blob/master/cloudinit/config/cc_update_etc_hosts.py#L24 is why it does that - is there any objection to changing this to PER_ONCE instead of PER_ALWAYS ?

If so, is there a plan to make this configurable via cloud.cfg ? OR - am I on the wrong track here :) ?

Thanks!
Alex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.