--- - name: Install shit hosts: ansibletest tasks: - name: Std Repo stuff apt: update_cache: true name: - vim - curl - wget - sudo - name: Add users hosts: ansibletest vars: users: - akis - arya - devrand - midou tasks: - name: Add user ansible.builtin.user: name: "{{ item }}" group: users groups: users,sudo password: $1$cGVmF3CO$CoJyouR8KHiol1xm8zF3l. shell: /bin/bash update_password: on_create with_items: - "{{ users }}" - name: "Add authorized keys" authorized_key: user: "{{ item }}" key: "{{ lookup('file', 'files/'+ item + '.pub') }}" with_items: - "{{ users }}" - name: "Allow admin users to sudo without a password" lineinfile: dest: "/etc/sudoers" # path: in version 2.3 state: "present" regexp: "^%sudo" line: "%sudo ALL=(ALL) NOPASSWD: ALL"