Skip to main content

Package

The kollection package of the kupboard uses Ansible Playbook. Ansible is a greate open source tool and is already used widely for a variety of purposes in many solutions. There are many good written playbooks on the Internet. You can use those playbooks very easily and quickly by defining only the action in the config. In the kupboard, we tried to avoid the functional limitations of creating a package's playbook. Users can also use playbooks and actions to create their own great kollections.

mykollection
โ””โ”€โ”€ packages
โ”œโ”€โ”€ package1
โ”‚ย ย  โ””โ”€โ”€ playbook.yaml
โ””โ”€โ”€ package2
โ”œโ”€โ”€ data
โ””โ”€โ”€ playbook.yaml

This is an example to run a kollection command. The -c <kollection-name> option allow you to use packages in a specific kollection.

$ kupboard kollection package -n <package-name> [-a <action-name>]

kupboard-kollection-nginx#

Let's check an example kupboard-kollection-nginx.

In config.yaml a pakcage named nginx is defined and there are two actions, deploy and delete. Only one playbook named nginx.yaml is used and the variable target_group can be used in the playbook. And the variable state is used when actions are excuted, and its value can be started and absent.

version: 1.0
metadata:
name: Nginx
packages:
- name: nginx
playbook: nginx/nginx.yaml
vars:
target_group: gateway
actions:
- name: deploy
default: true
vars:
state: started
params:
- name: delete
vars:
state: absent
params:

The Nginx package uses the 'nginx:1.19.10' container. It uses target_group and state defined in the config, and the state value is used for container deployment.

- name: Nginx Package
hosts: "{{ target_group }}"
become: no
vars:
release_state: "{{ state | default('started') }}"
tasks:
- name: "{% if release_state == 'started' %} Deploy Nginx {% else %} Remove Nginx {% endif %}"
docker_container:
name: nginx
image: nginx:1.19.10
state: "{{ release_state }}"
restart_policy: always
container_default_behavior: compatibility
restart: yes
ports:
- 80:80

Now you can see that you need to use the -a deploy option to install nginx in the gateway cluster when using Nginx Package, and you can delete nginx installed in the gateway cluster with the -a delete option.

$ kupboard kollection package -c kupboard-kollection-nginx -n nginx -a <deploy|delete>

Default Packages#

The default kollection of kupboard includes many packages for various open source.