https://github.com/mattmakai/ansible-twilio-example
An example Ansible playbook that shows usage for the Twilio notifications module
https://github.com/mattmakai/ansible-twilio-example
Last synced: 9 months ago
JSON representation
An example Ansible playbook that shows usage for the Twilio notifications module
- Host: GitHub
- URL: https://github.com/mattmakai/ansible-twilio-example
- Owner: mattmakai
- Created: 2014-03-24T16:59:23.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-16T13:43:50.000Z (over 11 years ago)
- Last Synced: 2025-02-13T13:16:05.748Z (10 months ago)
- Homepage: http://docs.ansible.com/twilio_module.html
- Size: 199 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ansible Twilio example
This project is an example for how to use the Twilio module in
Ansible core notifications package which is part of the Ansible 1.6+ release.
## Walkthrough
Check the tags
[example-step-1](https://github.com/makaimc/ansible-twilio-example/tree/example-step-1),
[example-step-2](https://github.com/makaimc/ansible-twilio-example/tree/example-step-2) and
[example-step-3](https://github.com/makaimc/ansible-twilio-example/tree/example-step-3)
to see each progressive addition to the playbook.
Copy set\_envs.sh.template to set\envs.sh and fill in your environment variables. Note this file
changes between example-step-1 and example-step-2 tags with new Twilio environment variables.
### Step 1: Playbook with get\_url module
Step 1 is a playbook that uses the get\_url module to download a remote file
and save it to the local node. We'll use this tag as a base for adding the
Twilio module in step 2 for notifications.
### Step 2: Add Twilio module for notifications
In step 2 we add the Twilio module to notify us in case our download does
not work properly. We'll simulate this by "fat-fingering" the site\_tarball
URL variable in the group\_vars/all file to have an extra character. That
will cause GitHub to return an HTTP 404 status code which will indicate
to Ansible that the download failed.
*Note*: if you run this step when the download file already exists on the
node from a previous playbook exection then Ansible will assume the get\_url
step was successful. To simulate the failure, make sure to delete the file
before a new playbook execution.
### Step 3: Fix errors, now Twilio module is bypassed
In step 3 we just fix the site\_tarball URL and we see that when the download
is successful the error notification does not send a message because
that step is skipped.