title: How to set FQDN with ansible?
body: <p>It seems the recommended method doesn't work well to me:</p>
  
  <pre><code>- name: Set hostname
    hostname: name=mx.mydomain.net
  </code></pre>
  
  <p>After rebooting, you can see I have problems with fqdn, nothing in <code>/etc/hosts</code>.</p>
  
  <pre><code>root@mx:~# cat /etc/hosts
  127.0.0.1   localhost
  127.0.1.1   mail mail
  
  # The following lines are desirable for IPv6 capable hosts
  ::1     ip6-localhost ip6-loopback
  fe00::0 ip6-localnet
  ff00::0 ip6-mcastprefix
  ff02::1 ip6-allnodes
  ff02::2 ip6-allrouters
  
  root@mx:~# cat /etc/hostname
  mx.mydomain.net
  
  root@mx:~# hostname
  mx.mydomain.net
  
  root@mx:~# hostname -f
  hostname: Name or service not known
  </code></pre>