Now that we’ve covered simple and more complex Ansible tasks, let’s think about how to use Ansible to further our configuration skills and overall compliance based on some kind of policy. The following are some things that we are going to leave as exercises for you:
- Task 1:
We configured and ran one machine per KVM host. Create a playbook that will form a pair of hosts – one running a website and another running a database. You can use any open source CMS for this.
- Task 2:
Use Ansible and the
virt-netmodule to reconfigure the network so that the entire cluster can communicate. KVM accepts
.xmlconfiguration for networking, and
virt-netcan both read and write XML. Hint: If you get confused, use a separate RHEL8 machine to create a virtual network in the GUI and then use the
virsh net-dumpxmlsyntax to output a virtual network configuration to standard output, which you can then use as a template.
- Task 3:
virshto auto-start a specific VM that you created/imported on the host.
- Task 4:
Based on our LAMP deployment playbook, improve on it by doing the following:
a) Create a playbook that will run on a remote machine.
b) Create a playbook that will install different roles on different servers.