ansible-role-nginx/tasks/modules/install-geoip.yml
Alessandro Fael Garcia 857ba8c899
Replace with_items with loop (#282)
`loop` is now the recommended way to loop through lists instead of `with_items`
2020-07-08 14:55:15 +02:00

30 lines
884 B
YAML

---
- name: "(Install: CentOS) Install GeoIP Required CentOS Dependencies"
yum:
name:
- epel-release
when: ansible_distribution == "CentOS"
- name: "(Install: All OSs) Install NGINX Open Source GeoIP Module"
package:
name: "nginx-module-geoip{{ nginx_version | default('') }}"
state: present
when: nginx_type == "opensource"
- name: "(Install: All OSs) Install NGINX Plus GeoIP Module"
package:
name: "nginx-plus-module-geoip{{ nginx_version | default('') }}"
state: present
when: nginx_type == "plus"
- name: "(Setup: All NGINX) Load NGINX GeoIP Module"
lineinfile:
path: /etc/nginx/nginx.conf
insertbefore: BOF
line: "{{ item }}"
loop:
- load_module modules/ngx_http_geoip_module.so;
- load_module modules/ngx_stream_geoip_module.so;
when: not nginx_main_template_enable
notify: "(Handler: All OSs) Reload NGINX"