On 02.06.16 23:04 John.1209 wrote: > I don't know what I need to do to replace the > HOSTNAME=inventory_hostname_short with HOSTNAME=inventory_hostname. I > basically want to replace the HOSTNAME statement with the FQDN.
I would use the lineinfile module. A rough draft (untested) without
correct indentation:
- name: "Ensure FQDN is present"
lineinfile:
dest=/etc/sysconfig/network
line="HOSTNAME=FQDN"
regexp="^HOSTNAME"
insertafter=EOF
state=present
This has to be adapted, of course. Replace FQDN with your real fqdn.
Basically this looks for a line beginning with "HOSTNAME" (the regexp
part) and replaces it with the line "HOSTNAME=FQDN". If there is no
line matching the regexp, it puts the line at the end of the file.
Johannes
--
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/57512ACC.5040403%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature
