From 5a016d7de354ba91b4900cd51ac544d9d48031de Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 13 Nov 2022 14:45:33 +0100 Subject: [PATCH] change lineingfile by replace --- tasks/sudoers.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tasks/sudoers.yml b/tasks/sudoers.yml index 98ec62b..47e5524 100644 --- a/tasks/sudoers.yml +++ b/tasks/sudoers.yml @@ -13,3 +13,12 @@ - regexp: '^{{user.name}}\s' line: "{{user.name}} ALL = (ALL) NOPASSWD:ALL" become: True + +- name: change secure path + replace: + path: "/etc/sudoers" + regexp: ^Defaults\s*secure_path.* + replace: Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin + validate: 'visudo -cf "%s"' + become: true +