Open francsw opened 3 years ago
---
- hosts: test
gather_facts: yes
become: yes
tasks:
- name: Create sudoers template
template:
src: hardened.j2
dest: /etc/sudoers.d/hardened.out
validate: /usr/sbin/visudo -cf %s
%sysops {{ ansible_default_ipv4.address }} = (ALL) ALL
Host_Alias WEBSERVERS = {{ groups['WEBSERVERS'] | join(" ,") }}
Host_Alias DBSERVERS = {{ groups['DBSERVERS'] | join(" ,") }}
%httpd WEBSERVERS = /bin/su - webuser
%dba DBSERVERS = /bin/su - dbuser
{% ... %} for Statements
{{ ... }} for Expressions to print to the template output
{# ... #} for Comments not included in the template output
# ... ## for Line Statements