Home infrastructure (Ansible) for Louis's stuff.
Override the following settings in order to utilize the
Ansible Collection and the associated roles, playbooks, etc.. Make sure
to substitute /path/to/HOME
with the actual, specific value for
your environment (generally $HOME/.ansible
).
[defaults]
collections_path = /path/to/HOME/.ansible/collections:./collections:/usr/share/ansible/collections"
This project uses Molecule to perform integration tests against a "staging" virtual machine. This VM is intended to match closely with the production one, and is run locally on my MacBook using VMware Fusion.
To interact with VMware Fusion, this project uses the qsypoq.vmware_desktop Ansible collection as explained in this blog post. The Ansible plugins provided by this project require some configuration, which is provided (thru Molecule) as a series of environment variables in .env.yml. Please initialize the file in the top-level of the repository as follows:
HOMEINFRA_TEST_VMNAME: "<name of the VM>"
HOMEINFRA_TEST_VM_SNAPSHOT_NAME: "<name of the Base OS snapshot>"
HOMEINFRA_TEST_API_USERNAME: "<some username set during vmrest -C>"
HOMEINFRA_TEST_API_PASSWORD: "<some password>"
HOMEINFRA_TEST_API_URL: "http://127.0.0.1"
HOMEINFRA_TEST_API_PORT: "<some port # output by vmrest>"
HOMEINFRA_TEST_SSH_USER: "<username in the guest OS>"
HOMEINFRA_TEST_SSH_IDENTITY_FILE: "<id_rsa on the host; authorized in the guest>"
HOMEINFRA_TEST_BECOME_PASSWORD: "<root's password on the system>"
These variables are best understood by reading through this page,
Use the VMware Fusion REST API Service. This can be
initialized by running vmrest -C
. While running Molecule tests, the
vmrest
program should be running somewhere in the background, and the
URL (particularly the port number) which it displays should be
substituted into the .env.yml
file.
When destroying and recreating the environment, Molecule will call out
to the vmrun
binary to revert to a known-good snapshot. For some
reason, this isn't available via the Rest API. The strategy, then, is to
occasionally update the Base OS snapshot with new OS packages and
nothing more --- let Ansible take care of everything else.