Ansible Quickies – Useful Code Snippets

Ansible Quickies – Useful Code Snippets

Delete a remote folders and files in Ansible

 

Sync files from a directory inside of another directory in Ansible

 

Execute bash code with Ansible. It gets executed with /bin/sh for you

 

Add a cron job if it doesn’t exist with Ansible

 

Create a folder if it doesn’t exist with Ansible

 

Copy a local file to the server with Ansible

 

Download a file from a remote server with Ansible

 

Install Ubuntu packages with Ansible

 

Restart server service with Ansible

 

Execute different actions if there was an error