Skip to content

Instantly share code, notes, and snippets.

@ralvares
Last active March 16, 2021 03:50
Show Gist options
  • Select an option

  • Save ralvares/004a8e6bc5d376ba1dbd0e9d23dbab7e to your computer and use it in GitHub Desktop.

Select an option

Save ralvares/004a8e6bc5d376ba1dbd0e9d23dbab7e to your computer and use it in GitHub Desktop.
ntp on ocp4
chronybase64=$(cat << EOF | base64 -w 0
server 0.fi.pool.ntp.org iburst
server 1.fi.pool.ntp.org iburst
server 2.fi.pool.ntp.org iburst
server 3.fi.pool.ntp.org iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
keyfile /etc/chrony.keys
leapsectz right/UTC
logdir /var/log/chrony
EOF
)
cat << EOF > 50-worker-chrony.yaml
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: worker
name: 50-worker-chrony
spec:
config:
ignition:
version: 3.1.0
storage:
files:
- contents:
source: data:text/plain;charset=utf-8;base64,${chronybase64}
filesystem: root
mode: 0644
overwrite: true
path: /etc/chrony.conf
EOF
cat << EOF > 50-master-chrony.yaml
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: master
name: 50-master-chrony
spec:
config:
ignition:
version: 3.1.0
storage:
files:
- contents:
source: data:text/plain;charset=utf-8;base64,${chronybase64}
filesystem: root
mode: 0644
overwrite: true
path: /etc/chrony.conf
EOF
oc apply -f 50-worker-chrony.yaml
oc apply -f 50-master-chrony.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment