openstack-ansible-os_barbican/tests/test-barbican-functional.yml

56 lines
1.8 KiB
YAML

---
# Copyright 2016, 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 writing, 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.
- name: Playbook for functional testing of barbican
hosts: barbican_api
user: root
roles:
- openstack_openrc
post_tasks:
# Packages need to be installed outside
# of venv to be usable by Ansible
- name: Install testing pip packages
pip:
name: "{{ item }}"
state: present
with_items:
- httplib2
- python-barbicanclient
- python-openstackclient
- name: Check the barbican api
uri:
url: "http://localhost:9311"
status_code: 200,300
- name: Create a test secret
shell: |
. /root/openrc
openstack secret store --payload secrete --payload-content-type text/plain
register: barbican_secret_store
- name: Register secret location
set_fact:
secret_ref: "{{ item.split('|')[2] }}"
with_items: "{{ barbican_secret_store.stdout_lines }}"
when: item.find('Secret href') != -1
- name: Retrieve test secret
shell: |
. /root/openrc
openstack secret get --decrypt --payload_content_type text/plain {{ secret_ref }}
register: barbican_secret_store
- name: Check retrieved secret
assert:
that: barbican_secret_store.stdout.find('secrete') != -1
vars_files:
- test-vars.yml