On 12.03.19 20:00, Deepak Sharma wrote:
> 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'}"
> #
> 
> and i want to delete 453.abc.com whole line from /tmp/node/test.new
> 
> with below syntax but getting error, can some one help me
> 
> 
> lineinfile: dest=/tmp/node/test.new
>               regexp='^{{ansible_hostname}}$'
>               state=absent
> 

'^{{ 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
-- 
Sebastian Meyer
Linux Consultant & Trainer
Mail: [email protected]

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

-- 
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/084012ec-1ac5-6daf-0377-65ee438f2f25%40b1-systems.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to