使用Ansible自动化部署FreeRadius+DaloRadius+PHP
---
- hosts: servers
become: yes
tasks:
- name: 安装依赖包
apt:
name: "{{ item }}"
state: present
update_cache: yes
with_items:
- build-essential
- libpcre3-dev
- libssl-dev
- zlib1g-dev
- libreadline-dev
- libyaml-dev
- libsqlite3-dev
- sqlite3
- libxml2-dev
- libxslt1-dev
- libcurl4-openssl-dev
- software-properties-common
- libmysqlclient-dev
- zlib1g-dev
- libpcre3-dev
- libssl-dev
- libapr1-dev
- libapr-util1-dev
- name: 安装FreeRADIUS
shell: |
wget https://github.com/FreeRADIUS/freeradius/releases/download/v{{ freeradius_version }}/freeradius-{{ freeradius_version }}.tar.gz
tar xzf freeradius-{{ freeradius_version }}.tar.gz
cd freeradius-{{ freeradius_version }}
./configure {{ freeradius_configure_flags }}
make
make install
ldconfig
cd ..
rm -rf freeradius-{{ freeradius_version }}*
vars:
freeradius_version: 3.0.13
freeradius_configure_flags: "--with-openssl"
- name: 安装DaloRADIUS
shell: |
wget https://github.com/lirantal/daloradius/archive/v{{ daloradius_version }}.zip -O daloradius.zip
unzip daloradius.zip
mv daloradius-{{ daloradius_version }} daloradius
cd daloradius
{{ php_discover_abspath }}
{{ phpdismod_cli }}
{{ docker_compose_install }}
{{ docker_compose_build }}
{{ docker_compose_up }}
cd ..
rm -rf daloradius*
vars:
daloradius_version: 5.1.0
php_discover_abspath: "phpdiscover --abspath"
phpdismod_cli: "phpdismod -s cli mysql mysqli pdo_mysql mbstring"
docker_compose_install: "curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose"
docker_compose_build: "docker-compose build"
docker_compose_up: "docker-compose up -d"
- name: 配置FreeRADIUS
copy:
src: etc/raddb/radiusd.conf
dest: /etc/raddb/radiusd.conf
owner: freeradius
group: freeradius
评论已关闭