File: main.yml

package info (click to toggle)
python-mitogen 0.3.44-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,824 kB
  • sloc: python: 24,965; sh: 144; makefile: 74; perl: 19; ansic: 18
file content (42 lines) | stat: -rw-r--r-- 1,193 bytes parent folder | download
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
- name: Ensure correct sudo group exists
  group:
    name: "{{ sudo_group[ansible_distribution] }}"

- name: Sanitize /etc/sudoers.d
  file:
    path: "{{ item.path }}"
    mode: "{{ item.mode | default(omit) }}"
    state: "{{ item.state }}"
  with_items:
    - {path: /etc/sudoers.d, state: directory, mode: u=rwx,go=}
    - {path: /etc/sudoers.d/README, state: absent}

- name: Allow wheel members to sudo
  lineinfile:
    path: /etc/sudoers
    regexp: '#* *%wheel +ALL=\((?:ALL:ALL|ALL)\) +ALL'
    line: "%wheel ALL=(ALL) ALL"
    validate: '/usr/sbin/visudo -cf %s'
  when:
    - ansible_os_family in ['RedHat']

- name: Configure sudoers
  copy:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: ug=r,o=
    validate: '/usr/sbin/visudo -cf %s'
  with_items:
    - {src: defaults, dest: /etc/sudoers.d/mitogen_test_defaults}
    - {src: users, dest: /etc/sudoers.d/mitogen_test_users}

- name: Configure local sudoers
  template:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: ug=r,o=
    validate: '/usr/sbin/visudo -cf %s'
  with_items:
    - {src: local_user, dest: /etc/sudoers.d/mitogen_test_local_user}
  when:
    - ansible_connection == "local"