user-data only executed partly
Hi all,
I try to use cloud-init for configuring ubuntu 22.04 LTS / Ubuntu 23.10 instances on KVM. For this I have created a user-data file to setup users, network config, among others. It looks like this:
#cloud-config
hostname: devdba001
fqdn: devdba001.
groups:
- admingroup: [root,sys]
password: password
chpasswd:
expire: false
users:
- name: andyk
passwd: $6$ZWqWQ3QLeJ0h
lock_passwd: false
groups: [sudo, admingroup]
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
- name: andres
passwd: $6$ZWqWQ3QLeJ0h
lock_passwd: false
groups: [sudo, admingroup]
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
# Assign static IP address to primary interface
write_files:
- path: /etc/netplan/
permissions: '0600'
owner: root:root
content: |
network:
version: 2
renderer: networkd
ethernets:
enp1s0:
- to: default
enp2s0:
growpart:
mode: auto
devices: ["/"]
ignore_
runcmd:
- [ netplan, apply ]
- [ apt-get, update ]
# - [ systemctl, enable, ufw ]
# - [ ufw, enable ]
# - [ ufw, allow, ssh ]
# - [ systemctl, enable, ssh ]
# - [ ufw, default, allow, outgoing ]
# - [ ufw, default, deny, incoming ]
# Specify Power State:
power_state:
delay: "1"
mode: reboot
message: Rebooting after cloud-init
timeout: 30
condition: True
The parts of user creation and the write_file command are executed flawlessly. However, setting the password for the ubuntu user doesn't work either.
As you also can see I commented out some lines under the 'runcmd' part, as they just won't execute. The first two lines, "netplan apply"and "apt-get update" are executed, the rest is not executed. The same goes for the 'growpart' lines. They are not executed.
I use the Ubuntu cloud images "mantic-
I checked the log file /var/log/
Can anyone shed a light on this or perhaps help me with debugging this problem ?
best regards,
Andy Kannberg
Question information
- Language:
- English Edit question
- Status:
- Open
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Andy Kannberg for more information if necessary.