Skip to content

Commit

Permalink
roles: add variables documentation
Browse files Browse the repository at this point in the history
Update the role's documentations to include the variables that can be
set for each role.

Also move the default variables values which were in the playbooks to
the roles themselves.

Signed-off-by: Mathieu Dupré <[email protected]>
  • Loading branch information
dupremathieu committed Dec 19, 2024
1 parent b9efa06 commit b20f554
Show file tree
Hide file tree
Showing 33 changed files with 203 additions and 66 deletions.
3 changes: 0 additions & 3 deletions playbooks/cluster_setup_libvirt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@
- name: Configure libvirt
hosts: hypervisors:&cluster_machines
become: true
vars:
rbd_pool_name: "{{ libvirt_rbd_pool | default('rbd') }}"
pool_name: "{{ libvirt_pool_name | default('ceph') }}"
roles:
- configure_libvirt
8 changes: 6 additions & 2 deletions roles/add_livemigration_user/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Add LiveMigration User Role

This role sets the live migration user on the cluster, with ssh key exchanges
This role sets the live migration user on the cluster, with ssh key exchanges.
If the user does not already exist, they will be created.

## Requirements

no requirement.

## Role Variables

- livemigration_user
| Variable | Required | Type | Comments |
|-------------------------|----------|--------|--------------------------------------------------------------------|
| livemigration_user | no | String | The livemigration user. If not defined, the role will do nothing. |


## Example Playbook

Expand Down
11 changes: 9 additions & 2 deletions roles/ceph_expansion_lv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ This role extends the ceph LV to whatever is ask in the variables

## Requirements

no requirement.
No requirement.

## Role Variables

- lvm_volumes
| Variable | Required | Type | Comments |
|-------------------------|----------|---------------|--------------------------------------------------------------------|
| lvm_volumes | no | Array of dict | LVM volumes |
| -> data_vg | no |String | TODO |
| -> data | no |String | TODO |
| -> data_size | no |String | TODO |
| ansible_lvm | no | Dict | TODO |


## Example Playbook

Expand Down
9 changes: 6 additions & 3 deletions roles/configure_admin_user/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Configure admin_user Role
# Configure admin user Role
This role copy the root ssh key to admin user's. This user is used by Debian when using consolevm.

## Requirements

- detect_seapath_distro
No requirement.

## Role Variables

- admin_user
| Variable | Required | Type | Comments |
|-------------------------|----------|--------|--------------------------------------------------------------------|
| seapath_distro | yes | String | SEAPATH variant. *CentOS*, *Debian* or *Yocto*. The variable can be set automatically using the *detect_seapath_distro role* |
| admin_user | yes | String | The admin user. |

## Example Playbook

