This repository has been archived by the owner on Aug 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional support for autogenerated CloudFlare real ip configurati…
…on (#193) * FIX the 'Syntax Error while loading YAML script' error * Add optional support for autogenerated CloudFlare real ip configuration
- Loading branch information
Showing
7 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
- name: Get list of CloudFlare IPv4 | ||
uri: | ||
url: https://www.cloudflare.com/ips-v4 | ||
return_content: yes | ||
register: cloudflare_ipv4_list | ||
tags: [configuration, nginx] | ||
|
||
- name: Get list of CloudFlare IPv6 | ||
uri: | ||
url: https://www.cloudflare.com/ips-v6 | ||
return_content: yes | ||
register: cloudflare_ipv6_list | ||
tags: [configuration, nginx] | ||
|
||
- name: Create independent configuration for CloudFlare | ||
template: | ||
src: config_cloudflare.conf.j2 | ||
dest: "{{ nginx_conf_dir }}/conf.d/{{ nginx_cloudflare_configuration_name }}.conf" | ||
notify: | ||
- reload nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#{{ ansible_managed }} | ||
|
||
{% if cloudflare_ipv4_list is defined %} | ||
{% for cidr in cloudflare_ipv4_list.content.split('\n') %} | ||
{% if cidr %} | ||
set_real_ip_from {{ cidr }}; | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{% if cloudflare_ipv6_list is defined %} | ||
{% for cidr in cloudflare_ipv6_list.content.split('\n') %} | ||
{% if cidr %} | ||
set_real_ip_from {{ cidr }}; | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
|
||
real_ip_header {{ nginx_cloudflare_real_ip_header }}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters