This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
ansible:ansible_playbook_example [2025/01/13 17:04] manu |
ansible:ansible_playbook_example [2025/01/13 17:22] (current) manu [SSH config] |
||
---|---|---|---|
Line 450: | Line 450: | ||
</code> | </code> | ||
+ | ===== SUDO config ===== | ||
+ | |||
+ | <code> | ||
+ | - name: Setup passwordless sudo | ||
+ | lineinfile: | ||
+ | path: /etc/sudoers | ||
+ | state: present | ||
+ | regexp: '^%sudo' | ||
+ | line: '%sudo ALL=(ALL) NOPASSWD: ALL' | ||
+ | validate: '/usr/sbin/visudo -cf %s' | ||
+ | |||
+ | - name: Create a new regular user with sudo privileges | ||
+ | user: | ||
+ | name: "{{ created_username }}" | ||
+ | state: present | ||
+ | groups: sudo | ||
+ | append: true | ||
+ | create_home: true | ||
+ | </code> | ||
https://zakirpcs.medium.com/ssh-hardening-using-ansible-playbook-9717a2e3edfc | https://zakirpcs.medium.com/ssh-hardening-using-ansible-playbook-9717a2e3edfc |