Last active
May 30, 2019 12:54
-
-
Save dmsimard/d3d818462292faf92dded7e2caf67bab to your computer and use it in GitHub Desktop.
Fix disk layout
This file contains 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
--- | |
- hosts: all | |
gather_facts: yes | |
vars_files: | |
- devstack_gate_vars.yaml | |
pre_tasks: | |
# Note (dmsimard) | |
# If some swap is already set up, the amount is not 100% accurate | |
# (ex: 8191MB swap for a 8192MB file) | |
- name: Configure swap | |
include_role: | |
name: "configure_swap" | |
when: ansible_memory_mb['swap']['total'] | int + 10 <= SWAP_SIZE | |
roles: | |
- gather_host_info | |
- fix_etc_hosts | |
- create_base_folder | |
- start_fresh_logging | |
- setup_stack_user | |
- setup_tempest_user | |
- copy_mirror_config | |
- network_sanity_check |
This file contains 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
- name: Set ephemeral device if /dev/xvde exists | |
set_fact: | |
ephemeral_device: "/dev/xvde" | |
when: "/dev/xvde" in ansible_devices | |
- block: | |
when: ephemeral_device is undefined | |
# TODO: Add the filesystem label to ansible_mounts fact | |
# i.e, https://github.com/ansible/ansible/blob/7b73ee0818a4fa3b3155b45deb8f60e8b7a72cdf/lib/ansible/module_utils/facts/hardware/linux.py#L332 | |
- name: Look if ephemeral0 device exists | |
command: blkid | |
register: blkid | |
- name: Set ephemeral device if ephemeral0 exists | |
set_fact: | |
ephemeral_device: "{{ lookup('pipe', 'blkid -L ephemeral0') }}" | |
when: "ephemeral0" in blkd.stdout | |
- block: | |
when: ephemeral device is defined | |
vars: | |
swap_partition: "{{ ephemeral_device }}1" | |
lvm_partition: "{{ ephemeral_device }}2" | |
opt_partition: "{{ ephemeral_device }}3" | |
- name: Ensure the ephemeral device is unmounted | |
mount: | |
name: "{{ ephemeral_device }}" | |
state: unmounted | |
# [...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to configure swap using disk where lvm module will create swap vm conditional. Lets say swap vol would be 2x memory when memory is <=4G, 1x memory from 4G-16G and 16G when memory is > 16G. What are your suggestions.