- hosts: image tasks: - shell: | echo "{{ host }}" > /etc/hostname sed -i '/^127\.0\.0.*localhost.*/s/.*/127.0.0.1 localhost {{ host }}/' \ /etc/hosts sed -i '/^root:[^:]:/s//root::/' /etc/passwd - copy: content: | auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp dest: /etc/network/interfaces - apt: name: - build-essential - user: comment: "Worker" name: worker shell: /bin/bash - file: state: directory path: /home/worker/.ssh owner: worker group: worker mode: 0700 - copy: src: manager.key.pub dest: /home/worker/.ssh/authorized_keys owner: worker group: worker mode: 0600 - copy: content: | worker ALL=(ALL:ALL) NOPASSWD: ALL dest: /etc/sudoers.d/worker owner: root group: root mode: 0600 vars: host: worker ansible_python_interpreter: /usr/bin/python3