MNAIO: Make post-install storage provisioning idempotent

The swift and cinder hosts do not use containers for services,
so there is no need to do the current process of shrinking the
volumes. Instead, we ensure that the lxc & machines mounts are
removed, with their respective logical volumes.

When setting up the swift logical volumes, we do not need to
create the mount point directories, because the mount task will
do that for us. As such, we remove that task.

Change-Id: Ibbe6d0fede6b6965415e421161354e311708d113
This commit is contained in:
Jesse Pretorius 2018-08-29 17:12:43 +01:00
parent 7f39e408e3
commit 0e8423d536

View File

@ -288,53 +288,41 @@
- name: Make space for swift and cinder volumes
hosts: cinder_hosts:swift_hosts
gather_facts: false
gather_facts: "{{ gather_facts | default(true) }}"
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- deploy-vms
tasks:
- name: Unmount lxc and machines mounts
- name: Unmount unnecessary mounts
mount:
name: "{{ item }}"
state: unmounted
state: absent
with_items:
- "/var/lib/lxc"
- "/var/lib/machines"
register: _remove_mounts
- name: Remove lxc mount directory
mount:
name: "/var/lib/lxc"
state: absent
- name: Shrink machines00 logical volume
- name: Remove unnecessary logical volumes
lvol:
vg: vmvg00
lv: machines00
size: 8192
shrink: yes
force: yes
when:
- default_container_tech | default('lxc') == 'nspawn'
- name: Remove lxc00 logical volume
lvol:
vg: vmvg00
lv: lxc00
lv: "{{ item }}"
force: true
state: absent
with_items:
- "lxc00"
- "machines00"
register: _remove_lvs
- name: Re-mount machines00 logical volume
mount:
path: /var/lib/machines
src: /dev/mapper/vmvg00-machines00
state: mounted
fstype: btrfs
opts: defaults,discard
- name: Reload systemd to remove generated unit files for mount
systemd:
daemon_reload: yes
when:
- (_remove_mounts is changed) or (_remove_lvs is changed)
- name: Setup cinder host volume
hosts: cinder_hosts
gather_facts: false
gather_facts: "{{ gather_facts | default(true) }}"
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- deploy-vms
@ -354,12 +342,12 @@
- name: Setup swift host volume
hosts: swift_hosts
gather_facts: false
gather_facts: "{{ gather_facts | default(true) }}"
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- deploy-vms
tasks:
- name: Remove deleteme lv
- name: Create swift disk LV's
lvol:
vg: vmvg00
lv: "{{ item }}"
@ -378,18 +366,6 @@
- disk2
- disk3
- name: Create drive directories
file:
path: "/srv/{{ item }}"
state: directory
owner: "root"
group: "root"
mode: "0755"
with_items:
- disk1
- disk2
- disk3
- name: Mount swift drives
mount:
name: "/srv/{{ item }}"