From 241837fc9f8efc0366612df024e65e031c444269 Mon Sep 17 00:00:00 2001
From: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
Date: Mon, 13 Aug 2018 17:22:14 +0100
Subject: [PATCH] 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
---
 .../playbooks/vars/ubuntu-18.04.yml           | 56 -------------------
 multi-node-aio/playbooks/vars/ubuntu.yml      | 11 +++-
 2 files changed, 9 insertions(+), 58 deletions(-)
 delete mode 100644 multi-node-aio/playbooks/vars/ubuntu-18.04.yml

diff --git a/multi-node-aio/playbooks/vars/ubuntu-18.04.yml b/multi-node-aio/playbooks/vars/ubuntu-18.04.yml
deleted file mode 100644
index a6fc526b..00000000
--- a/multi-node-aio/playbooks/vars/ubuntu-18.04.yml
+++ /dev/null
@@ -1,56 +0,0 @@
----
-# Copyright 2018, Rackspace US, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in witing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-mnaio_host_required_distro_packages:
-  - ubuntu-cloud-keyring
-
-mnaio_host_package_repos:
-  - repo: "deb http://ubuntu-cloud.archive.canonical.com/ubuntu {{ ansible_lsb.codename }}-updates/queens main"
-    state: present
-    filename: "uca"
-    condition: "{{ ansible_lsb.codename == 'xenial' }}"
-
-mnaio_host_distro_packages:
-  - bridge-utils
-  - ifenslave
-  - iptables-persistent
-  - libvirt-bin
-  - lvm2
-  - ntp
-  - openssh-server
-  - python2.7
-  - python-lxml
-  - qemu-kvm
-  - qemu-utils
-  - software-properties-common
-  - virtinst
-  - virt-manager
-  - vlan
-
-mnaio_pxe_distro_packages:
-  - tftpd-hpa
-  - inetutils-inetd
-  - nginx
-  - p7zip-full
-
-mnaio_dhcp_distro_packages:
-  - isc-dhcp-server
-
-mnaio_pkg_cache_server_distro_packages:
-  - apt-cacher-ng
-
-mnaio_host_iptables_service: "{{ (ansible_distribution | lower + '-' + ansible_distribution_version | lower == 'ubuntu-14.04') | ternary('iptables-persistent', 'netfilter-persistent') }}"
-
-ssh_service_name: ssh
diff --git a/multi-node-aio/playbooks/vars/ubuntu.yml b/multi-node-aio/playbooks/vars/ubuntu.yml
index 5d2d04e3..6152a8f5 100644
--- a/multi-node-aio/playbooks/vars/ubuntu.yml
+++ b/multi-node-aio/playbooks/vars/ubuntu.yml
@@ -17,10 +17,18 @@ mnaio_host_required_distro_packages:
   - ubuntu-cloud-keyring
 
 mnaio_host_package_repos:
+  - repo: "deb http://ubuntu-cloud.archive.canonical.com/ubuntu {{ ansible_lsb.codename }}-updates/mitaka main"
+    state: present
+    filename: "uca"
+    condition: "{{ ansible_lsb.codename == 'trusty' }}"
   - repo: "deb http://ubuntu-cloud.archive.canonical.com/ubuntu {{ ansible_lsb.codename }}-updates/queens main"
     state: present
     filename: "uca"
     condition: "{{ ansible_lsb.codename == 'xenial' }}"
+  - repo: "deb http://ubuntu-cloud.archive.canonical.com/ubuntu {{ ansible_lsb.codename }}-updates/rocky main"
+    state: present
+    filename: "uca"
+    condition: "{{ ansible_lsb.codename == 'bionic' }}"
 
 mnaio_host_distro_packages:
   - bridge-utils
@@ -32,7 +40,6 @@ mnaio_host_distro_packages:
   - openssh-server
   - python2.7
   - python-lxml
-  - python-software-properties
   - qemu-kvm
   - qemu-utils
   - software-properties-common
@@ -52,6 +59,6 @@ mnaio_dhcp_distro_packages:
 mnaio_pkg_cache_server_distro_packages:
   - apt-cacher-ng
 
-mnaio_host_iptables_service: "{{ (ansible_distribution | lower + '-' + ansible_distribution_version | lower == 'ubuntu-14.04') | ternary('iptables-persistent', 'netfilter-persistent') }}"
+mnaio_host_iptables_service: "{{ (ansible_lsb.codename == 'trusty') | ternary('iptables-persistent', 'netfilter-persistent') }}"
 
 ssh_service_name: ssh