1. Tests¶
1.1. Debug¶
- debug:
msg: "This always displays"
- debug:
msg: "This only displays with ansible-playbook -vv+"
verbosity: 2
1.2. Smoke Tests¶
You can use
waitfor
moduleYou can use logfile and regexp expressions
- name: check for proper response
uri:
url: http://localhost:8080/
return_content: yes
register: result
until: '"Hello World" in result.content'
retries: 10
delay: 1
1.3. Playbook Syntax¶
yamllint
ansible-playbook --syntax-check
ansible-lint
1.4. Pre-deployment¶
molecule test
(integration)Run entire Playbook on fresh environment
Molecule become de-facto standard
It will be an official Ansible project
1.5. Dry Mode¶
ansible-playbook --check
(against prod)ansible-playbook -C
Run playbook, but do not make modifications
1.6. Deployment¶
Parallel infrastructure
Deploy at small subset of servers first
If deployment succeed, switchover