Network/ManagedVM

From NURDspace

Bootstrapping a new VM

This procedure describes the step you must follow to rollout a new managed vm. This can be done two-fold: A newly deployed managed VM and retroactively adding a VM to management.

Deploying a new VM

Add DNS records

First up, you will need to create DNS records for the new machine. This is done by logging into [[1]]. In here, navigate to NURDspace -> 10.208.30.0/24, and select the next available free ip address. Fill in the form, be sure to add yourself as the owner of the ip address, and dont forget to add both an A record and a PTR record. You will need both.

Validate that DNS records work

Since DNS is crucial for getting a managed VM to work, you need to validate that the DNS records you just created work. To do this, run the following commands on the nurdspace network:

r3boot@egg:~$ dig +short @10.208.30.254 a testerdetest.vm.nurd.space 
10.208.30.20
r3boot@egg:~$ dig +short @10.208.30.254 ptr 20.30.208.10.in-addr.arpa
testerdetest.vm.nurd.space.

Make sure that the A record points to the correct ip address, and that the ip address points to the correct fqdn.

Update ansible inventory

Next, add the host to the ansible inventory under both the [all] and the [debian] groups, and commit your changes:

cd ansible
git pull
vi inventory # make your changes
git add inventory
git commit -m 'Added some host to the inventory'
git push

Create new virtual machine

Now it is time to create the new VM. Perform a KVM or CT, and follow the steps you require the host to have. There are two things that you must fix:

  1. The root account must have the well-known password
  2. Ssh must allow root logins using a password (set PermitRootLogin yes in /etc/ssh/sshd_config)

Run ansible on new machine

Once the machine is rebooted, run ansible (TODO: from your local system or from some management station on the network, to be determined)

cd ansible
git pull
./scripts/ansible-playbook manage.yml -l testerdetest.vm.nurd.space

Once this is finished without errors, the host is correctly provisioned

Retroactively making a VM managed

Validate that DNS records work

Since DNS is crucial for getting a managed VM to work, you need to validate that the DNS records you just created work. To do this, run the following commands on the nurdspace network:

r3boot@egg:~$ dig +short @10.208.30.254 any testerdetest.vm.nurd.space 
10.208.30.20
r3boot@egg:~$ dig +short @10.208.30.254 ptr 20.30.208.10.in-addr.arpa
testerdetest.vm.nurd.space.

Make sure that the A record points to the correct ip address, and that the ip address points to the correct fqdn.

Update ansible inventory

Next, add the host to the ansible inventory under both the [all] and the [debian] groups, and commit your changes:

cd ansible
git pull
vi inventory # make your changes
git add inventory
git commit -m 'Added some host to the inventory'
git push

Run ansible

Run the following command to provision the VM using the nurdspace ansible codebase.

cd ansible
git pull
./scripts/ansible-playbook manage.yml -l testerdetest.vm.nurd.space