Files
gitea-pages/admin-guide/configuration/basic/host_rename.md

59 lines
1.5 KiB
Markdown

# Host Renaming
Following steps are required to rename a host.
## Introduce New Hostname
### Sysdb/bob
For sysdb create a new node with bob as usual.
For reference do
```
OLD_FQDN=my-old-hostname.psi.ch
NEW_FQDN=my-new-hostname.psi.ch
bob node list -v $OLD_FQDN
```
then add the new node
```
bob node add $NEW_FQDN $SYSDB_ENV
bob node set-attr $NEW_FQDN [all attributes as listed above]
```
and the same for the MAC addresses:
```
for mac in $(bob node list-macs $OLD_FQDN); do echo bob node add-mac $NEW_FQDN $mac; done
```
### Hiera
In Hiera ensure that a host specific configuration file exists for the FQDN with the same content as for the old hostname.
## Acutal Hostname Change
On the node as `root` run
```
hostnamectl set-hostname $NEW_FQDN
rm -rf /etc/puppetlabs/puppet/ssl
puppet agent -t
```
which changes the local hostname, removes the local Puppet certificate and updates the configuration with Puppet using the new hostname.
## Other Changes to Consider
- change DNS entry if a static IP address is assigned
- redo SSL/TLS certificates with new hostname
- if the host is icinga2 monitored you need to remove icinga2 from the host before running puppet so that a new cert, etc. is generated for the host
```
yum remove icinga2-common icinga2-bin icinga2
rm -rf /var/lib/icinga2
rm -rf /etc/icinga2
```
## Remove Old Hostname
- `bob node delete $OLD_FQDN`
- remove from Hiera
- inform the Linux Team (linux-eng@psi.ch) so it can remove from Puppet server the certificate and other data and remove the computer object from the AD