Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions etc/kayobe/ansible/growroot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
# Custom playbook to grow the partition and LVM PV of the root VG. This allows
# for expansion of LVs in that VG. This may be used as a pre-overcloud host
# configure hook.
#
# Variables:
# * growroot_group: Host pattern against which to target the playbook. Default
# is 'overcloud'.
# * growroot_vg: Name of the VG containing the PV to grow. Default is 'rootvg'.

- name: Grow root PV
hosts: "{{ growroot_group | default('overcloud') }}"
# Avoid using facts because this may be used as a pre overcloud host
# configure hook, and we don't want to populate the fact cache (if one is in
# use) with the bootstrap user's context.
gather_facts: false
tags:
- growroot
vars:
ansible_user: "{{ bootstrap_user }}"
# We can't assume that a virtualenv exists at this point, so use the system
# python interpreter.
ansible_python_interpreter: /usr/bin/python3
# Work around no known_hosts entry on first boot.
ansible_ssh_common_args: "-o StrictHostKeyChecking=no"
# Name of the LVM VG containing the root PV.
growroot_vg: "rootvg"
# Don't assume facts are present.
os_family: "{{ ansible_facts.os_family | default('Debian' if os_distribution == 'ubuntu' else 'RedHat') }}"

tasks:
- name: Check if growpart is installed
shell:
cmd: type growpart
changed_when: false
failed_when: false
register: growpart_check
become: true

- name: Ensure growpart is installed
package:
name: "{% if os_family == 'RedHat' %}cloud-utils-growpart{% else %}cloud-guest-utils{% endif %}"
state: present
cache_valid_time: "{{ apt_cache_valid_time if os_family == 'Debian' else omit }}"
update_cache: "{{ True if os_family == 'Debian' else omit }}"
become: True
when: growpart_check.rc != 0

- name: Get root PV device
command: "pvs --select vg_name={{ growroot_vg }} --reportformat json"
register: pvs
become: True
changed_when: False

- name: Fail if root PV device not found
fail:
msg: >
Expected LVM physical volume devices not found in volume group {{ growroot_vg }}
when: (pvs.stdout | from_json).report[0].pv | length == 0

- name: Grow partition
command: "growpart {{ disk }} {{ part_num }}"
vars:
pv: "{{ pvs.stdout | from_json }}"
disk_tmp: "{{ pv.report[0].pv[0].pv_name[:-1] }}"
disk: "{{ disk_tmp[:-1] if disk_tmp[-1] == 'p' else disk_tmp }}"
part_num: "{{ pv.report[0].pv[0].pv_name[-1] }}"
become: True
failed_when: "growpart.rc != 0 and 'NOCHANGE' not in growpart.stdout"
changed_when: "'NOCHANGE' not in growpart.stdout"
register: growpart

- name: Grow LVM PV
command: "pvresize {{ disk }}"
vars:
pv: "{{ pvs.stdout | from_json }}"
disk: "{{ pv.report[0].pv[0].pv_name }}"
become: True
when: "'NOCHANGE' not in growpart.stdout"
35 changes: 35 additions & 0 deletions etc/kayobe/ansible/swap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# Custom playbook to configure a swap device. This may be used as a
# post-overcloud host configure hook.
#
# Variables:
# * swap_group: Host pattern against which to target the playbook. Default is
# 'overcloud'.
# * swap_device: Name of the swap device to configure. Default is
# '/dev/rootvg/lv_swap'.

- name: Configure swap
hosts: "{{ swap_group | default('overcloud') }}"
tags:
- swap
vars:
swap_device: "/dev/rootvg/lv_swap"
become: true
tasks:
- name: Ensure swap filesystem is present
filesystem:
fstype: "swap"
dev: "{{ swap_device }}"

- name: Ensure swap device present in fstab
mount:
name: "none"
src: "{{ swap_device }}"
fstype: "swap"
state: "present"

# It does no harm to run this when swap is already active
- name: Enable swap devices
command: "/sbin/swapon -a"
when:
- ansible_facts.swaptotal_mb == 0
150 changes: 150 additions & 0 deletions etc/kayobe/inventory/group_vars/all/stackhpc-lvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
###############################################################################
# StackHPC LVM Volume Group (VG) configuration.

# StackHPC rootvg VG.
# This VG contains a set of LVs that conform to the CIS partition benchmarks.
# This layout is compatible with the overcloud DIB host image configuration in
# stackhpc-overcloud-dib.yml. This may be used as an item in one of the
# *_lvm_groups variables.
# Example:
# controller_lvm_groups:
# - "{{ stackhpc_lvm_group_rootvg }}"
stackhpc_lvm_group_rootvg:
vgname: rootvg
disks: "{{ stackhpc_lvm_group_rootvg_disks }}"
create: true
lvnames: "{{ stackhpc_lvm_group_rootvg_lvs_default + stackhpc_lvm_group_rootvg_lvs_extra }}"

# List of disks to include in the rootvg VG.
stackhpc_lvm_group_rootvg_disks:
- /dev/disk/by-partlabel/root

