No description
Find a file
2023-10-24 06:47:29 +00:00
defaults update docs, update for new shared tasks, cleanup, etc 2023-10-08 20:38:36 +00:00
tasks cleanup task formatting 2023-10-24 06:47:29 +00:00
.gitignore initial commit for portainer role 2022-10-29 06:39:40 +00:00
README.md update docs, update for new shared tasks, cleanup, etc 2023-10-08 20:38:36 +00:00

ansible-roles-portainer

This role is designed to deploy portainer either as a standalone service or in conjunction with an existing pod

Task Configuration

Define portainer_url, this will useful in conjunction with a proxy role such as traefik or nginx

Define portainer_path if the container user has a custom homedir such as something under /srv..

- name: Setup proxy and service
  hosts: somehost
  become: true
  roles:
    - role: portainer
      uptime_url: portainer.somehost.somewhere
    - role: traefik
      traefik_routes:
        - name: uptime
          host: "{{ portainer_url }}"
          srv: "{{ traefik_host_address }}:9000"
    - role: firewalld
      firewalld_add:
        - name: public
          services:
            - http
            - https
          forwards:
            - port: 80
              to: 8080
            - port: 443
              to: 8443

To monitor pods controlled by other users define

portainer_external_pods:
  - name: metrics
    uid: 20001
  - name: netbox
    uid: 20002

Deployment and Removal

Sometimes you need to manually stop the running containers to get a clean run when redeploying

systemctl --user stop container-portainer.service

When deploying pr removing in conjunction with other podman based roles, run each deployment separately. Currently shared logic surrounding the control of user scope systemd will conflict when multiple podman users are executing tasks within the same ansible context.

ansible-playbook -i hosts site.yml --tags=firewalld,traefik --limit=somehost
ansible-playbook -i hosts site.yml --tags=portainer --limit=somehost

Deploy

ansible-playbook -i hosts site.yml --tags=firewalld,traefik --limit=somehost
ansible-playbook -i hosts site.yml --tags=portainer --limit=somehost

Remove

ansible-playbook -i hosts site.yml --tags=firewalld,traefik --extra-vars "container_state=absent firewall_action=remove" --limit=somehost
ansible-playbook -i hosts site.yml --tags=portainer --extra-vars "container_state=absent" --limit=somehost