--- - name: Update sources.list template: src: etc/apt/sources.list dest: /etc/apt/sources.list owner: root group: root mode: 0644 - name: Upgrade packages apt: upgrade: dist update_cache: yes - name: Install packages apt: name: "{{ item }}" loop: - ubuntu-minimal - ifupdown - bridge-utils - bash-completion - net-tools - pciutils - python3-dev - python3-pip - ssh - usbutils - unzip - pkg-config - iotop - re2c - ninja-build - cmake - build-essential - name: Install Ubuntu Server apt: name: ubuntu-server install_recommends: no - name: Generate locales locale_gen: name: en_US.UTF-8 state: present - name: Enable services shell: systemctl enable {{ item }} loop: - ssh - systemd-networkd - systemd-resolved - name: Create network conf template: src: etc/netplan/netcfg.yaml dest: /etc/netplan/netcfg.yaml owner: root group: root mode: 0644 - name: Create new user user: name: "{{ user.name }}" shell: "{{ user.shell }}" password: "{{ user.password | password_hash('sha512') }}" create_home: yes groups: sudo,sys,video,uucp,lp,input,audio,plugdev state: present - name: Ensure default multi-user target shell: systemctl set-default multi-user.target