Notes to self...
- Including Ansible variables from the python test file won't interpolate variables that are defined in the same file.
For example, this won't work:
wp_deploy_dir: "/root/wordpress" wp_install_dir: "{{ wp_deploy_dir }}/wordpress/web"
While this does work:
wp_deploy_dir: "/root/wordpress" wp_install_dir: "/root/wordpress/web"
ansible_env
doesn't change withbecome
. However, the resulting shell environment variables do change, such as$HOME
.- For faster development, it's possible to skip the
dependency
phase inconverge
by setting customconverge_sequence
inmolecule.yml
. - It's possible to debug the tests by:
- Run
molecule --debug verify
to get the exactpytest
command that was run and the value forMOLECULE_INVENTORY_FILE
. - Go into the scenario directory.
- Run the pytest command that you got from step 1, but preface it with a statement that sets
MOLECULE_INVENTORY_FILE
.
- Run
- TravisCI has multiple time limits:
- Overall build time limit (50 minutes for public repos).
- Timeout due to no output.
- Molecule docker containers on MacOS are created with the default docker setup. With Docker Desktop for Mac, this means that Docker—and therefore the molecule container—are running inside a
hyperkit
virtual machine.- To "log in" to the VM running the container, use the
screen
command to attach to an existing terminal session inside the machine:$ screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
- To "log in" to the VM running the container, use the
host.run()
actually runs commands with the Ansiblecommand
module. Variable interpolation does happen at this point, but the variables must be in the global Ansible runner namespace.