Created
August 4, 2021 16:24
-
-
Save jparrill/4a02bcc8a00e70f2d81fcb071d135b8b to your computer and use it in GitHub Desktop.
samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: machineconfiguration.openshift.io/v1 | |
kind: MachineConfig | |
metadata: | |
labels: | |
machineconfiguration.openshift.io/role: worker | |
name: network-manager-extra-conf-worker | |
spec: | |
config: | |
ignition: | |
version: 3.1.0 | |
storage: | |
files: | |
- contents: | |
source: data:;base64,W21haW5dCnJjLW1hbmFnZXI9ZmlsZQpbY29ubmVjdGlvbl0KaXB2Ni5kaGNwLWR1aWQ9bGwKaXB2Ni5kaGNwLWlhaWQ9bWFjCltrZXlmaWxlXQp1bm1hbmFnZWQtZGV2aWNlcz1pbnRlcmZhY2UtbmFtZTplbnAzczBmMQo= | |
filesystem: root | |
mode: 420 | |
overwrite: true | |
path: /etc/NetworkManager/conf.d/99-onprem-cluster.conf | |
systemd: | |
units: | |
- name: set-hostname.service | |
enabled: true | |
contents: | | |
[Unit] | |
Description=Writes IP address configuration so that kubelet and crio services select a valid node IP | |
Wants=network-online.target | |
After=network-online.target ignition-firstboot-complete.service | |
Before=kubelet.service crio.service | |
[Service] | |
Type=oneshot | |
ExecStart=/bin/bash -c "if [[ $(hostname) == *localhost* ]]; then \ | |
REVERSE=$(dig -x $(hostname -I | cut -f1) +short) ;\ | |
HOSTNAME=${REVERSE::-1} ;\ | |
echo $HOSTNAME > /etc/hostname ;\ | |
nmcli general hostname $HOSTNAME ;\ | |
systemctl restart systemd-hostnamed ;\ | |
else echo Hostname properly set; exit 0 ; fi" | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment