Open samene opened 1 week ago
I traced it back to this commit two years ago https://github.com/hetznercloud/terraform-provider-hcloud/pull/552/files
where there is a poweroff and poweron when there is no public net. I believe this may have been a API issue which is now fixed by hetzner and so this workaround should now be removed. ?
I believe this may have been a API issue which is now fixed
Where does this claim come from? Did you experiment to see if the behavior was fixed?
I opened another PR to run the CI multiple times, and I'll implement a test to make sure we do not have a regression.
I believe this may have been a API issue which is now fixed
Where does this claim come from? Did you experiment to see if the behavior was fixed?
I opened another PR to run the CI multiple times, and I'll implement a test to make sure we do not have a regression.
yes I did run a local test and I didnt see any issues with network when public net is disabled.
@samene Could you provide us the full cloud-init configuration ? It might be useful to add them to the regression tests.
here it is, as is. you may need to adjust it a bit. The main thing to test is that the user is able to sudo
#cloud-config
write_files:
- path: /etc/environment
owner: root
content: |
http_proxy=${http_proxy}
https_proxy=${http_proxy}
no_proxy=127.0.0.1/8,172.17.0.0/16,172.18.0.0/16,10.43.0.0/16,10.151.0.0/16,10.152.0.0/16,.hetzner-test.site,*.hetzner-test.site,.nip.io,*.nip.io
HTTP_PROXY=${http_proxy}
HTTPS_PROXY=${http_proxy}
NO_PROXY=127.0.0.1/8,172.17.0.0/16,172.18.0.0/16,10.43.0.0/16,10.151.0.0/16,10.152.0.0/16,.hetzner-test.site,*.hetzner-test.site,.nip.io,*.nip.io
CONTAINERD_HTTP_PROXY=${http_proxy}
CONTAINERD_HTTPS_PROXY=${http_proxy}
CONTAINERD_NO_PROXY=127.0.0.1/8,172.17.0.0/16,172.18.0.0/16,10.43.0.0/16,10.152.0.0/16,10.151.0.0/16,.hetzner-test.site,*.hetzner-test.site,nip.io,*.nip.io
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
- path: /etc/sysctl.d/60-disable-ipv6.conf
owner: root
content: |
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
net.bridge.bridge-nf-call-iptables=1
net.ipv6.conf.all.forwarding=0
- path: /etc/sudoers.d/91-sudopath
owner: root
content: |
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
- path: /etc/dnf/dnf.conf
content: |
proxy=${http_proxy}
append: true
- path: /etc/yum.conf
content: |
proxy=${http_proxy}
append: true
- path: /etc/resolv.conf
owner: root
content: |
nameserver 10.152.0.6
nameserver 185.12.64.1
domain .
hostname: ${hostname}
fqdn: ${hostname}.hetzner-test.site
prefer_fqdn_over_hostname: true
# auth section
disable_root: false
ssh_pwauth: yes
users:
- name: cloud-user
groups: users, admin
expiredate: '2032-09-01'
lock_passwd: false
ssh_authorized_keys:
- ${public_key}
sudo: "ALL=(ALL) NOPASSWD:ALL"
shell: /bin/bash
- name: hammer
groups: users, admin
expiredate: '2032-09-01'
lock_passwd: false
passwd: "$6$HRIebdEL4Q4v6M9S$Z1otUWUQS9slQxJUCYu2hD.s/PxhlX1cD53YNlkIBAU2PofST24MbYpay.7xX/pLwecJlscJQesVltuIw7fCB/"
sudo: "ALL=(ALL) NOPASSWD:ALL"
shell: /bin/bash
runcmd:
- until ip a | grep '10.151' > /dev/null; do sleep 5 && echo "waiting for network..."; done
- systemctl stop sshd
- hostnamectl set-hostname ${hostname}
- ip route add default via 10.151.0.1 dev enp7s0
- ip route add 10.152.0.0/24 via 10.151.0.1 dev enp7s0
- sed -i 's/#\?\(PermitRootLogin\s*\).*$/\1 yes/' /etc/ssh/sshd_config
- systemctl restart sshd
What happened?
When creating a
hcloud_server
resource the server starts and stops two times before finally starting up. The sequence of events is as belowWhat did you expect to happen?
Why is the server starting and stopping twice? It should only start once.
I believe this is messing up my cloud-init script. Especially the part where I am adding sudo users
The cloud-init runs the first time, but before it reaches this part the server is restarted. When it starts again and cloud-init runs again but skips the part about sudo user config. Thus my sudo user is missing
Why does the server start and stop twice?
Please provide a minimal working example
The same observation without
user_data
too.