Building the Ansible inventory
In this recipe, you will create a simple group to include the virtual network (VPC) and leverage Ansible roles to complement it to achieve the expected results.
Note
Like in Chapters 8 and 9, we use a static inventory, but a dynamic approach using a GCP dynamic inventory could be used to manage existing infrastructure.
You can reuse the settings in the ansible.cfg file used in previous recipes (for example, Chapters 8 and 9), specifying the vault password file that stores the encryption password for securing sensitive information.
- Create a
hostsfiles inside thech10folder with the following data:root@cookbook-lab:~/cookbook-lab/chapters/ch10# vi hosts [gcp_vpc] demo_gcp_vpc - Reuse the
ansible.cfgfile from other chapters (for example, Chapter 9):root@cookbook-lab:~/cookbook-lab/chapters/ch10# vi ansible.cfg [defaults] &...