ansible/roles/radius/tasks/main.yml

81 lines
2 KiB
YAML
Raw Normal View History

2020-05-16 21:43:23 +02:00
- name: Add backports repositories
apt_repository:
repo: "{{ item }} http://deb.debian.org/debian buster-backports main contrib non-free"
loop:
- "deb"
- "deb-src"
- name: Ensure /var/www exists
file:
name: "/var/www"
state: directory
- name: Clone re2o repo
git:
repo: "https://gitlab.federez.net/re2o/re2o.git"
dest: "/var/www/re2o"
version: "master_freeradius_python3"
force: true
- name: Template local settings
template:
src: settings_local.py.j2
dest: "/var/www/re2o/re2o/settings_local.py"
# What follows is a hideous abomination.
# Blame freeradius-python3 on backports.
- name: try to install freeradius-python3 (this will fail on post-install)
apt:
name: freeradius-python3
ignore_errors: yes
no_log: yes
- name: fix freeradius-python3 postinstall script
template:
src: freeradius-python3.postinst.j2
dest: /var/lib/dpkg/info/freeradius-python3.postinst
- name: Setup radius symlinks
file:
src: "/var/www/re2o/freeradius_utils/{{ item.local_prefix }}{{ item.filename }}"
dest: "/etc/freeradius/3.0/{{ item.filename }}"
state: link
force: yes
loop:
- local_prefix: ""
filename: auth.py
- local_prefix: freeradius3/
filename: radiusd.conf
- local_prefix: freeradius3/
filename: mods-enabled/python
- local_prefix: freeradius3/
filename: mods-enabled/eap
- name: Configure radius clients.conf
template:
src: "{{ item }}.j2"
dest: "/etc/freeradius/3.0/{{ item }}"
loop:
- clients.conf
- sites-enabled/default
- sites-enabled/inner-tunnel
- name: reinstall broken backpage
apt:
name: freeradius-python3
force: yes
- name: Install radius requirements (except freeradius-python3)
shell:
cmd: "{{ item }}"
chdir: /var/www/re2o/
loop:
- "cat apt_requirements_radius.txt | grep -v freeradius-python3 | xargs apt-get -y install"
- "pip3 install -r pip_requirements.txt"
# End of hideousness (hopefully).