run:
  - file:
      path: /etc/nginx/conf.d/outlets/server/real-ip-header.conf
      chmod: 644
      contents: |
        real_ip_header cf-connecting-ip;
  - exec:
      cmd:
        # avoid the trap of specifying both URLs on one curl line; the data might not have a final newline
        # print sprintf looks dubious at first, but avoids the problem of "how many times do you backslash a \\\\n"
        - curl -s https://www.cloudflare.com/ips-v4/ | awk '{print sprintf("set_real_ip_from %s;", $0)}' > /etc/nginx/conf.d/outlets/server/real-ip-cloudflare.conf
        - curl -s https://www.cloudflare.com/ips-v6/ | awk '{print sprintf("set_real_ip_from %s;", $0)}' >> /etc/nginx/conf.d/outlets/server/real-ip-cloudflare.conf
