Created
September 14, 2016 21:25
-
-
Save goreilly/9aab2611d07a58f88f787f2984cd594d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
## | |
# Invoke any type of script to modify files. Dry-run friendly usually. | |
# remote_path: Path to file on server. | |
# script: Commands that returns altered content on stdout | |
## | |
- name: get current content | |
always_run: yes | |
register: remote | |
slurp: src={{ remote_path }} | |
- name: modify contents | |
register: modified | |
delegate_to: localhost | |
become: no | |
always_run: yes | |
changed_when: no | |
shell: echo {{ remote.content }} | base64 -D | {{ script }} | |
- name: replace contents | |
copy: | |
content: '{{ modified.stdout }}' | |
dest: '{{ remote_path }}' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment