Skip to content

Commit

Permalink
Add rook_operator (#1337)
Browse files Browse the repository at this point in the history
Signed-off-by: Eike Waldt <[email protected]>
  • Loading branch information
yeoldegrove authored Mar 12, 2024
1 parent fe98488 commit 6835477
Show file tree
Hide file tree
Showing 9 changed files with 756 additions and 0 deletions.
Empty file added roles/rook_operator/README.md
Empty file.
47 changes: 47 additions & 0 deletions roles/rook_operator/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Ansible role for installation and configuration of the Rook operator.


**Operator Variables**

.. zuul:rolevar:: operator_user
:default: dragon

The user which will own the configuration directory and handles with Docker.

.. zuul:rolevar:: operator_group
:default: operator_user

Group from the user which will own the configuration directory.

**Rook Variables**

.. zuul:rolevar:: container_registry_rook_operator
:default: index.docker.io

Path to the registry that stores the container images for the rook operator.

.. zuul:rolevar:: rook_operator_image
:default: {{ container_registry_rook_operator }}/rook/ceph

The container image to use.

.. zuul:rolevar:: rook_operator_image_tag
:default: v1.13.5

Version from rook operator in form of a tag which should be used.

.. zuul:rolevar:: rook_operator_work_directory
:default: /tmp/rook_operator/configuration

Work directory inside the osism-ansible container.

.. zuul:rolevar:: rook_operator_template_directory
:default: .

Template directory containing `operator.yml`, e.g. OSISM configuration directory.

.. zuul:rolevar:: rook_operator_namespace
:default: .

Kubernetes namespace in which the operator should be installed.
Also see https://rook.io/docs/rook/v1.13/Storage-Configuration/Advanced/ceph-configuration/?h=#using-alternate-namespaces
22 changes: 22 additions & 0 deletions roles/rook_operator/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
##########################
# operator

operator_user: dragon
operator_group: "{{ operator_user }}"

##########################
# rook_operator

container_registry_rook_operator: index.docker.io
rook_operator_image: "{{ container_registry_rook_operator }}/rook/ceph"
# renovate: datasource=docker depName=index.docker.io/rook/ceph
rook_operator_image_tag: "v1.13.5"

## work directory inside the osism-ansible container:
rook_operator_work_directory: /tmp/rook_operator/configuration
## template directory containing `operator.yml`, e.g. OSISM configuration directory
rook_operator_template_directory: .
## kubernetes namespace in which the operator should be installed
## also see https://rook.io/docs/rook/v1.13/Storage-Configuration/Advanced/ceph-configuration/?h=#using-alternate-namespaces
rook_operator_namespace: rook-ceph
16 changes: 16 additions & 0 deletions roles/rook_operator/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
galaxy_info:
author: Eike Waldt
description: Role osism.services.rook_operator
company: OSISM GmbH
license: Apache License 2.0
min_ansible_version: 2.10.0
platforms:
- name: Ubuntu
versions:
- focal
- jammy
galaxy_tags:
- osism
- kubernetes
- helm
18 changes: 18 additions & 0 deletions roles/rook_operator/tasks/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Create required directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ operator_user }}"
group: "{{ operator_group }}"
mode: 0750
loop:
- "{{ rook_operator_work_directory }}"

- name: Render values file for rook-ceph operator helm chart
ansible.builtin.template:
src: "{{ rook_operator_template_directory }}/operator.yml.j2"
dest: "{{ rook_operator_work_directory }}/operator.yml"
owner: "{{ operator_user }}"
group: "{{ operator_group }}"
mode: 0640
9 changes: 9 additions & 0 deletions roles/rook_operator/tasks/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Deploy rook-ceph operator chart
kubernetes.core.helm:
release_name: rook-ceph
chart_ref: rook-release/rook-ceph
release_namespace: "{{ rook_operator_namespace }}"
values_files:
- "{{ rook_operator_work_directory }}/operator.yml"
force: true # needed for update
12 changes: 12 additions & 0 deletions roles/rook_operator/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Include config tasks
ansible.builtin.include_tasks: config.yml
tags: config

- name: Include namespace tasks
ansible.builtin.include_tasks: namespace.yml
tags: namespace

- name: Include deploy tasks
ansible.builtin.include_tasks: deploy.yml
tags: deploy
7 changes: 7 additions & 0 deletions roles/rook_operator/tasks/namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: "Create namespace {{ rook_operator_namespace }}"
kubernetes.core.k8s:
name: "{{ rook_operator_namespace }}"
kind: Namespace
state: present
kubeconfig: /share/kubeconfig
Loading

0 comments on commit 6835477

Please sign in to comment.