-
Notifications
You must be signed in to change notification settings - Fork 23
Xena: overcloud DIB host image, LVM, swap & growroot #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0381e16
Add StackHPC overcloud DIB configuration
markgoddard 4102cde
Add StackHPC LVM configuration
markgoddard f093d1f
Add swap.yml custom playbook
markgoddard 5ef8de0
Add growroot.yml custom playbook
markgoddard 817bea9
growpart.yml: Don't assume facts are present
markgoddard 04f1582
Overcloud DIB: stop using StackHPC package repos for Ubuntu image
markgoddard 0f61e4e
growroot.yml: Fail if the expected volume group doesn't exist
markgoddard 10b96b4
growroot: Avoid package installation when growpart is installed
markgoddard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
# 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: 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 | ||
|
||
- name: Get root PV device | ||
command: "pvs --select vg_name={{ growroot_vg }} --reportformat json" | ||
register: pvs | ||
become: True | ||
changed_when: False | ||
|
||
- 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
markgoddard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.