ansible-ffrgb/roles/speedtest/tasks/main.yml

48 lines
1.4 KiB
YAML
Raw Normal View History

---
- name: Install packages
apt:
name:
- docker.io
- docker-compose
- name: Create speedtest group
group: name=speedtest
- name: Create speedtest user
user:
name: speedtest
home: /opt/speedtest
shell: /bin/bash
group: speedtest
groups: docker
- name: Configure speedtest container
template: src=docker-compose.yml.j2 dest=/opt/speedtest/docker-compose.yml
notify: Restart speedtest
- name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ speedtest_domain }}.key -out /etc/nginx/ssl/{{ speedtest_domain }}.crt -days 730 -subj "/CN={{ speedtest_domain }}" creates=/etc/nginx/ssl/{{ speedtest_domain }}.crt
notify: Restart nginx
- name: Configure certificate manager for speedtest
template: src=certs.j2 dest=/etc/acertmgr/{{ speedtest_domain }}.conf
notify: Run acertmgr
- name: Configure vhost
template: src=vhost.j2 dest=/etc/nginx/sites-available/speedtest
notify: Restart nginx
- name: Enable vhost
file: src=/etc/nginx/sites-available/speedtest dest=/etc/nginx/sites-enabled/speedtest state=link
notify: Restart nginx
- name: Systemd unit for speedtest
template: src=speedtest.service.j2 dest=/etc/systemd/system/speedtest.service
notify:
- Reload systemd
- Restart speedtest
- name: Start the speedtest service
service: name=speedtest state=started enabled=yes