harbor-api

[WIP] Ansible Role: Harbor API Codifying

License:MIT

An Ansible Role to manage Harbor API

Requirements

Have one or more Harbor instances

Installation

Harbor-API is an Ansible role distributed globally using Ansible Galaxy. In order to install Harbor-API role you can use the following command.

$ ansible-galaxy install leboncoin.harbor-api

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

harbor_directory_api: "{{ role_path }}/files/config/"
harbor_directory_api_projects: "{{ role_path }}/files/config/projects/"

Another variables can be used from harbor.cfg, prefixed by harbor_

harbor_auth_mode: ldap_auth
harbor_harbor_admin_password: Harbor12345

Usage

You can create json files to configure your harbor, based on swagger implementation (swagger editor)

Sysadmins

Resources:

  • Put (/users/{user_id}/sysadmin)

admins_removed is required because "harbor api" doesn't implement the research of admin #PR4388

files/config/roles.json

{
    "admins":[
        "[email protected]"
    ],
    "admins_removed":[
        "[email protected]"
    ]
}

Projects

Resources:

  • Add (/projects)
  • Put (/projects/{project_id})

files/config/projects/myproject.json

{
    "name": "myproject",
    "metadatas": {
        "public": false
    },
    "members" [
        [email protected]
    ],
    "admins": [
        [email protected]
    ]
}

Dependencies

None.

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: harbor
  roles:
     - { role: leboncoin.harbor } # install harbor instance
     - { role: leboncoin.harbor-api } # populate api

Contributing

Please, see TODO.md to get ideas to contribute or implement your own things.

License

MIT

Install
ansible-galaxy install leboncoin/ansible-role-harbor-api
GitHub repository
License
mit
Downloads
35
Owner
leboncoin Open Source Projects