How to Rename our Ubuntu Server

Now that you have create a base install / Master Image of Ubuntu Server, we can create our first clone of that Master Image and use it as our Ansible Master server.

I would recommend against naming either your server or your username as ansible as I have found from experience, this gets confusing AND can cause weird problems. Instead, in this series we will simply call our server: ansible-master.

To do this, firstly, we create a Full Clone of our Master Image, remembering to tick the box to Refresh the MAC Address.

Once the clone is completed, we can power on and login using the credentials you created when building your Master Image.

If you have used something other than Ubuntu Server as your Master Image, changing the server's name may not follow this process - Google is your friend.

As our Master Image was set to have an SSH server installed, I prefer to connect to the new server via SSH. I don't particularly enjoy working directly on any Virtual Machine console.

ssh codereview@

Change up the username and IP address to match your server. If unsure of the IP address, on the Virtual Machine console, type:


Which will list off the IP addresses your VM has been assigned.

Once on the server, we need to update the server's name in three places.

sudo hostname ansible-master

Then we need to edit the /etc/hosts file:

sudo vi /etc/hosts

Inside that file, change the ubuntu-master (or whatever you called your server in your Master Image) to match your new server name, i.e. ansible-master.

Lastly, we need to edit the /etc/hostname file:

sudo vi /etc/hostname

Changing out whatever is in there to match your new server name, e.g. ansible-master.

Lastly, we give our server a reboot:

sudo reboot now

And we are all done.

Code For This Course

Get the code for this course.


# Title Duration
1 How To Install Ubuntu Server in Oracle VirtualBox 10:21
2 How to Rename our Ubuntu Server 02:00
3 Installing Ansible on Ubuntu Server 00:33
4 Safety First, Safety Second - Snapshots are like Ctrl+Z 00:11
5 Managing the Ansible Inventory Hosts File 02:16
6 Ansible Ad Hoc Commands 04:27
7 Introduction to Ansible Playbooks 02:14
8 Ansible Handlers 01:39
9 Ansible Variables 03:16
10 Git Your Deploy Just Right 05:35
11 Ansible Roles 05:51
12 Looping in Ansible with_items 04:35
13 Ansible Files For Beginners 06:16
14 Variable Precedence - Where To Put Your Role Vars? 04:13
15 Ansible Templates 05:51
16 Ansible Inventory With Our Own Hosts Files 06:57
17 How to Manage Users with Ansible 08:32
18 Ansible Vault Tutorial 03:48
19 Ansible Galaxy Tutorial 10:03
20 Real World Ansible - Common Role Walkthrough 06:20
21 Ansible MySQL Tutorial 13:44
22 Ansible Symfony and nginx 09:37