Our Ansible code is going to be very simple indeed:
1 2 3 4 5 6 7
That's because all we're currently doing with Ansible is managing the deployment of the application. Nothing more complex than this is currently required. That's not to say it won't get more complex as time goes on, because it will.
We're not using any Ansible roles at this point in time, but we will as the configuration of our environment grows and becomes more complex.
Let's look at the file in a bit more detail. We'll go into detail about file in sub-sections of the book.
ansible.cfg file allows us to adjust Ansible's core functionality. It's the primary location for storing Ansible configuration options.
We have an inventory file defined called
inventory.yaml. Originally Ansible only supported INI based inventory files, but it has since been developed to support a YAML structure. This structure is more favourable as it can be easily dynamically generated.
We have a single Playbook:
main.yaml. This Playbook does everything for us at this point in time. For example it uses the
files/httpcats.systemd.service file to allow
systemd to manage our Golang application.