I need to copy a configuration file to hosts based on its custom presence in playbook templates folder.
As example :
CONSIDER TO APPLY TO AN INVENTORY
My hostname is HOST001 {{ inventory_hostname }}
if in my playbook tamplates folder there is a file named : configuration–HOST001
then copy module with :
src : “./templates/configuration–{{ inventory_hostname }}”
dst: "/tmp/
if ./templates/configuration–HOST001 does not exists
then copy module with :
src : “./templates/configuration”
dst: "/tmp/
Is there any way to do something like this ?
Please let me know