Skip to content

Instantly share code, notes, and snippets.

@juliedavila
Created October 10, 2018 13:31
Show Gist options
  • Select an option

  • Save juliedavila/54d04358222a9c3486f1d2f400878567 to your computer and use it in GitHub Desktop.

Select an option

Save juliedavila/54d04358222a9c3486f1d2f400878567 to your computer and use it in GitHub Desktop.
Example Provision & Target
- hosts: localhost
connection: local
tasks:
- name: provision some shit
whatever_module:
...args
register: new_hosts
- name: add hosts to in-memory inventory
add_host:
## you can literally add any var value here and it will get translated as a host var
hostname: "{{ new_hosts['something_resolvable'] }}"
ansible_port: "{{ whatever_port }}"
groups:
- new_hosts
- hosts: new_hosts
tasks:
...do stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment