3 - name: set hostname in /etc/hostname
4 shell: echo {{ hostname }} > /etc/hostname
6 - name: set hostname in /etc/hosts
9 regexp: '^127\.0\.1\.1.*$'
10 replace: '127.0.1.1 {{ hostname }}'
12 - name: set hostname for current session
13 shell: hostname {{ hostname }}