Make integration tests works

Split base playbook into two plays

The update apt-cache handler from base-repos needs to fire before we run
base-server. Split into two plays so that the handler will fire.

Fix use of first_found

For include_vars, using the lookup version of first_found requires being
explicit about the path to search in as well. We also need to use query
together with loop to get skip to work right.

Extract the list of file locations we look for for distro and platform
specific variables into a variable so that we can reuse it instead of
copy-pasta.

The vim package is vim-nox on ubuntu and vim-minimal on debian.

ntpdate only needs to be enabled on boot, it does not need to be
immediately started. At least, that's what the old puppet was doing and
trying to start it immediately breaks centos integration tests.

emacs-nox is emacs23-nox on trusty.

Change-Id: If3db276a5f6a8f76d7ce8635da8d2cbc316af341
Depends-On: https://review.openstack.org/588326
This commit is contained in:
Monty Taylor 2018-08-09 13:35:53 -05:00
parent 57ee42601a
commit d587307aaf
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
10 changed files with 47 additions and 35 deletions

View File

@ -2,4 +2,9 @@
roles:
- users
- base-repos
# Split into two plays so that the update apt cache handler fires
# before we run base-server
- hosts: "!disabled"
roles:
- base-server

View File

@ -3,6 +3,13 @@ copy_puppet: true
manifest: /opt/system-config/production/manifests/site.pp
manifest_base: /opt/system-config
puppet_logdest: syslog
distro_lookup_path:
- "{{ ansible_facts.distribution }}.{{ ansible_facts.lsb.codename }}.{{ ansible_facts.architecture }}.yaml"
- "{{ ansible_facts.distribution }}.{{ ansible_facts.lsb.codename }}.yaml"
- "{{ ansible_facts.distribution }}.{{ ansible_facts.architecture }}.yaml"
- "{{ ansible_facts.distribution }}.yaml"
- "{{ ansible_facts.os_family }}.yaml"
- default.yaml
puppet:
logdest: syslog

View File

@ -1,6 +1,9 @@
- name: Set up additional repos
include_tasks: "{{ lookup('first_found', file_list) }}"
include_tasks: "{{ item }}"
vars:
file_list:
- "{{ ansible_facts.distribution }}.yaml"
- "{{ ansible_facts.os_family }}.yaml"
params:
files:
- "{{ ansible_facts.distribution }}.yaml"
- "{{ ansible_facts.os_family }}.yaml"
skip: true
loop: "{{ query('first_found', params) }}"

View File

@ -2,7 +2,6 @@ bastion_ipv4: 23.253.245.198,23.253.234.219
bastion_ipv6: 2001:4800:7818:101:3c21:a454:23ed:4072,2001:4800:7817:103:be76:4eff:fe04:5a1d
base_packages:
- at
- emacs-nox
- git
- lvm2
- parted
@ -10,5 +9,4 @@ base_packages:
- rsyslog
- strace
- tcpdump
- vim-nox
- wget

View File

@ -7,7 +7,6 @@
service:
name: ntpdate
enabled: yes
state: running
- name: Configure yum cron
copy:
@ -19,4 +18,4 @@
service:
name: yum-cron
enabled: yes
state: running
state: started

View File

@ -5,13 +5,12 @@
loop: '{{ base_packages }}'
- name: Include OS-specific variables
include_vars: "{{ lookup('first_found', file_list) }}"
include_vars: "{{ lookup('first_found', params) }}"
vars:
file_list:
- "{{ ansible_facts.distribution }}.{{ ansible_facts.architecture }}.yaml"
- "{{ ansible_facts.distribution }}.yaml"
- "{{ ansible_facts.os_family }}.yaml"
- "default.yaml"
params:
files: "{{ distro_lookup_path }}"
paths:
- 'vars'
- name: Install distro specific packages
package:
@ -56,8 +55,4 @@
- name: Include OS-specific tasks
include_tasks: "{{ lookup('first_found', file_list) }}"
vars:
file_list:
- "{{ ansible_facts.distribution }}.{{ ansible_facts.lsb.codename }}.{{ ansible_facts.architecture }}.yaml"
- "{{ ansible_facts.distribution }}.{{ ansible_facts.architecture }}.yaml"
- "{{ ansible_facts.distribution }}.yaml"
- "{{ ansible_facts.os_family }}.yaml"
file_list: "{{ distro_lookup_path }}"

View File

@ -1,3 +1,5 @@
distro_packages:
- dnsutils
- emacs-nox
- iputils-ping
- vim-nox

View File

@ -1,9 +1,11 @@
- distro_packages:
distro_packages:
- bind-utils
- emacs-nox
- iputils
# Utils in ntp-perl are included in Debian's ntp package; we
# add it here for consistency. See also
# https://tickets.puppetlabs.com/browse/MODULES-3660
- ntp-perl
- ntpdate
- vim-minimal
- yum-cron

View File

@ -0,0 +1,5 @@
distro_packages:
- dnsutils
- emacs23-nox
- iputils-ping
- vim-nox

View File

@ -1,22 +1,18 @@
- name: Include OS-specific variables
include_vars: "{{ lookup('first_found', file_list) }}"
vars:
file_list:
- "{{ ansible_facts.distribution }}.{{ ansible_facts.architecture }}.yaml"
- "{{ ansible_facts.distribution }}.yaml"
- "{{ ansible_facts.os_family }}.yaml"
- "default.yaml"
- name: Include OS-specific tasks
include_tasks: "{{ lookup('first_found', params) }}"
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts.distribution }}.{{ ansible_facts.lsb.codename }}.{{ ansible_facts.architecture }}.yaml"
- "{{ ansible_facts.distribution }}.{{ ansible_facts.architecture }}.yaml"
- "{{ ansible_facts.distribution }}.yaml"
- "{{ ansible_facts.os_family }}.yaml"
files: "{{ distro_lookup_path }}"
paths:
- 'vars'
- name: Include OS-specific tasks
include_tasks: "{{ item }}"
vars:
params:
files: "{{ distro_lookup_path }}"
skip: true
loop: "{{ query('first_found', params) }}"
- name: Install Exim
package: