I'm looking for an idea to spill the hostname infromation geting from facts 
and run the command if the matches the hostname provided in inventory.
Saying that "myhostname" value should be picked & matched from inventory 
ones and get the IP of the hostname once matched to complete the command 
My Host inventory:


somecommand hostinfo=myhostname:IP_ADDRESS <CMD_ARGS>
somecommand hostinfo=test-host1:xx.xx.xx.xx CIC01


somecommand = Static Value
hostinfo = Static Value
myhostname = Should be the same as taken from inventory
IP_ADDRESS = Should be the IP of Hostname taken from invetory
CMD_ARGS = Static Value ( like i mentioned CIC01)

- name: Ansible to get the resolv.conf output
  hosts: all
  remote_user: root
  gather_facts: True
  - name: runing re-image
    shell: somecommand hostinfo=test-host1:xx.xx.xx.xx CIC01
    register: named

  - name: Storing the remote Hosts Output locally 
    lineinfile: create=yes dest=/opt/out.logs  line="{{ named.stdout }}"

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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to