Expand Down
4 changes: 4 additions & 0 deletions roles/configure_admin_user/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ galaxy_info:
- name: Debian
versions:
- all
platforms:
- name: CentOS
versions:
- all
dependencies:
- role: detect_seapath_distro
26 changes: 20 additions & 6 deletions roles/configure_ha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,35 @@ This role configures the High Availability part of a seapath cluster (Corosync a

## Requirements

- detect_seapath_distro
No requirement.

## Role Variables

- corosync_node_list
- tmpdir
- crm_cmd_path
- vmmgrapi_cmd_list
- extra_crm_cmd_to_run
| Variable | Required | Type | Default | Comments |
|-------------------------|----------|-------------|---------|--------------------------------------------------------------------------------|
| seapath_distro | yes | String | | SEAPATH variant. *CentOS*, *Debian* or *Yocto*. The variable can be set automatically using the *detect_seapath_distro role* |
| corosync_node_list | yes | String list | | List of all corosync nodes. Usualy `{{ groups['cluster_machines'] \| list }}` |
| tmpdir | no | String | /tmp | Tempory directory path to use |
| enable_vmmgr_http_api | no | Bool | false | Set to true to enable SEAPATH vm-manager REST API |
| admin_cluster_ip | no | String | | IP of the REST API. If not set the m-manager REST API will be disabled even if `enable_vmmgr_http_api is set to true` |
| extra_crm_cmd_to_run | no | String | | List of `crm configure` commands to run separate by a new line. |

## Example Playbook

```yaml
- name: Configure HA
hosts: cluster_machines
vars:
corosync_node_list: "{{ groups['cluster_machines'] | list }}"
extra_crm_cmd_to_run: >-
primitive st-1 stonith:external/rackpdu params hostlist=h1 pduip=192.168.3.127
location l-st-h1 st-1 -inf: h1
primitive st-2 stonith:eexternal/rackpdu params hostlist=h2 pduip=192.168.3.128
location l-st-h2 st-2 -inf: h2
primitive st-3 stonith:eexternal/rackpdu params hostlist=h3 pduip=192.168.3.129
location l-st-h3 st-3 -inf: h3
property stonith-enabled=true
roles:
- { role: seapath_ansible.configure_ha }
```
6 changes: 6 additions & 0 deletions roles/configure_ha/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (C) 2024 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0

---
tmpdir: "/tmp"
enable_vmmgr_http_api: false
6 changes: 6 additions & 0 deletions roles/configure_ha/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@ galaxy_info:
- name: Debian
versions:
- all
- name: CentOS
versions:
- all
- name: Yocto
versions:
- all
dependencies:
- role: detect_seapath_distro
1 change: 0 additions & 1 deletion roles/configure_ha/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@
cmd: crm -d config load update -
stdin: "{{ vmmgrapi_cmd_list }}"
when:
- enable_vmmgr_http_api is defined
- enable_vmmgr_http_api is true
- admin_cluster_ip is defined
run_once: true
Expand Down
10 changes: 6 additions & 4 deletions roles/configure_libvirt/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Configure Libvirt Role

This role configure the libvirt secret and pool for ceph to use
This role create a libvirt storage pool for ceph.

## Requirements

no requirement.
No requirement.

## Role Variables

- libvirt_rbd_pool
- libvirt_pool_name
| Variable | Required | Type | Default | Comments |
|-------------------------|----------|--------|---------|------------------------------------------------|
| libvirt_rbd_pool | no | String | rbd | The Ceph RBD pool use by libvirts |
| libvirt_pool_name | no | String | ceph | The name of the libvirt storage pool to create |

## Example Playbook

Expand Down
6 changes: 6 additions & 0 deletions roles/configure_libvirt/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (C) 2024 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0

---
libvirt_rbd_pool: "rbd"
libvirt_pool_name: "ceph"
8 changes: 7 additions & 1 deletion roles/configure_libvirt/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
---
galaxy_info:
author: "Seapath"
description: configures the libvirt secret and pool for ceph to use
description: Create a libvirt storage pool for ceph.
license: Apache-2.0
min_ansible_version: 2.9.10
platforms:
- name: Debian
versions:
- all
- name: CentOS
versions:
- all
- name: Yocto
versions:
- all
dependencies: []
6 changes: 3 additions & 3 deletions roles/configure_libvirt/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@
community.libvirt.virt_pool:
command: define
xml: '{{ lookup("template", "libvirt_pool.xml.j2") }}'
name: "{{ pool_name }}"
name: "{{ libvirt_pool_name }}"
- name: Start libvirt pool
community.libvirt.virt_pool:
state: active
name: "{{ pool_name }}"
name: "{{ libvirt_pool_name }}"
- name: Autostart pool
community.libvirt.virt_pool:
autostart: yes
name: "{{ pool_name }}"
name: "{{ libvirt_pool_name }}"
- name: Refresh pool
command: virsh pool-refresh --pool ceph
changed_when: false
Expand Down
4 changes: 2 additions & 2 deletions roles/configure_libvirt/templates/libvirt_pool.xml.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<pool type="rbd">
<name>{{ pool_name }}</name>
<name>{{ libvirt_pool_name }}</name>
<source>
<name>{{ rbd_pool_name }}</name>
<name>{{ libvirt_rbd_pool }}</name>
<host name='rbd' port='6789' />
<auth username='libvirt' type='ceph'>
<secret uuid='{{ libvirt_uuid_rbd }}'/>
Expand Down
11 changes: 9 additions & 2 deletions roles/configure_nic_irq_affinity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@ This is useful is you use macvlan driver for your containers or VMs

## Requirements

no requirement.
No requirement.

## Role Variables

- nics_affinity
| Variable | Required | Type | Comments |
|-------------------------|----------|----------- |--------------------------------------------------------------------|
| nics_affinity | no | Dict array | Array of dictionnaries, nic / affinity (e.g. "eth0": "3-4"). Affinity can be a single core, or a range seperate by *-*. Multiple values can be set separate by a coma. |

## Example Playbook

```yaml
- hosts: cluster_machines
vars:
nics_affinity:
- "eth0": "3-4"
- "eth1": "9"
- "eth2": "7,10-13"
roles:
- { role: seapath_ansible.configure_nic_irq_affinity }
```
11 changes: 11 additions & 0 deletions roles/configure_nic_irq_affinity/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (C) 2024 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0

---

- name: Enable and start NIC irq affinity service
systemd:
name: setup_nic_irq_affinity.service
enabled: yes
state: started
daemon_reload: yes
7 changes: 6 additions & 1 deletion roles/configure_nic_irq_affinity/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ galaxy_info:
- name: Debian
versions:
- all
- name: Yocto
versions:
- all
- name: CentOS
versions:
- all
dependencies: []

13 changes: 4 additions & 9 deletions roles/configure_nic_irq_affinity/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,18 @@
src: setup_nic_irq_affinity.py
dest: /etc/systemd/system/setup_nic_irq_affinity.py
mode: 0755

- name: Copy NIC irq affinity service
copy:
src: setup_nic_irq_affinity.service
dest: /etc/systemd/system/setup_nic_irq_affinity.service
mode: 0644

- name: Copy NIC irq affinity environment file
template:
src: setup_nic_irq_affinity.j2
dest: /etc/default/setup_nic_irq_affinity
mode: 0644

- name: Enable and start NIC irq affinity service
systemd:
name: setup_nic_irq_affinity.service
enabled: yes
state: started
daemon_reload: yes

when: nics_affinity is defined
notify: Enable and start NIC irq affinity service
6 changes: 5 additions & 1 deletion roles/conntrackd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ This role configure the conntrackd feature

## Requirements

no requirement.
No requirement.

## Role Variables

- conntrackd_ignore_ip_list

| Variable | Required | Type | Comments |
|----------------------------|----------|--------|---------------------------------------------|
| conntrackd_ignore_ip_list | no | Bool | Enable contrackd if the variable is defined |

## Example Playbook

```yaml
Expand Down
4 changes: 3 additions & 1 deletion roles/conntrackd/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ galaxy_info:
- name: Debian
versions:
- all
- name: CentOS
versions:
- all
dependencies: []

4 changes: 2 additions & 2 deletions roles/deploy_cukinia/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ This role deploys the cukinia utility

## Requirements

no requirement.
No requirement.

## Role Variables

no variable.
No variable.

## Example Playbook

Expand Down
2 changes: 1 addition & 1 deletion roles/deploy_cukinia/files/cukinia
Submodule cukinia updated 1 files
+4 −2 cukinia
4 changes: 2 additions & 2 deletions roles/deploy_cukinia_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ This role deploys the cukinia tests

## Requirements

no requirement.
No requirement.

## Role Variables

- filter (can be "none", "hosts", "observers" or "guests")
No variable.

## Example Playbook

Expand Down
4 changes: 2 additions & 2 deletions roles/deploy_python3_setup_ovs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ deploys python3-setup-ovs (seapath-config_ovs)

## Requirements

no requirement.
No requirement.

## Role Variables

no variable.
No variable.

## Example Playbook

Expand Down
4 changes: 3 additions & 1 deletion roles/deploy_python3_setup_ovs/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ galaxy_info:
- name: Debian
versions:
- all
- name: CentOS
versions:
- all
dependencies: []

Loading

0 comments on commit b20f554

Please sign in to comment.