this is my host file.
cat /tmp/node/test.new
[masters]
1234.abc.com
[nodes]
453.abc.com openshift_node_labels,22,=“{‘region’: ‘us_midwest’, ‘datacenter’: ‘ctc’, ‘zone’: ‘core’, ‘environment’: ‘nonprod’, ‘logging-infra-fluentd’: ‘true’}”
678abc.com openshift_node_labels,22,=“{‘region’: ‘us_midwest’, ‘datacenter’: ‘ctc’, ‘zone’: ‘core’, ‘environment’: ‘nonprod’, ‘logging-infra-fluentd’: ‘true’}”
'^{{ ansible_hostname }}$' matches a line containing only the name of
the node currently running the task.
If you want to delete a line starting with the name of the node you'll
need '^{{ ansible_hostname }}', without the $ which means line end.
If you are getting an error, providing the error message would help ...
Regards
it is working now,
with below syntax.
lineinfile: dest=/tmp/node/test.new
regexp=‘^{{ansible_hostname}}’
state=absent
delegate_to: “{{ groups[‘masters’][0] }}”
changed_when: False