There seems to be a lot of info on creating and gathering information about
new ec2 instances, but I haven't found much about getting information about
already created instances.
this is the command I am running:
$ ansible-playbook /etc/ansible/sc-killswitch.yml -e
"windows_server=[instance_private_ip]" --ask-vault-pass
here is my playbook:
---
- hosts: localhost
tasks:
- name: Add windows host to in memory windows group
add_host: name={{ windows_server}} group=windows
- hosts: windows
gather_facts: false
tasks:
- name: create file on d drive of windows server
win_file: path="D:\path\to\myfile.txt" state=touch
The problem with this is that I need to know the private IP of the host I
want to perform the action on. Most of the time we just know the Name tag
(aka hostname). What I'd like to do is this:
$ ansible-playbook /etc/ansible/sc-killswitch.yml -e
"windows_server=[windows_hostname]" --ask-vault-pass
and respective playbook:
---
- hosts: localhost
tasks:
- name: Gather information about the remote windows host based on the
windows_hostname variable
ec2: ?
# tasks to get information about the host based on hostname
register: win_server
- name: Add windows host to in memory windows group
add_host: name={{ win_server.private_ip_address}} group=windows
I've did some poking around in the aws modules, but didn't quite find what
I was looking for. there's the tag_Name_Key convention, but I'm not sure
where I need to put that in order for ansible to gather information about
it and register it as a variable.
Thanks in advance for the help.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/90ab10ed-9128-4f7a-b12f-35173c1eddea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.