summaryrefslogtreecommitdiffstats
path: root/roles/sudo/tasks/main.yml
blob: 780287e22209d63b0a9ea002cc00aea1418b821a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
#
# This task sets up /etc/sudoers.d/fedora on a machine. 
#

#
# Put in place the default sysadmin-main sudoers file. 
#
- name: setup /etc/sudoers.d/sysadmin-main
  copy: src="{{ private }}/files/sudo/sysadmin-main" dest=/etc/sudoers.d/ owner=root group=root mode=0600
  when: sudoers_main is not defined
  tags:
  - config
  - sudo
  - sudoers
#
# Put in place the default sysadmin-main sudoers file. (nopasswd edition)
#
- name: setup /etc/sudoers.d/sysadmin-main (nopasswd)
  copy: src="{{ private }}/files/sudo/sysadmin-main-nopasswd" dest=/etc/sudoers.d/ owner=root group=root mode=0600
  when: sudoers_main is defined and sudoers_main == 'nopasswd'
  tags:
  - config
  - sudo
  - sudoers
#
# This will move a /etc/sudoers.d/ file in place 
#
- name: setup /etc/sudoers.d/sudoer file for client use
  action: copy src={{ item }} dest=/etc/sudoers.d/{{ item | basename | replace('.', '_') }}
          owner=root group=root mode=0600
  with_first_found:
  - files:
    - "{{ sudoers }}"
    - "{{ private }}/files/sudo/{{ ansible_fqdn }}-sudoers"
    - "{{ private }}/files/sudo/{{ ansible_hostname }}-sudoers"
    - "{{ private }}/files/sudo/{{ ansible_domain }}-sudoers"
    skip: true
  tags:
  - config
  - sudo
  - sudoers