Skip to content

Instantly share code, notes, and snippets.

@rdkls
Created February 20, 2014 01:05
Show Gist options
  • Save rdkls/9104936 to your computer and use it in GitHub Desktop.
Save rdkls/9104936 to your computer and use it in GitHub Desktop.
Ansible tasks to set (aka register) a variable, based on stdout of a shell command
- name: get gridfs host ip from name (required for nginx gridfs module)
shell: 'ping -q -c 1 -t 1 {{ gridfs_host }} | grep PING | sed -e "s/).*//" | sed -e "s/.*(//"'
register: gridfs_ip_command
when: gridfs_ip is not defined
- name: set gridfs ip
set_fact: gridfs_ip={{ gridfs_ip_command.stdout }}
when: gridfs_ip is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment