Toshi,

Thank you for pointing me in the right direction, I was able to move
forward with this, for posterity this is what I ended up with:

- hosts: all
  gather_facts: yes
  become: no

  vars:
    hostname_shortname: "{{inventory_hostname.split('.')[0]}}"
    hostname_mounts: "{{hostname_shortname.replace('-','')}}"

    nodes:
      umsrv10:
        packages: [ drssl, ansible-cmdb ]

  tasks:
    - name: yum - echo __packages
      debug: var="{{item}}"
      with_items: nodes[hostname_mounts]["packages"]

    - name: yum - install main rpms
      yum: name={{item}} state=installed
      with_items:
        - "{{nodes[hostname_mounts]['packages']}}"

root@umsrv10[/etc/ansible/playbooks]# /usr/bin/ansible-playbook -l
`hostname -f` -c local /etc/ansible/playbooks/setfacts3.yml

PLAY [all]
*****************************************************************************************************************************************************************************************************

TASK [Gathering Facts]
*****************************************************************************************************************************************************************************************
ok: [umsrv10.sec.hostopia.com]

TASK [yum - echo __packages]
***********************************************************************************************************************************************************************************
ok: [umsrv10*****] => (item=nodes[hostname_mounts]["packages"]) => {
    "item": "nodes[hostname_mounts][\"packages\"]",
    "nodes[hostname_mounts][\"packages\"]": [
        "drssl",
        "ansible-cmdb"
    ]
}

TASK [yum - install main rpms]
*********************************************************************************************************************************************************************************
ok: [umsrv10.sec.hostopia.com] => (item=[u'drssl', u'ansible-cmdb'])

PLAY RECAP
*****************************************************************************************************************************************************************************************************
umsrv10*****   : ok=3    changed=0    unreachable=0    failed=0

-- 
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/CAODE-g%2BoFYOHUUHtXNQ%3DVhd285B2UN%3DAaR3omrmuXECCzjs1ww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to