Cloudflare Collection

Why:

  • We want to make it easier for developers and engineers to automate the Cloudflare platform

How:

  • By creating an Ansible collection with modules for interacting with Cloudflare's API
  • So developers can use a clean and simple pattern to describe how they want their Cloudflare account to funtion
  • Also, getting the advantages of Ansible's features
    • Logging
    • Idempotence
      • Don't do something unless it needs to be done
    • Declarative syntax
      • Tell me what you want the end results to look like and I'll get you there
    • Check Mode
      • Tell me what you would do without actually doing it ("dry run")

Context:

  • Ansible is a popular, open-source tool that is used to manage hosts, applications, and 3rd party platforms
    • Basically, a way to automate the infrastructure required to run your code
  • Cloudflare is a platform that helps you manage
    • DNS records
      • The service that lets you use a domain name like "my.website.com" to visit a server with an IP address like 111.76.164.3)
    • Reverse Proxies
      • A server that "stands in between" the server that hosts your application
      • Benefits include protecting your server from attacks, providing free and auto-renewable certificates for a securet connection (TLS), and masking or "hiding" the actual IP address used by your server
    • Tunnels
      • Somewhat of an alternative solution to a Reverse Proxy, this technology makes it so your server can still answer requests without it being possible to reach the server directly from the outside internet
      • It does this by using Cloudflare to "answer" requests from outside users while your server reaches out to Cloudflare to get the most recent requests and handle them.
      • A "Don't call us, we'll call you" type of approach

Code: