Created
April 29, 2019 21:43
-
-
Save saml/0fb62228c3bd767db25d73e2b1b897ad to your computer and use it in GitHub Desktop.
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
nginx: | |
pkg: | |
- installed | |
service.running: | |
- watch: | |
- file: /etc/nginx/nginx.conf | |
- cmd: /etc/nginx/cloudfront.conf | |
/etc/aws/ip-ranges.json: | |
file.managed: | |
- source: https://ip-ranges.amazonaws.com/ip-ranges.json | |
- source_hash: sha256 | |
/etc/nginx/cloudfront.conf: | |
cmd.run: | |
- name: jq -r '"set_real_ip_from " + (.prefixes[] | select(.service=="CLOUDFRONT") | .ip_prefix) + ";"' /etc/aws/ip-ranges.json > /etc/nginx/cloudfront.conf | |
- onchanges: | |
- file: /etc/aws/ip-ranges.json | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this will work perfect if you can actually provide the
source_hash
(and you're OK with the state failing when it updates)