Prepare tobiko execution in tobiko role

- copy tobiko source files to target host
- provide basic tobiko.conf file with DEFAULT section
- make sure logs dir is writable
- remove obsolete setup tobiko logs dir role

Change-Id: Icff3d8450ce4d84293783d7971f2851f69c00a87
This commit is contained in:
Federico Ressi 2019-11-27 10:09:43 +01:00
parent ad60ab8635
commit 67a4831aba
9 changed files with 93 additions and 47 deletions

View File

@ -29,12 +29,6 @@
become: yes
- name: Setup Tobiko log directories
hosts: all
roles:
- setup_tobiko_logs_dir
- name: Copy the build ssh key to authorized_keys on all hosts for stack
hosts: all
roles:

View File

@ -18,7 +18,3 @@
hosts: tempest
roles:
- role: tobiko
become: true
become_user: stack
vars:
tobiko_dir: /opt/stack/tobiko

View File

@ -1,8 +0,0 @@
Configure tobiko logs directory to be accessible for ``stack`` user.
**Role Variables**
.. zuul:rolevar:: tobiko_logsdir
:default: /opt/stack/tobiko_logs
Name of the directory where Tobiko configs will be stored.

View File

@ -1 +0,0 @@
tobiko_logsdir: "/opt/stack/tobiko_logs"

View File

@ -1,8 +0,0 @@
- name: Ensure logdir exists
become: yes
file:
path: "{{ tobiko_logsdir }}"
state: directory
owner: stack
group: "{{ ansible_user }}"
mode: 0775

View File

@ -1,17 +1,53 @@
---
# Tobiko workflow parameters
tobiko_configure: true
tobiko_check_tools: true
tobiko_run_tests: true
tobiko_run_faults: false
# Remote tobiko directory
tobiko_dir: "~/src/tobiko"
# Tobiko sources tobiko directory
tobiko_source_dir: "{{ role_path | dirname | dirname }}"
tobiko_dir: "{{ ansible_env.HOME }}/src/tobiko"
tobiko_user: "{{ ansible_user }}"
# Logging options
tobiko_debug: True
tobiko_log_file: "{{ tobiko_dir }}/tobiko.log"
# Configuration options
tobiko_conf_file: /etc/tobiko/tobiko.conf
tobiko_conf_options:
- section: DEFAULT
option: debug
value: "{{ tobiko_debug }}"
- section: DEFAULT
option: log_dir
value: "{{ tobiko_log_file | dirname }}"
- section: DEFAULT
option: log_file
value: "{{ tobiko_log_file | basename }}"
# Output directories where tobiko should write to
tobiko_output_dirs:
- "{{ tox_dir }}"
- "{{ tobiko_log_file | dirname }}"
tobiko_become_user: ''
# Python parameteres
python_version: ''
python_command: "{{ tobiko_dir }}/tools/ci/python"
# Tobiko tox parameters
tox_dir: "{{ tobiko_dir }}"
tox_command: "{{ tobiko_dir }}/tools/ci/tox"

View File

@ -0,0 +1,31 @@
---
- name: "Copy tobiko source code to node: {{ tobiko_source_dir }}/* -> {{ tobiko_dir }}"
synchronize:
src: "{{ tobiko_source_dir | realpath }}/."
dest: "{{ tobiko_dir | realpath }}"
use_ssh_args: true
recursive: true
- become: yes
become_user: root
block:
- name: "Provide {{ tobiko_conf_file }} file"
ini_file:
path: "{{ tobiko_conf_file }}"
section: '{{ item.section }}'
option: '{{ item.option }}'
value: '{{ item.value }}'
owner: root
mode: '644'
loop: "{{ tobiko_conf_options }}"
- name: "Ensure Tobiko output directories are writable by {{ tobiko_user }} user"
file:
path: "{{ item | realpath }}"
state: directory
owner: '{{ tobiko_user }}'
mode: '755'
loop: "{{ tobiko_output_dirs | unique }}"

View File

@ -1,9 +1,15 @@
---
- environment:
- become: yes
become_user: "{{ tobiko_user }}"
environment:
PYTHON_VERSION: "{{ python_version }}"
block:
- name: "Configure Tobiko"
when: tobiko_configure | bool
include: configure.yaml
- name: "Check CLI tools"
when: tobiko_check_tools | bool
include: check_tools.yaml
@ -11,19 +17,19 @@
- when: tobiko_run_tests
block:
- name: "Run tests"
when: tobiko_run_tests | bool
include: tasks/run_tests.yaml
- name: "Run tests"
when: tobiko_run_tests | bool
include: tasks/run_tests.yaml
- when: tobiko_run_faults | bool
block:
- when: tobiko_run_faults | bool
block:
- name: "Run faults"
include: run_tests.yaml
vars:
tox_envlist: faults
- name: "Run faults"
include: run_tests.yaml
vars:
tox_envlist: faults
- name: "Run tests after faults"
include: run_tests.yaml
vars:
tox_posargs: "--combine"
- name: "Run tests after faults"
include: run_tests.yaml
vars:
tox_posargs: "--combine"

View File

@ -21,10 +21,6 @@
USE_PYTHON3: true
LOG_COLOR: false
NETWORK_API_EXTENSIONS: address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-domain-ports,dns-integration,dvr,empty-string-filtering,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,filter-validation,fip-port-details,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-bw-minimum-ingress,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-mac-address-regenerate,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-segment,standard-attr-timestamp,standard-attr-tag,subnet_allocation,trunk,trunk-details,uplink-status-propagation
# TOBIKO_KEYSTONE_USERNAME: tobiko
# TOBIKO_KEYSTONE_PASSWORD: secret_tobiko
# TOBIKO_KEYSTONE_PROJECT_NAME: tobiko
TOBIKO_LOG_DIR: '{{ devstack_base_dir }}/tobiko_logs'
devstack_plugins:
heat: https://opendev.org/openstack/heat.git
neutron: https://opendev.org/openstack/neutron.git
@ -75,6 +71,10 @@
log: true
yaml: true
yml: true
tobiko_user: stack
tobiko_dir: /opt/stack/tobiko
tobiko_log_file: /opt/stack/logs/tobiko.log
pre-run: playbooks/tobiko-devstack-pre-run.yaml
run: playbooks/tobiko-devstack-run.yaml
post-run: playbooks/tobiko-devstack-post-run.yaml