Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - name: Load environment variables
- ansible.builtin.set_fact:
- env: "{{ lookup('pipe', 'dotenv -f .env') }}"
- - name: Add user to sudoers
- hosts: all
- gather_facts: yes
- vars:
- username: "{{ env.USERNAME | default('aluno') }}"
- package: "sudo"
- tasks:
- - name: Install Sudo
- package:
- name: "{{ package }}"
- state: present
- - name: Add user to sudoers file
- become: yes
- lineinfile:
- path: /etc/sudoers
- line: "{{ username }} ALL=(ALL) NOPASSWD:ALL"
- state: present
- validate: 'visudo -cf %s'
- #from chatGPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement