Portainer Collection

Why:

  • We want to make it easier for developers and engineers to automate the Portainer application

How:

  • By creating an Ansible collection with modules for interacting with Portainer's API
  • So developers can use a clean and simple pattern to describe how they want their Portainer application 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
  • Portainer is a popular, open-source tool that is used to manage Docker containers across multiple hosts
    • It provides a web UI where you can view which hosts are in your "system"
    • From this UI, you can manage any of your hosts - starting and stopping containers

Code: