mirror of https://github.com/Aidaho12/haproxy-wi
41 lines
971 B
YAML
41 lines
971 B
YAML
- hosts: all
|
|
become: yes
|
|
become_method: sudo
|
|
tasks:
|
|
- name: Creates directory
|
|
file:
|
|
path: "{{service_dir}}/geoip"
|
|
state: directory
|
|
|
|
- name: Creates directory
|
|
file:
|
|
path: "{{service_dir}}/scripts"
|
|
state: directory
|
|
|
|
- name: Install wget
|
|
package:
|
|
name: "{{ item }}"
|
|
state: present
|
|
environment:
|
|
http_proxy: "{{PROXY}}"
|
|
https_proxy: "{{PROXY}}"
|
|
with_items:
|
|
- wget
|
|
- unzip
|
|
|
|
- name: Copy GeoIP script in place.
|
|
template:
|
|
src: /var/www/haproxy-wi/app/scripts/ansible/roles/geoip.sh.j2
|
|
dest: "{{service_dir}}/scripts/geoip.sh"
|
|
mode: 0777
|
|
|
|
- name: Execute the script
|
|
command: "{{service_dir}}/scripts/geoip.sh"
|
|
|
|
- name: Update geoip every Wednesday
|
|
cron:
|
|
name: "Update HAProxy geoip"
|
|
minute: "0"
|
|
hour: "01"
|
|
weekday: "3"
|
|
job: "{{service_dir}}/scripts/geoip.sh" |