Supported Versionsenv zero supports all standard Ansible versions from
3.0.0 and above.Environment Deployment
In order to manage your Ansible runs in env zero, you must follow these steps:- Create an Ansible Template first
- Optionally - Create
env0.ymlfile in the target repository to run any custom command (ansible or otherwise). This is also needed to run commands during the destroy process - Connect your cloud account
- Create an environment
Execution Steps
Beyond the common steps such as Clone, Loading variables, Deploy/Destroy, etc., Ansible environments offers the following execution steps:- Ansible Galaxy -
ansible-galaxy install -r requirements.yml - Ansible Check Playbook -
ansible-playbook --check --diff
- Ansible Playbook -
ansible-playbook
Additional Controls
Setting a custom Playbook file
By default, env zero will run theansible-playbook commands with playbook.yml or playbook.yaml (whichever is present).
If you want to set a custom playbook file name, you can set the ENV0_ANSIBLE_PLAYBOOK variable with whichever value you desire.
Setting custom flags
To set anyansible-playbook flag, you can set an ANSIBLE_CLI_flagName environment variable.
The flagName is always preceded by a --, like so:
--flagName
If a value is set to the variable, it will be appended to the flag with a space after the flag name, like so:
--flagName value
For example:
ANSIBLE_CLI_becomewould add the--becomeflag.ANSIBLE_CLI_inventory, and setting its value tohostswould add the--inventory hostsflag.
Setting extra variables
To set any extra variable foransible-playbook, you can set an ANSIBLE_VAR_varName variable.Any variable you add here will be parsed and added to the
--extra-vars flag.
For example, setting a ANSIBLE_VAR_myVar with a value my-value, would add the --extra-vars 'myVar="my-value"' flag.
Multiple variables are supported, so setting ANSIBLE_VAR_firstVar=value-one and ANSIBLE_VAR_secondVar=value-two, would add --extra-vars 'firstVar="value-one" secondVar="value-two"'.
Skipping Ansible Check Step
In some cases, Ansible checks might fail but for a good reason, and in those cases you might want to skip those checks during the deployment. For this use case, you can set an environment variable namedENV0_SKIP_ANSIBLE_CHECK and set the value to be true - This will cause the deployment to skip that step and mark the step as Skipped and continue to the next steps in the deployment flow.
Using the Lean Docker Image with AnsibleIf you wish to use our lean docker image along with Ansible, make sure Python is installed