# List of default LVs to include in the rootvg VG.
stackhpc_lvm_group_rootvg_lvs_default:
- "{{ stackhpc_lvm_lv_swap }}"
- "{{ stackhpc_lvm_lv_root }}"
- "{{ stackhpc_lvm_lv_tmp }}"
- "{{ stackhpc_lvm_lv_var }}"
- "{{ stackhpc_lvm_lv_var_tmp }}"
- "{{ stackhpc_lvm_lv_log }}"
- "{{ stackhpc_lvm_lv_audit }}"
- "{{ stackhpc_lvm_lv_home }}"

# List of extra LVs to include in the rootvg VG.
stackhpc_lvm_group_rootvg_lvs_extra: []

###############################################################################
# StackHPC LVM Logical Volume (LV) configuration.

# StackHPC LVM lv_swap LV size.
stackhpc_lvm_lv_swap_size: 16g

# StackHPC LVM lv_root LV size.
stackhpc_lvm_lv_root_size: 50g

# StackHPC LVM lv_tmp LV size.
stackhpc_lvm_lv_tmp_size: 10g

# StackHPC LVM lv_var LV size.
stackhpc_lvm_lv_var_size: 20g

# StackHPC LVM lv_var_tmp LV size.
stackhpc_lvm_lv_var_tmp_size: 2g

# StackHPC LVM lv_log LV size.
stackhpc_lvm_lv_log_size: 20g

# StackHPC LVM lv_audit LV size.
stackhpc_lvm_lv_audit_size: 10g

# StackHPC LVM lv_home LV size.
stackhpc_lvm_lv_home_size: 10g

# StackHPC LVM lv_docker LV size.
stackhpc_lvm_lv_docker_size: 100%FREE

# StackHPC LVM lv_swap LV.
stackhpc_lvm_lv_swap:
lvname: lv_swap
size: "{{ stackhpc_lvm_lv_swap_size }}"
create: true
mount: false

# StackHPC LVM lv_root LV.
stackhpc_lvm_lv_root:
lvname: lv_root
size: "{{ stackhpc_lvm_lv_root_size }}"
create: true
filesystem: ext4
mount: true
mntp: /

# StackHPC LVM lv_tmp LV.
stackhpc_lvm_lv_tmp:
lvname: lv_tmp
size: "{{ stackhpc_lvm_lv_tmp_size }}"
create: true
filesystem: ext4
mount: true
mntp: /tmp

# StackHPC LVM lv_var LV.
stackhpc_lvm_lv_var:
lvname: lv_var
size: "{{ stackhpc_lvm_lv_var_size }}"
create: true
filesystem: ext4
mount: true
mntp: /var

# StackHPC LVM lv_var_tmp LV.
stackhpc_lvm_lv_var_tmp:
lvname: lv_var_tmp
size: "{{ stackhpc_lvm_lv_var_tmp_size }}"
create: true
filesystem: ext4
mount: true
mntp: /var/tmp

# StackHPC LVM lv_log LV.
stackhpc_lvm_lv_log:
lvname: lv_log
size: "{{ stackhpc_lvm_lv_log_size }}"
create: true
filesystem: ext4
mount: true
mntp: /var/log

# StackHPC LVM lv_audit LV.
stackhpc_lvm_lv_audit:
lvname: lv_audit
size: "{{ stackhpc_lvm_lv_audit_size }}"
create: true
filesystem: ext4
mount: true
mntp: /var/log/audit

# StackHPC LVM lv_home LV.
stackhpc_lvm_lv_home:
lvname: lv_home
size: "{{ stackhpc_lvm_lv_home_size }}"
create: true
filesystem: ext4
mount: true
mntp: /home

# StackHPC LVM lv_docker LV.
# NOTE: This is not included in the rootvg by default, but may be added via
# stackhpc_lvm_group_rootvg_lvs_extra.
# Example:
# stackhpc_lvm_group_rootvg_lvs_extra:
# - "{{ stackhpc_lvm_lv_docker }}"
# Alternatively, this may reside in a separate VG.
stackhpc_lvm_lv_docker:
lvname: lv_docker
size: "{{ stackhpc_lvm_lv_docker_size }}"
create: true
filesystem: ext4
mount: true
mntp: /var/lib/docker
10 changes: 9 additions & 1 deletion etc/kayobe/overcloud-dib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
# is {{ os_distribution == 'rocky' }}. This will change in a future release.
#overcloud_dib_build_host_images:

# List of additional host packages to install.
overcloud_dib_host_packages_extra:
- "{% if 'ubuntu-minimal' in overcloud_dib_host_images | map(attribute='elements') | flatten | list %}debootstrap{% endif %}"

# List of overcloud host disk images to build. Each element is a dict defining
# an image in a format accepted by the stackhpc.os-images role. Default is to
# build an image named "deployment_image" configured with the overcloud_dib_*
Expand Down Expand Up @@ -64,7 +68,11 @@

# List of additional git repositories containing Diskimage Builder (DIB)
# elements. See stackhpc.os-images role for usage. Default is empty.
#overcloud_dib_git_elements_extra:
overcloud_dib_git_elements_extra:
- repo: "https://github.com/stackhpc/stackhpc-image-elements"
local: "{{ source_checkout_path }}/stackhpc-image-elememts"
version: "v1.4.0"
elements_path: "elements"

# List of git repositories containing Diskimage Builder (DIB) elements. See
# stackhpc.os-images role for usage. Default is a combination of
Expand Down
Loading