This is also possible
vars:
file_name_mapping:
amazon: "sudoers.general"
debian: "sudoers.debian"
tasks:
- debug:
msg: "{{ file_name_mapping[ansible_distribution] |
default('sudoers.general')}}"
On Fri, Jul 10, 2020 at 4:13 PM Abhijeet Kasurde
wrote:
> Do as the following, which will make playb
Do as the following, which will make playbook readable
file_name: sudoers.general
tasks:
- name: Set file name when Amazon
set_fact:
file_name: "sudoers.aspera"
when: ansible_distribution == 'amazon'
- name: Set file name when Debian
set_fact:
file_name: "sudoers.debian"
when: ansible_distributio
Hi Team,
I need a playbook to update the sudoer file based on os distribution. I
have written below code but it is failing.
- name: Copy sudoers files
copy:
src: files/{{ file_name }}
dest: /etc/sudoers
validate: /usr/sbin/visudo -csf %s
{% if ansible_distri