228 Commits

Author SHA1 Message Date
Dave Wilde
e4bd1fdaed MNAIO ELK Updates
* We don't need to create the containers as they are created during the 
initial run.

* Remove quoting in favor of {% raw %} blocks

Change-Id: Ied696ad0882169d523a60a900788e7c2ba1d3fa3
2018-09-19 10:52:32 -05:00
Zuul
94d8f09b74 Merge "Make openstack-service-setup compatible with older ansible" 2018-09-19 06:58:35 +00:00
Zuul
772dad3543 Merge "Deploy ELK in MNAIO" 2018-09-17 18:00:59 +00:00
Wayne Warren
53fe850aa3 Make openstack-service-setup compatible with older ansible
This change allows this playbook to be run using an older version of
ansible. This change is necessary for my use case where I am running all
OSA and related playbooks in a docker container locally for a Newton
deploy.

The use of Newton OSA's ansible bootstrap script means that the
openstack-ansible my workflow uses requires Ansible 2.1, which does not
support `include_tasks`. This change addresses that problem by replacing
`include_tasks` in the playbook that needs to be run using
openstack-ansible with `include` which produces the desired result.

Change-Id: I8b2a0217e851d022ee40cbdd8bc8045e18d5a07d
2018-09-17 11:57:14 -05:00
Zuul
1d6c01ee57 Merge "MNAIO: Cater for galera bootstrap without a master" 2018-09-14 20:58:02 +00:00
Dave Wilde
525887872b Deploy ELK in MNAIO
This enables the deployment of the elk_metrics_6x stack inside of an
MNAIO.

Change-Id: Ie611baee79c33d7cbab9f0865127ac5966475838
2018-09-11 20:17:24 +00:00
Antony Messerli
cd3b3f047a Move bootstrap-ansible and passwords to run_osa tag
Allows for deployment/bootstrap of OSA to be skipped
by skipping run_osa while still allowing configuration
to be added during pre_config_osa.

Change-Id: I40b0c8209f03c7e9543c7c688f2ef8ba2ebdf72d
2018-09-07 17:01:29 -05:00
Jesse Pretorius
41d0e61f0c MNAIO: Cater for galera bootstrap without a master
There can be situations where a gvwstate.dat file is present
in at least one galera container, but the my_uuid and view_id
do not match in any of them. In this case, we should just pick
any container to be the master.

This patch caters for this situation, ensuring that the cluster
still bootstraps whenever the VM boots.

Change-Id: If87cd9399b6624418f16910e4ddc046aaa22e5c5
2018-09-07 17:51:58 +01:00
Jesse Pretorius
2958a629c7 MNAIO: Ensure that nested virt is enabled on host
Nested virtualization is important to improve VM performance
and enabling it is crucial to ensuring that VM images built
on one host work on boot on other hosts because the environment
is consistent.

In this patch add a task to enable it if it is available.

Change-Id: I812d8399cf45fab94f0f46976c9415591d45e463
2018-09-06 17:16:21 +01:00
Jesse Pretorius
f437430212 MNAIO: Ensure that virt-networks are properly setup
Due to the rather terrible virt_net module, only one action
can be done on the virt networks at any one time. This means
that the current action of setting them to autostart has no
effect, because the module does not do it. Also, the current
action of disabling the default network and disabling it from
autostarting also does not take full effect. As such, after a
host reboot, the default network autostarts, and the other
networks are not started and the VM's cannot start. When trying
to resolve this by re-running the host setup, the play ignores
any existing virt networks - so the issue cannot be fixed.

This patch does the following:

1. Ensures that the default network does not autostart. This
   is done by splitting the disabling of the network, and the
   disabling of autostart into two tasks.
2. Changes the define/create action into a single action which
   will not change the network configuration if it is defined.
3. Implements the setting of the network as active, and the
   setting of it to autostart as two seperate tasks. This
   ensures that both actions are actually implemented.

Change-Id: I608f2607824fac649f4e018d89094d57047134b3
2018-09-06 13:08:46 +01:00
Zuul
7a9f3ef7f4 Merge "Force filesystem type on swift format" 2018-09-05 20:11:20 +00:00
Antony Messerli
ad1a4bc9ef Force filesystem type on swift format
It currently seems to think that /dev/vmvg00/disk1
is used for btrfs, so force this operation to
ensure it's changed to xfs.

Change-Id: I0bcc9723fb33b557315422c3259a7ba2b75ceff6
2018-09-05 13:13:22 -05:00
Jesse Pretorius
7618619bf8 MNAIO: Implement retries for image downloads
The image downloads may fail, even with aria's built-in
retry mechanism. With this patch we ensure that ansible
will delay and retry again. This improves the chances of
success.

