From fd8c325d8e29becfc424a45c3672c2b58d1f48ab Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 15 Jul 2019 18:41:03 +0200 Subject: [PATCH] Simple role that installs freeradius and a list of freeradius modules. The configuration must be part of another role or playbook. --- library/roles/freeradius/defaults/main.yml | 25 +++++++++++++++++++ library/roles/freeradius/meta/main.yml | 5 ++++ library/roles/freeradius/tasks/main.yml | 28 ++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 library/roles/freeradius/defaults/main.yml create mode 100644 library/roles/freeradius/meta/main.yml create mode 100644 library/roles/freeradius/tasks/main.yml diff --git a/library/roles/freeradius/defaults/main.yml b/library/roles/freeradius/defaults/main.yml new file mode 100644 index 0000000..bdd5db7 --- /dev/null +++ b/library/roles/freeradius/defaults/main.yml @@ -0,0 +1,25 @@ +--- +freeradius_install: True +freeradius_pkgs: + - freeradius + - freeradius-config + - freeradius-utils + +freeradius_additional_modules: [] + #- freeradius-dhcp - DHCP module for FreeRADIUS server + #- freeradius-iodbc - iODBC module for FreeRADIUS server + #- freeradius-ldap - LDAP module for FreeRADIUS server + #- freeradius-mysql - MySQL module for FreeRADIUS server + #- freeradius-postgresql - PostgreSQL module for FreeRADIUS server + #- freeradius-redis - Redis module for FreeRADIUS server + #- freeradius-rest - REST module for FreeRADIUS server + #- freeradius-yubikey - Yubikey module for FreeRADIUS server + +freeradius_memcache_module: True +freeradius_local_memcache_support: '{{ freeradius_memcache_module }}' +freeradius_redis_module: False +freeradius_local_redis_support: '{{ freeradius_redis_module }}' + +freeradius_to_be_disabled_modules: [] + +freeradius_enabled_modules: [] diff --git a/library/roles/freeradius/meta/main.yml b/library/roles/freeradius/meta/main.yml new file mode 100644 index 0000000..d052e9f --- /dev/null +++ b/library/roles/freeradius/meta/main.yml @@ -0,0 +1,5 @@ +--- +dependencies: + - { role: '../../library/roles/memcached', when: freeradius_local_memcache_support } + - { role: '../../library/roles/redis', when: freeradius_local_redis_support } + diff --git a/library/roles/freeradius/tasks/main.yml b/library/roles/freeradius/tasks/main.yml new file mode 100644 index 0000000..3fcf639 --- /dev/null +++ b/library/roles/freeradius/tasks/main.yml @@ -0,0 +1,28 @@ +--- +- block: + - name: Install the core freeradius packages + apt: pkg={{ freeradius_pkgs }} state=present cache_valid_time=3600 + + - name: Install the additional freeradius packages + apt: pkg={{ freeradius_additional_modules }} state=present cache_valid_time=3600 + + - name: Install the freeradius memcached module if needed + apt: pkg=freeradius-memcached state=present cache_valid_time=3600 + when: freeradius_memcache_module + + - name: Install the freeradius redis module if needed + apt: pkg=freeradius-redis state=present cache_valid_time=3600 + when: freeradius_redis_module + + tags: freeradius + +- block: + - name: Disable some modules + file: dest=/etc/freeradius/3.0/mods-enabled/{{ item }} state=absent + with_items: '{{ freeradius_to_be_disabled_modules }}' + + - name: Enable some modules + file: src=/etc/freeradius/3.0/mods-available/{{ item }} dest=/etc/freeradius/3.0/mods-enabled/{{ item }} state=link + with_items: '{{ freeradius_enabled_modules }}' + + tags: [ 'freeradius', 'freeradius_modules' ]