Learning by example – various examples of using Ansible with KVM
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-net
module to reconfigure the network so that the entire cluster can communicate. KVM accepts.xml
configuration for networking, andvirt-net
can 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 thevirsh net-dumpxml
syntax to output a virtual network configuration to standard output, which you can then use...