trying to replace a word in file. I have a testfile1.conf:
-------------------------------------------
this is a test file
this server name is placeholder
-------------------------------------------
I have an inventory file (and a hosts file, still trying to figure those out):
[servers]
server01 ansible_ssh_host=192.168.6.131
server02 ansible_ssh_host=192.168.6.139
server03 ansible_ssh_host=192.168.6.140
and my playbook:
---
- name: read IP from hosts match w var replace with vars
hosts: servers
tasks:
- name: replace placeholder
replace:
dest=/vartest/testfile1.conf
regexp='placeholder'
replace={{ inventory_hostname }}
backup=no
When I run the playbook, I get no errors, but instead of putting in the server name (server01, server02, or server03) it puts in the IP address of the target machine.
What am I missing?
regards, Richard