Skip to content
Snippets Groups Projects
Commit 0b9baa20 authored by Simone Spinelli's avatar Simone Spinelli
Browse files

Add sudo checks and new users variable

parent 9d62bddf
No related branches found
No related tags found
No related merge requests found
- name: Make sure sudoers are paswordless
community.general.sudoers:
name: sudo4gap
group: sudo
commands: ALL
state: present
- name: Add a new Linux user - name: Add a new Linux user
ansible.builtin.user: ansible.builtin.user:
name: "{{ username }}" name: "{{ item.username }}"
comment: "{{ full_name }}" comment: "{{ item.full_name }}"
groups: sudo groups: sudo
append: yes append: yes
password: '!' # Do not allow login with a password password: '!' # Do not allow login with a password
password_lock: yes # Login with SSH key only password_lock: yes # Login with SSH key only
shell: "{{ item.shell }}"
register: user_output register: user_output
with_items: "{{goat_users}}"
- name: Add SSH key to user for logging in - name: Add SSH key to user for logging in
ansible.posix.authorized_key: ansible.posix.authorized_key:
user: "{{ username }}" user: "{{ item.username }}"
key: "{{ ssh_key }}" key: "{{ item.ssh_key }}"
with_items: "{{goat_users}}"
- name: Create new VM for development - name: Create new VM for development
ansible.builtin.debug: ansible.builtin.debug:
......
goat_users:
- username: simone
full_name: "Simone Spinelli"
shell: "/bin/bash"
ssh_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDt0UfEy8Tz4lrrXvLqcmDcVB/uxGot3upZUOUtUFif6dBiGdasxvi7OaHoOh1Ho6SHGF57tXFYXzIR0VIXdFs0zG62FGESXLOzpGgoB/bWcRDoipcoM0rnMKNuL+SOFjGQ0XLQu4/I6UHd6pJ+JW2V6gx0KcbiHt5ogHiFeeDyC+p/+eSyP0kXVnP7ewU/A/0cTBhAEvNstPrWdKj4C9LadBq8ZC9JheuEBpJvG+EwEXTFfRwL3JsG1Gwvyhg2fmlqiqsiM70XB1v8CLOp/gGcv0ug1oAOl1XKEEYqE2z/GWvykX8DDyMF3C8JSdyX3oOANwYHQ46XuENZqKc4DvWt simonespinelli@GA0050"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment