Run ansible tasks based on machine names in a group

I want to create symlinks for a file using ansible only when I have a certain machine hostname. I know inventory_hostname will give me the hostname, but can I do something like: when: inventory_hostname in group['machines'] so I can run this with all machines in that group? Then, I want to symlink based on name of machine. So:

    src: {{ ansible_hostname }}.png
    dest: anything.png

Read more here:

Content Attribution

This content was originally published by Dorilds at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: