diff --git a/playbooks/roles/vhosts/OpenResty/tasks/geoip.yml b/playbooks/roles/vhosts/OpenResty/tasks/geoip.yml new file mode 100644 index 0000000..2aee0ee --- /dev/null +++ b/playbooks/roles/vhosts/OpenResty/tasks/geoip.yml @@ -0,0 +1,23 @@ +- name: Install GeoIP dependencies + apt: + name: luarocks + state: present + update_cache: true + +- name: Install lua-resty-maxminddb + command: "luarocks install lua-resty-maxminddb" + args: + creates: /usr/local/openresty/site/lualib/resty/maxminddb.lua + +- name: Ensure GeoIP database directory exists + file: + path: /usr/share/GeoIP + state: directory + mode: "0755" + +# yamllint disable rule:line-length +- name: Download V2Fly GeoIP database + get_url: + url: https://github.com/v2fly/geoip/releases/latest/download/geoip.dat + dest: /usr/share/GeoIP/geoip.dat +# yamllint enable rule:line-length diff --git a/playbooks/roles/vhosts/OpenResty/tasks/main.yml b/playbooks/roles/vhosts/OpenResty/tasks/main.yml index 40c6b76..4129686 100644 --- a/playbooks/roles/vhosts/OpenResty/tasks/main.yml +++ b/playbooks/roles/vhosts/OpenResty/tasks/main.yml @@ -28,30 +28,6 @@ state: present update_cache: true -- name: Install GeoIP dependencies - apt: - name: luarocks - state: present - update_cache: true - -- name: Install lua-resty-maxminddb - command: "luarocks install lua-resty-maxminddb" - args: - creates: /usr/local/openresty/site/lualib/resty/maxminddb.lua - -- name: Ensure GeoIP database directory exists - file: - path: /usr/share/GeoIP - state: directory - mode: "0755" - -# yamllint disable rule:line-length -- name: Download V2Fly GeoIP database - get_url: - url: https://github.com/v2fly/geoip/releases/latest/download/geoip.dat - dest: /usr/share/GeoIP/geoip.dat -# yamllint enable rule:line-length - - name: Ensure sites-available directory exists file: path: /usr/local/openresty/nginx/conf/sites-available