Skip to content

Instantly share code, notes, and snippets.

@dmsimard dmsimard/playbook.yml
Last active May 30, 2019

What would you like to do?
Fix disk layout
- hosts: all
gather_facts: yes
- devstack_gate_vars.yaml
# 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
name: "configure_swap"
when: ansible_memory_mb['swap']['total'] | int + 10 <= SWAP_SIZE
- gather_host_info
- fix_etc_hosts
- create_base_folder
- start_fresh_logging
- setup_stack_user
- setup_tempest_user
- copy_mirror_config
- network_sanity_check
- name: Set ephemeral device if /dev/xvde exists
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,
- name: Look if ephemeral0 device exists
command: blkid
register: blkid
- name: Set ephemeral device if ephemeral0 exists
ephemeral_device: "{{ lookup('pipe', 'blkid -L ephemeral0') }}"
when: "ephemeral0" in blkd.stdout
- block:
when: ephemeral device is defined
swap_partition: "{{ ephemeral_device }}1"
lvm_partition: "{{ ephemeral_device }}2"
opt_partition: "{{ ephemeral_device }}3"
- name: Ensure the ephemeral device is unmounted
name: "{{ ephemeral_device }}"
state: unmounted
# [...]

This comment has been minimized.

Copy link

manishshukla4u commented May 30, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.