diff --git a/create_user_cody.yaml b/create_user_cody.yaml new file mode 100644 index 0000000..e833682 --- /dev/null +++ b/create_user_cody.yaml @@ -0,0 +1,22 @@ +--- +- name: Create user 'cody' with sudo permissions + hosts: all + become: true + vars: + user_name: "cody" + user_password: "temppass1" + tasks: + - name: Create user 'cody' + user: + name: "{{ user_name }}" + password: "{{ user_password | password_hash('sha512') }}" + shell: /bin/bash + createhome: yes + + - name: Add 'cody' to sudo group + lineinfile: + path: /etc/sudoers + line: "{{ user_name }} ALL=(ALL) ALL" + validate: 'visudo -cf %s' + state: present + backup: yes \ No newline at end of file