--- - name: "[Alpine] Install package: sudo" apk: name: sudo state: present update_cache: yes when: - ansible_distribution == "Alpine" - system.enableSudo is true - name: "[Archlinux] Install package: sudo" pacman: name: sudo state: present update_cache: yes when: - ansible_distribution == "Archlinux" - system.enableSudo is true - name: "Patch file: /etc/sudoers" patch: src: sudoers.patch dest: /etc/sudoers when: system.enableSudo is true - name: "[Alpine] Remove package: sudo" apk: name: sudo state: absent when: - ansible_distribution == "Alpine" - system.enableSudo is false - name: "[Archlinux] Remove package: sudo" pacman: name: sudo state: absent when: - ansible_distribution == "Archlinux" - system.enableSudo is false - name: "Remove file: /etc/sudoers" file: path: /etc/sudoers mode: absent when: system.enableSudo is false