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: roles:
- users - users
- base-repos - base-repos
# Split into two plays so that the update apt cache handler fires
# before we run base-server
- hosts: "!disabled"
roles:
- base-server - base-server

View File

@ -3,6 +3,13 @@ copy_puppet: true
manifest: /opt/system-config/production/manifests/site.pp manifest: /opt/system-config/production/manifests/site.pp
manifest_base: /opt/system-config manifest_base: /opt/system-config
puppet_logdest: syslog 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: puppet:
logdest: syslog logdest: syslog

View File

@ -1,6 +1,9 @@
- name: Set up additional repos - name: Set up additional repos
include_tasks: "{{ lookup('first_found', file_list) }}" include_tasks: "{{ item }}"
vars: vars:
file_list: params:
- "{{ ansible_facts.distribution }}.yaml" files:
- "{{ ansible_facts.os_family }}.yaml" - "{{ 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 bastion_ipv6: 2001:4800:7818:101:3c21:a454:23ed:4072,2001:4800:7817:103:be76:4eff:fe04:5a1d
base_packages: base_packages:
- at - at
- emacs-nox
- git - git
- lvm2 - lvm2
- parted - parted
@ -10,5 +9,4 @@ base_packages:
- rsyslog - rsyslog
- strace - strace
- tcpdump - tcpdump
- vim-nox
- wget - wget

View File

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

View File

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

View File

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

View File

@ -1,9 +1,11 @@
- distro_packages: distro_packages:
- bind-utils - bind-utils
- emacs-nox
- iputils - iputils
# Utils in ntp-perl are included in Debian's ntp package; we # Utils in ntp-perl are included in Debian's ntp package; we
# add it here for consistency. See also # add it here for consistency. See also
# https://tickets.puppetlabs.com/browse/MODULES-3660 # https://tickets.puppetlabs.com/browse/MODULES-3660
- ntp-perl - ntp-perl
- ntpdate - ntpdate
- vim-minimal
- yum-cron - 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 - 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"
- name: Include OS-specific tasks
include_tasks: "{{ lookup('first_found', params) }}"
vars: vars:
params: params:
files: files: "{{ distro_lookup_path }}"
- "{{ ansible_facts.distribution }}.{{ ansible_facts.lsb.codename }}.{{ ansible_facts.architecture }}.yaml" paths:
- "{{ ansible_facts.distribution }}.{{ ansible_facts.architecture }}.yaml" - 'vars'
- "{{ ansible_facts.distribution }}.yaml"
- "{{ ansible_facts.os_family }}.yaml" - name: Include OS-specific tasks
include_tasks: "{{ item }}"
vars:
params:
files: "{{ distro_lookup_path }}"
skip: true skip: true
loop: "{{ query('first_found', params) }}"
- name: Install Exim - name: Install Exim
package: package: