From 160da969731fe7058d4ffe67facd6230ac455033 Mon Sep 17 00:00:00 2001 From: abregman Date: Fri, 11 Jan 2019 18:47:56 +0200 Subject: [PATCH] InfraRed Integration Skeleton Make Tobiko an InfraRed plugin for simple and fine-grained executions (both personal and in CI/CD environments). This patch add a plugin spec, main entry playbook and several tasks for basic config & run execution. Change-Id: Ifcff4d79b4c920c28cc8170c4b8a8e9821c7b70d --- infrared/main.yml | 11 +++++++ infrared/plugin.spec | 15 +++++++++ infrared/tasks/configure.yml | 12 +++++++ infrared/tasks/install.yml | 37 ++++++++++++++++++++++ infrared/tasks/run.yml | 11 +++++++ infrared/tasks/templates/os-faults.yaml.j2 | 35 ++++++++++++++++++++ 6 files changed, 121 insertions(+) create mode 100644 infrared/main.yml create mode 100644 infrared/plugin.spec create mode 100644 infrared/tasks/configure.yml create mode 100644 infrared/tasks/install.yml create mode 100644 infrared/tasks/run.yml create mode 100644 infrared/tasks/templates/os-faults.yaml.j2 diff --git a/infrared/main.yml b/infrared/main.yml new file mode 100644 index 000000000..e33e16887 --- /dev/null +++ b/infrared/main.yml @@ -0,0 +1,11 @@ +- name: Install Tobiko + import_playbook: tasks/install.yml + +- name: Set up os-faults configuration + import_playbook: tasks/configure.yml + +- name: Run Tobiko + import_playbook: tasks/run.yml + when: + - test.tests is defined + - test.tests diff --git a/infrared/plugin.spec b/infrared/plugin.spec new file mode 100644 index 000000000..94f5dbf48 --- /dev/null +++ b/infrared/plugin.spec @@ -0,0 +1,15 @@ +--- +config: + plugin_type: test + +subparsers: + tobiko: + description: Tobiko Options + include_groups: ["Ansible options", "Inventory", "Common options", "Answers file"] + groups: + - title: Testing Parameters + options: + tests: + type: Value + help: | + Group of tests to execute diff --git a/infrared/tasks/configure.yml b/infrared/tasks/configure.yml new file mode 100644 index 000000000..1c0c520cb --- /dev/null +++ b/infrared/tasks/configure.yml @@ -0,0 +1,12 @@ +--- +- name: Generate os-faults configuration + hosts: undercloud + any_errors_fatal: true + gather_facts: yes + + tasks: + - name: Create os-faults configuration file + template: + src: "templates/os-faults.yaml.j2" + dest: "~/os-faults.yaml" + mode: 0755 diff --git a/infrared/tasks/install.yml b/infrared/tasks/install.yml new file mode 100644 index 000000000..f31e6b265 --- /dev/null +++ b/infrared/tasks/install.yml @@ -0,0 +1,37 @@ +--- +- name: Install Tobiko + hosts: undercloud + any_errors_fatal: true + gather_facts: yes + + tasks: + - name: Install required packages + become: yes + yum: + name: "{{ item }}" + state: present + with_items: + - 'python-virtualenv' + - 'git' + + - name: Clone Tobiko project + git: + repo: 'https://github.com/rhos-infra/tobiko' + dest: "~/tobiko" + + - name: Create Virtualenv + pip: + virtualenv: "~/tobiko_venv" + name: "{{ item }}" + state: latest + with_items: + - pip + - setuptools + - pbr + + - name: Install Tobiko + pip: + chdir: "~/tobiko" + virtualenv: "~/tobiko_venv" + name: "." + editable: true diff --git a/infrared/tasks/run.yml b/infrared/tasks/run.yml new file mode 100644 index 000000000..6fb5c5226 --- /dev/null +++ b/infrared/tasks/run.yml @@ -0,0 +1,11 @@ +--- + +- name: Run Tobiko + hosts: undercloud + any_errors_fatal: true + gather_facts: no + tasks: + + - name: Run Tobiko Tests + shell: | + tobiko -e {{ test.tests }} diff --git a/infrared/tasks/templates/os-faults.yaml.j2 b/infrared/tasks/templates/os-faults.yaml.j2 new file mode 100644 index 000000000..e55350dfc --- /dev/null +++ b/infrared/tasks/templates/os-faults.yaml.j2 @@ -0,0 +1,35 @@ +cloud_management: + driver: universal + +node_discover: + driver: node_list + args: +{% for host_name in groups.overcloud_nodes|sort %} + - fqdn: {{ host_name }} + ip: {{ hostvars[host_name]['ansible_host'] }} + auth: + username: heat-admin + private_key_file: /home/stack/.ssh/id_rsa + become: true +{% endfor %} + +services: + openvswitch: + driver: system_service + args: + service_name: openvswitch + grep: openvswitch + +containers: + neutron_ovs_agent: + driver: docker_container + args: + container_name: neutron_ovs_agent + neutron_metadata_agent: + driver: docker_container + args: + container_name: neutron_metadata_agent + neutron_api: + driver: docker_container + args: + container_name: neutron_api