With this we also remove the '--quiet' default parameter
so that we get console output from the task if it does
ultimately fail. This is useful for diagnostic purposes.

Change-Id: Ieed41f06a22effb28463637184980a748791edfe
2018-09-05 14:20:50 +01:00
Jesse Pretorius
868a559840 MNAIO: Only run systemd daemon_reload when necessary
When the VM's are Ubuntu Trusty, this task causes total failure.
We should only try and do the daemon_reload if the system being
used supports it.

Change-Id: I557856045a7735c8f351df6350f777caae526b10
2018-09-04 19:23:42 +01:00
Jesse Pretorius
4e9c1c5fd8 MNAIO: Make the galera image prep more robust
Unfortunately guestfish may error out silently (no return code
of 1), making hunting down the error a bit obscure. To combat
this we add a bunch of stdout output to the script, and look
for that final step to validate success. To make this work, we
need to copy the script over and execute it with the command
module, because the script module puts everything into stderr.

Change-Id: I8e514ceb2462870721745c9445ec149864a45f4d
2018-09-04 19:19:50 +01:00
Jesse Pretorius
b48b97b115 MNAIO: Fix libguestfs appliance bug workaround task
Currently the contents of zz-dash-packages is as follows:

dash rm -rf /var/tmp/.guestfs

It should be:

dash

This fixes that.

Also, the guestfs location that needs removing has a
uuid appended, so we add a wildcard to the removal.

Change-Id: If53f55c901f5abf19bdfff0c0f17c2f9ed69d915
2018-09-04 19:15:18 +01:00
Zuul
d69c74740d Merge "Reducing memory footprint on mnaio" 2018-09-03 15:24:54 +00:00
Jesse Pretorius
07be558918 MNAIO: Only copy the config files/folders required
Currently all the .example and .aio files are copied over,
resulting in a confusing mess. This changes it to just copy
the stuff that is actually used over instead.

Change-Id: Ic6a3beb4d0084507e3017ea1663fd79fda3d1c12
2018-09-03 15:23:14 +01:00
Jesse Pretorius
e7387a6baa MNAIO: Make galera startup cleanly when using images
In an ideal state, if the galera containers are shut down
cleanly, they will leave behind a gvwstate.dat file on each
node which provides the cluster member details so that it
can automatically start up again without intervention.

However, when imaging the MNAIO systems we only interact
with the hosts, so the galera containers sometimes do no
shut down cleanly.

To cater for this, we inspect the disk images for the
primary component, then build the gvwstate.dat file for
the other galera containers. With those put back into the
image, when the VM's start, the cluster forms immediately.

References:
http://galeracluster.com/documentation-webpages/pcrecovery.html
http://galeracluster.com/documentation-webpages/restartingcluster.html

Change-Id: Icfe067607baefd661147f3c22ce846f06fff7c60
2018-09-01 19:20:38 +00:00
Jesse Pretorius
8eb7afa95a MNAIO: Apply workaround for bug in libguestfs appliance
Without the dash package in the supermin appliance, guestfish
is unable to write into the images. Ubuntu has not updated their
package to a recent enough version, so we apply the workaround.

Change-Id: If48045c9b6e0cffe3d6a188e8a09a1e58ee885a8
2018-09-01 19:20:26 +00:00
Bjoern Teipel
dbc71e195c Reducing memory footprint on mnaio
MNAIO built with newer releases, like Rocky, show increased memory
usage exceeding the default 8G for INFRA_VM_SERVER_RAM setting.
The MariaDB server innodb buffer cache is drastically reduced to
match the deployment size.

Change-Id: Ifef9ee209aedb882ae14b1d2a29852375de8e7e8
2018-08-31 11:18:53 -05:00
Jesse Pretorius
0e8423d536 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
2018-08-29 17:12:43 +01:00
Jesse Pretorius
7f39e408e3 MNAIO: Inject the host ssh public key into the image
To allow a downloaded set of file-backed images to be used on
another host, the new host's public ssh key needs to be injected
into the VM disks so that ansible is able to connect to it and
complete the rest of the preparation.

Change-Id: I6b9b5efb88283417c15f74f40cfb91943bb8774d
2018-08-29 13:34:42 +01:00
Jesse Pretorius
934a3c2651 MNAIO: Default vm_use_snapshot is group_vars
Rather than have to default it in tasks all over the
place, we default it in group_vars. The default is to
enable the feature if file-backed VM's are used.

However, if there are no base images available, the
set_fact task disables it. If a user wishes to force
it not to be used, then an extra-var override is still
usable.

Change-Id: I5c916244a02a44da831d2a0fefd8e8aafae829b2
2018-08-29 13:23:40 +01:00
Jesse Pretorius
80eae4a185 MNAIO: Add playbook to download saved file-backed VM's
With the previously added ability to save file-backed VM's,
a user is able to put them onto a web host for storage. We
now add a playbook to download the images using the given
manifest URL.

Change-Id: If1435c70d672cdbacd22df99318c59265362011e
2018-08-29 11:38:22 +01:00
Zuul
26d0d53ea5 Merge "Adds iPXE UEFI support to Multi Node AIO" 2018-08-27 21:38:48 +00:00
Jesse Pretorius
c72cc198c4 MNAIO: Compress the disk image when saving it
When we save the VM disks, we now use compression to prepare
the base disk so that it reduces the base disk file sizes to
a much smaller base. For the infra hosts this reduces the file
from ~23GB to ~8GB. Once this is done, we then also create a
copy-on-write image in the original disk's place so that the
VM can be booted up to verify functionality or continue work
without having to re-run the 'deploy-vms' playbook.

Change-Id: If95b71d8625b4d5b2a036cec13952e4fd73cecd4
2018-08-24 14:07:38 +01:00
Jesse Pretorius
42189e272f MNAIO: Use discard option for all mount points
Using the discard option for all mount points ensures
that the deletes actually release the blocks on the disk.
This ensures that SSD performance is optimised and that
file-backed images are kept as small as possible.

Change-Id: I648cbaca56d75e355cf6c8af01e2e3ad20dfc398
2018-08-23 18:57:02 +01:00
Jesse Pretorius
f3575be76a MNAIO: Move to using SCSI controller for TRIM support
When using file-backed storage, or SSD storage, any erasing
done in the VM does not actually clear up the space. By using
the virtio-scsi controller the VM is able to use TRIM to clear
any blocks which are deleted.

This also allows us to use fstrim to reduce the size of the
qemu files before we save them for later re-use.

Change-Id: Ia9001522ce054ee9f8a6dd38270da3e3fd039813
2018-08-23 13:53:20 +01:00
Jesse Pretorius
c556bea0d7 MNAIO: Clean up existing data when switching backing store
When switching from LVM to a file backing store, the existing pool
cannot be undefined until any existing VM's and LV's are removed.

This ensures that if this is the case, it will be cleaned up so
that the switch is effortless.

Change-Id: Ie1460b37593306044f0a63f445c3da1987362d34
2018-08-23 10:23:07 +01:00
Jesse Pretorius
5ce798b360 MNAIO: Use images subdirectory for VM images
Instead of putting the images in the root of the disk,
we use a subdirectory. This prevents silly mistakes
from happening.

Change-Id: I19d22b7e72de88736db410a771ec22664c641c94
2018-08-21 18:30:28 +01:00
Jesse Pretorius
ed057ece01 MNAIO: When saving VM images RC=2 is not a fail
When executing the save, the return code of 2 indicates
a change was implemented - but I forgot to include that
condition for failed_when. As it stands now the task will
be considered failed which is a bit useless.

Change-Id: Ie8b36335048d2dcf6d0f9e66f8440430f4a68398
2018-08-20 15:40:45 +01:00
Zuul
023b303e76 Merge "MNAIO: Ensure vm_use_snapshot is defined" 2018-08-17 09:54:13 +00:00
Jesse Pretorius
9488e76bf1 MNAIO: Ensure vm_use_snapshot is defined
When not using a file-backed backing store, the vriable is not
defined and results in an error to that effect.

Change-Id: I3142a5960bc4521f79bbdfe32b0e7a0f71742b7d
2018-08-17 10:27:26 +01:00
alexandrebassel
0fd99e4423 fix intermittent failures when deploying base glance images
CI testing is experiencing intermittent failures when deploying base glance
images as part of the openstack-image-setup.yml playbook which is kicked of
as part of the openstack-service-setup.yml playbook in openstack-ansible-ops.
Since the deployment of these resources rely on external URI endpoints, this
type of failure is something that can occur during a customer deployment.

Change-Id: Ieea0f11482646ea152920a1ff1009a2b03705f1c
2018-08-16 17:02:45 -04:00
Zuul
0b8068ef2a Merge "MNAIO: Install jmespath" 2018-08-16 17:35:19 +00:00
Zuul
bca923f084 Merge "MNAIO: Extend image saving to include manifest" 2018-08-16 17:35:18 +00:00
Zuul
4b750d0acf Merge "MNAIO: Use virt module to shut VM's down when saving images" 2018-08-16 17:35:18 +00:00
Zuul
8c480fcb2a Merge "MNAIO: Enable using a data disk for file-backed VM's" 2018-08-16 15:13:34 +00:00
Jesse Pretorius
b5e9a6c24c MNAIO: Install jmespath
To allow us to use the json_query filter, we ensure that
the jmespath distro package is installed onto the host.

