-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Ensures system_info is written in all cases #69
Conversation
|
||
# Delete current "system_info:" block | ||
err_exit "Nuking standard system_info block..." NONE | ||
sed -i '/^system_info/,/^$/d' "${CLOUDCFG}" || \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this now is a "from to end" rather than a "from <TOKEN_1> to <TOKEN_2>" range, does this continue to work across all EL8s? Which is to ask, has /^system_info/
been moved to be the last configuration-block in not ust the OL8 version but all EL8 versions of the file?
I'm going to go look and answer my own question, but figured I'd ask here while I wait for instances to spin up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Ok. Looking at the one in the official RHEL 8 (you mentioned an "official" Oracle 8, but I'm not finding any such beast), looks like the file ends:
system_info:
default_user:
name: cloud-user
lock_passwd: true
gecos: Cloud User
groups: [adm, systemd-journal]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
distro: rhel
paths:
cloud_dir: /var/lib/cloud
templates_dir: /etc/cloud/templates
ssh_svcname: sshd
# vim:syntax=yaml
My vague recollection is that I'd originally chosen the range-token method because I wanted to preserve the content after the system_info:
stanza, even though it's, effectively, null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rocky ends similarly to RHEL (with the commented out vim:syntax=yaml
line:
$ sed -n '/^system_info/,$p' /etc/cloud/cloud.cfg
system_info:
default_user:
name: rocky
lock_passwd: true
gecos: Cloud User
groups: [adm, systemd-journal]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
distro: rhel
paths:
cloud_dir: /var/lib/cloud
templates_dir: /etc/cloud/templates
ssh_svcname: sshd
# vim:syntax=yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so CentOS 8 Stream doesn't have that token:
$ sed -n '/^system_info/,$p' /etc/cloud/cloud.cfg
system_info:
# This will affect which distro class gets used
distro: centos
# Default user name + that default users groups (if added/used)
default_user:
name: centos
lock_passwd: True
gecos: centos Cloud User
groups: [wheel, adm, systemd-journal]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
# Other config here will be given to the distro class and/or path classes
paths:
cloud_dir: /var/lib/cloud/
templates_dir: /etc/cloud/templates/
ssh_svcname: sshd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nor does Alma:
$ sed -n '/^system_info/,$p' /etc/cloud/cloud.cfg
system_info:
# This will affect which distro class gets used
distro: almalinux
# Default user name + that default users groups (if added/used)
default_user:
name: ec2-user
lock_passwd: True
gecos: almalinux Cloud User
groups: [adm, systemd-journal]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
# Other config here will be given to the distro class and/or path classes
paths:
cloud_dir: /var/lib/cloud/
templates_dir: /etc/cloud/templates/
ssh_svcname: sshd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proposed method won't adversely effect things – since the content after the system_info
block is, effectively, "decorative". I just hate obliterating stuff.
That said, the basis for the proposed change is in reference to an "official" Oracle Linux 8 AMI that I am failing to find as published by either AWS (as RHEL and CentOS are) or Oracle itself. All I'm seeing is third party OL8 AMIs. Can you point me at the "official" OL8 AMI (whose cloud.cfg
created the need for this PR)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the cloud.cfg in the base AMI:
system_info:
default_user:
name: ec2-user
lock_passwd: true
gecos: Cloud User
groups: [wheel, adm, systemd-journal]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
distro: rhel
paths:
cloud_dir: /var/lib/cloud
templates_dir: /etc/cloud/templates
ssh_svcname: sshd
Meaing the previous sed
statement ought to have worked. Updating the instance, now, to see if the cloud.cfg content has changed…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the problem can be reproduced outside of using chroot or similar to create a fresh new image.
Ok, converted to draft, pending a reply from Oracle on their broken packaging. We'll release the Nov AMIs without OL8. |
In the latest OL8 updates, the
cloud.cfg
in the chroot gets asystem_info
section that looks like this:That resulted in failures when the amigen8 logic attempted to figure out the cloud-init user, because there was no user at all:
This patch updates the logic to replace any
system_info
stanza with the standard one used throughout amigen projects. The primary change in logic to enable that is from this:to this: