Uploading sudoers.d file through ansible gives syntax error but opening and saving in vi fixes it
0
votes
1
answer
1004
views
Alright, I know the question title sucks, but it's the same with the situation itself.
What I am trying to do is this:
1. Create a file with sudoers configuration locally
2. Use Ansible to ubload that file with the template module
3. Use the validate feature of the template module to make sure the configuration works
So far, so good. Now comes the weird part: The validation (
validate: 'visudo -cf %s'
) of that file throws an error. When I comment out the validation line the files gets uploaded, but a manual validation (visudo -cf /etc/sudoers.d/foo_bar
) fails also. Opening the file using vi, saving it (:wq
) without making any changes and running the validation again succeeds.
My current working thesis: WTF?!
But it's late and I am tired. If anyone has suggestions please let me know. I will update this question as soon as I have new information and I will clean it up once I zero in on a solution.
Asked by Thorian93
(772 rep)
Oct 29, 2019, 09:22 PM
Last activity: Oct 29, 2019, 09:53 PM
Last activity: Oct 29, 2019, 09:53 PM