Ansible core rhel linux - how do I do the equivalent of 'nmcli general hostname' and set the hostname in ansible?

ansible core rhel linux - how do I do the equivalent of ‘nmcli general hostname’ and set the hostname in ansible?

normally when building a server, I update the hostname using the ‘nmcli general hostname’ command.

I can’ t find where to set this using ansible, is it possible, if so how ?

Welcome to the forum, @Nesbit7! Ansible has a builtin hostname module. Does that work for your usecase?

5 Likes

sorry, I was naive in expecting all the nmcli commands to be mapped across directly to ansible nmcli module.

thanks for your excellent suggestion, it works.

thanks,

2 Likes