Code Monkey home page Code Monkey logo

ansible-role-portainer's Introduction

#ansible-role-portainer

Portainer - the coolest UI for Docker http://portainer.io/

This role installs Portainer using Docker container

Tasks in Role

  • Ensure docker-py is present using pip
  • Remove existing container [if remove_existing_container: true]
  • Remove persistent data [if remove_persistent_data: true]
  • Deploy Portainer container to host [define persistent_data_path]
  • Configure Admin user password
  • Generate authentication token
  • Define endpoints [DICT | list]
  • Configure Portainer settings [Jinja2 template]
  • Configure registry [Jinja2 template]

Requirements

  • curl
  • docker (Service + python package)

Role Vars

name description default
configure_settings override default portainer settings with template false
configure_registry configure a docker registry for Portainer to use false
remove_persistent_data remove the persistent data directory on the host false
remove_existing_container remove an existing container named 'portainer' false
persistent_data_path path that will be used to store persistent data /opt/portainer:/data
auth_method use LDAP or standalone [2 for ldap, 1 for standalone]
registry_type 1 (Quay.io), 2 (Azure container registry) or 3 (custom registry)
version portainer version to use at the time of commiting 'develop' is the version that supports LDAP
See main.yml under 'defaults' for a complete list

Running the role

ansible-playbook -i myinventory ./playbooks/deploy-portainer.yml

Playbook example

---

- hosts: myhosts
  become: true
  vars:
    pip_install_packages:
      - name: docker
  vars_files:
    - vars/portainer.yml
  roles:
   - geerlingguy.docker
   - geerlingguy.pip
   - portainer

ansible-role-portainer's People

Contributors

antarktisz11 avatar hagzag avatar laffs2k5 avatar liyaka avatar mrtwnklr avatar rwos avatar slicen avatar somq avatar till avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-portainer's Issues

Configure Registry task fails: Invalid registry type

Type key is missing in registry template

Error with portainer version 1.20.2

fatal: [localhost]: FAILED! => {
    "changed": false,
    "connection": "close",
    "content": "{\"err\":\"Invalid request payload\",\"details\":\"Invalid registry type. Valid values are: 1 (Quay.io), 2 (Azure container registry) or 3 (custom registry)\"}\n",
    "content_length": "152",
    "content_type": "application/json",
    "date": "Thu, 30 May 2019 01:00:22 GMT",
    "elapsed": 0,
    "invocation": {
        "module_args": {
            "attributes": null,
            "backup": null,
            "body": {
                "Authentication": true,
                "Name": "nexus-oss",
                "Password": "password",
                "URL": "1.2.3.4:5001",
                "Username": "username"
            },
...

Note:

This task also fails when a registry with the same name/url already exists instead of skipping gracefuly
"A registry with the same URL already exists"

#Timeout con Configure admin user password

TASK [shelleg.ansible_role_portainer : Configure admin user password] *******************************************************************
fatal: [[email protected]]: FAILED! => {"changed": false, "connection": "close", "content": "{"message":"Administrator initialization timeout","details":"Administrator initialization timeout"}\n", "content_length": "100", "content_type": "application/json", "date": "Mon, 04 Mar 2024 15:57:32 GMT", "elapsed": 0, "json": {"details": "Administrator initialization timeout", "message": "Administrator initialization timeout"}, "msg": "Status code was 303 and not [200, 409]: HTTP Error 303: See Other", "redirect_reason": "AdminInitTimeout", "redirected": false, "status": 303, "url": "http://172.17.0.2:9000/api/users/admin/init"}

target ubuntu 23.10

Thanks
Olindo

Support for docker labels ?

Hi,

It could be useful to be able to set docker labels, for example to be able to set portainer behind traefik reverse proxy, you need to set set some traefik labels to it.

Warn has been removed from Ansible

The warn attribute has been deprecated. Using Ansible 2.15.2 gives the following error while running the role:

TASK [shelleg.ansible_role_portainer : Define Endpoints] *************************************************************************
failed: [portainer-1] (item={'name': 'local', 'url': ''}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "local", "url": ""}, "msg": "Unsupported parameters for (ansible.legacy.command) module: warn. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends."}
failed: [portainer-1] (item={'name': 'remote1', 'url': 'tcp://1.2.3.4:2375'}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "remote1", "url": "tcp://1.2.3.4:2375"}, "msg": "Unsupported parameters for (ansible.legacy.command) module: warn. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends."}
failed: [portainer-1] (item={'name': 'remote2', 'url': 'tcp://5.6.7.8:2375'}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "remote2", "url": "tcp://5.6.7.8:2375"}, "msg": "Unsupported parameters for (ansible.legacy.command) module: warn. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends."}

conflict between docker-py and docker python modules

TASK [shelleg.ansible_role_portainer : Deploy Portainer to remote] ************* fatal: [remote]: FAILED! => {"changed": false, "msg": "Cannot have both the docker-py and docker python modules installed together as they use the same namespace and cause a corrupt installation. Please uninstall both packages, and re-install only the docker-py or docker python module. It is recommended to install the docker module if no support for Python 2.6 is required. Please note that simply uninstalling one of the modules can leave the other module in a broken state."}
Any idea how to solve this ?

How to setup with portainer edge agents

Is there a way to setup portainer in ansible wherein after portainer is setup, it will return the edge id and edge key for it to connect to worker nodes?

problems needed to be fixed

#1:
inventory_hostname not always reachable:
tasks/install.yml myabe replace with ansible_ssh_host or vlan_interface?

#2:
not every system has curl
maybe install curl or create python script?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.