Change-Id: Icb9053fd3a7486030f4336130fe6ad503852b07a
2018-08-15 19:40:44 +01:00
Jesse Pretorius
993bac94f5 MNAIO: Extend image saving to include manifest
In order to more successfully reproduce an environment using
saved images, we include the VM XML definition files and the
output from 'pip freeze'. We capture the list of files, their
checksums and the SHA for the git repo into a json manifest
file.

Change-Id: Ia0bf74d509b4acb10b0dd832a4cfe1bb2afb2503
2018-08-15 19:25:12 +01:00
Jesse Pretorius
6aadbb5ee9 MNAIO: Use virt module to shut VM's down when saving images
It's better to shut the VM's down cleanly instead of just turning
them off, so we change 'destroy' to 'shutdown' and use the virt
module for this action instead of the command module.

Change-Id: I896b7794328b91dc59726bf1d5366eeb7112ca21
2018-08-15 17:11:28 +01:00
Jesse Pretorius
484059205a MNAIO: Enable using a data disk for file-backed VM's
In order to make use of a data disk, we enable the 'file'
implementation of default_vm_disk_mode to use a data disk
much like the 'lvm' implementation.

To simplify changing from the default_vm_disk_mode of lvm
to file and back again, the setup-host playbook will remove
any previous implementation and replace it. This is useful
when doing testing for these different modes because it
does not require cleaning up by hand.

This patch also fixes the implementation of the virt
storage pool. Currently the tasks only execute if
'virt_data_volume.pools is not defined', but it is always
defined so the tasks never execute. We now ensure that
for both backing stores the 'default' storage pool is
defined, started and set to auto start (as three tasks
because the virt_pool module sucks really bad and can only
do one thing at a time).

The pool implementation for the 'file' backed VM's uses
the largest data disk it can find and creates the /data
mount for it. To cater for a different configuration, we
ensure that all references to the disk files use the path
that is configured in the pool ,rather than assuming the
path.

Change-Id: If7e7e37df4d7c0ebe9d003e5b5b97811d41eff22
2018-08-15 16:58:50 +01:00
Jesse Pretorius
6af52b6b05 Use the Ansible runtime venv for pw-token-gen.py
Rather than installing pip packages on to the host system,
we can just execute the script and it will use the ansible
runtime venv. This works for Ocata onwards. Any earlier
releases can either pre-install the right packages, or
implement the change to the script shebang in a fork.

Change-Id: I88eb4c1bc9fe3a38803c5f0f5d1725dbed74dac7
2018-08-15 14:51:07 +01:00
Jesse Pretorius
4a48a6874d Optimise vm_disk_mode conditionals
There is already a default in group_vars/all, so we do not need
to provide a default in every conditional.

Also, we move several LVM data volume tasks into a block given
they have a common set of conditions.

Change-Id: Iff0fafefda2bc5dc1596b7198b779f5da763086c
2018-08-15 08:49:23 +00:00
Jesse Pretorius
241837fc9f MNAIO: Use single vars file for Ubuntu trusty/xenial/bionic
Given there is almost no difference between the releases, we can
use the same vars file and simple conditionals. The package
'software-properties-common' is available for Trusty & Xenial so
we just use that and remove the unnecessary extra package.

We also now add the correct UCA repositories for Trusty and Bionic
so that we get the latest version of libvirt.

Finally, we simplify the conditional for the iptables binary to
make it far easier to read.

Change-Id: Id4b3711a4d7a0ccc13db956d41017ac01c97825f
2018-08-13 17:22:14 +01:00
Zuul
eb29d99642 Merge "Undefine existing VM configurations during rebuild" 2018-07-31 06:19:26 +00:00
Zuul
f09f055020 Merge "Adds Support for MNAIO CentOS 7 Environment" 2018-07-26 16:20:57 +00:00
Antony Messerli
c3e04a5106 Adds Support for MNAIO CentOS 7 Environment
* Adds support for provisioning a Multi Node AIO using
  CentOS 7.
* Cleans up older MNAIO/Compute/Infra image configs
* Increases LB/Logging/Swift VM ram to allow for CentOS rootfs
  to load into RAM. (1GB to 2GB)
* Uses systemd-network networking for configuring network/bridges
* Adds keymap to kvm configuration to alleviate keyboard issues in
  virt-manager
Change-Id: I54d903e7c1c70882e8b20a9cef4eafb42be46770
2018-07-24 09:31:11 -05:00
Antony Messerli
fec5aa8f20 Adds tweaks to run MNAIO on Ubuntu 18.04
Drops python-software-properties package as it
doesn't appear to be in the Bionic build.

Change-Id: I70ee08b69374e7e61a6ac3344a93f119748941e9
2018-07-23 14:10:45 -05:00