Skip to content

Instantly share code, notes, and snippets.

@mrwilson
Last active August 29, 2015 14:07
Show Gist options
  • Save mrwilson/27bfe23281d1d7eec025 to your computer and use it in GitHub Desktop.
Save mrwilson/27bfe23281d1d7eec025 to your computer and use it in GitHub Desktop.
Executable ansible manifests
#!/usr/bin/env ansible-playbook
- hosts: blog
sudo: yes
gather_facts: false
tasks:
- name: Copy blog across
synchronize: src=./blog dest=/var/www/blog
notify:
- Restart nginx
handlers:
- name: Restart nginx
service: name=nginx state=restarted
$ ./example.yml
PLAY [blog] *******************************************************************
TASK: [Copy blog across] ******************************************************
changed: [example.probablyfine.co.uk]
NOTIFIED: [Restart nginx] *****************************************************
changed: [example.probablyfine.co.uk]
PLAY RECAP ********************************************************************
example.probablyfine.co.uk : ok=2 changed=2 unreachable=0 failed=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment