Last active
January 26, 2019 16:37
-
-
Save mageddo/82ac1b80d30a76a7dcaac602258ee21c to your computer and use it in GitHub Desktop.
Run Command on Another Server and register output on variable
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
#!/bin/bash | |
ansible-playbook -i "localhost," -c local playbook.yml |
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
# https://stackoverflow.com/questions/33896847/how-do-i-set-register-a-variable-to-persist-between-plays-in-ansible | |
- hosts: all | |
tasks: | |
- command: /bin/echo "this is a test" | |
delegate_to: localhost | |
register: foo | |
- debug: var=foo | |
- debug: | |
msg: "{{ foo['stdout'] }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment