aboutsummaryrefslogtreecommitdiff
path: root/roles/freeradius/tasks/main.yml
blob: 0144a2595909f1664638e2590dcb8f2442b9ee5f (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
- name: Install packages
  apt:
    name:
      - freeradius
      - freeradius-ldap
  become: yes

- name: Install config
  template:
    src: ldap.j2
    dest: /etc/freeradius/3.0/mods-available/ldap
  become: yes
  notify: freeradius

- name: Install clients
  template:
    src: clients.conf.j2
    dest: /etc/freeradius/3.0/clients.ansible.conf
  become: yes
  notify: freeradius

- name: Clients
  lineinfile:
    path: /etc/freeradius/3.0/radiusd.conf
    search_string: '$INCLUDE clients.ansible.conf'
    line: '$INCLUDE clients.ansible.conf'
    insertafter: '$INCLUDE clients.conf'
  become: yes
  notify: freeradius

- name: Enable LDAP Authentication
  file:
    src: '/etc/freeradius/3.0/mods-available/ldap'
    dest: '/etc/freeradius/3.0/mods-enabled/ldap'
    state: 'link'
  become: yes
  notify: freeradius

- name: Set EAP Certificate
  lineinfile:
    path: /etc/freeradius/3.0/mods-available/eap
    search_string: '{{ item["s"] }}'
    line: '{{ item["l"] }}'
    insertafter: 'tls-config tls-common'
  become: yes
  notify: freeradius
  loop:
    - s: 'private_key_password'
      l: '# private_key_password = notset'
    - s: 'private_key_file ='
      l: 'private_key_file = {{ radius.cert.privkey }}'
    - s: 'certificate_file ='
      l: 'certificate_file = {{ radius.cert.cert }}'
    - s: 'ca_file ='
      l: 'ca_file = {{ radius.cert.ca }}'
    - s: 'check_crl ='
      l: 'check_crl = no'