73 lines
2.4 KiB
YAML
73 lines
2.4 KiB
YAML
---
|
|
- name: Ensure a test project exists
|
|
hosts: controllers[0]
|
|
vars:
|
|
# Dict of quotas to set for the test project.
|
|
test_project_quotas:
|
|
cores: -1
|
|
floating_ips: -1
|
|
injected_files: -1
|
|
injected_file_size: -1
|
|
instances: -1
|
|
key_pairs: -1
|
|
fixed_ips: -1
|
|
ram: -1
|
|
secgroup_rules: -1
|
|
secgroups: -1
|
|
test_ssh_private_key_path: "{{ ansible_env.PWD ~ '/.ssh/id_rsa' }}"
|
|
test_ssh_public_key_path: "{{ test_ssh_private_key_path ~ '.pub' }}"
|
|
test_ssh_key_type: rsa
|
|
|
|
pre_tasks:
|
|
- name: Validate OpenStack password authentication parameters
|
|
fail:
|
|
msg: >
|
|
Required OpenStack authentication parameter {{ item }} is
|
|
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
|
|
in openstack_auth. Have you sourced the environment file?
|
|
when:
|
|
- "{{ openstack_auth_type == 'password' }}"
|
|
- "{{ item not in openstack_auth or not openstack_auth[item] }}"
|
|
with_items: "{{ openstack_auth_password_required_params }}"
|
|
tags:
|
|
- config-validation
|
|
|
|
- name: Check whether an SSH key exists on the controller
|
|
stat:
|
|
path: "{{ test_ssh_private_key_path }}"
|
|
get_checksum: False
|
|
get_md5: False
|
|
mime: False
|
|
register: ssh_key_stat
|
|
|
|
- name: Generate an SSH key on the controller
|
|
command: ssh-keygen -t {{ test_ssh_key_type }} -N '' -f {{ test_ssh_private_key_path }}
|
|
when: not ssh_key_stat.stat.exists
|
|
|
|
- name: Read the SSH public key on the controller
|
|
slurp:
|
|
src: "{{ test_ssh_public_key_path }}"
|
|
register: ssh_public_key
|
|
|
|
roles:
|
|
- role: stackhpc.os-projects
|
|
os_projects_venv: "{{ virtualenv_path }}/shade"
|
|
os_projects_auth_type: "{{ openstack_auth_type }}"
|
|
os_projects_admin_auth: "{{ openstack_auth }}"
|
|
os_projects:
|
|
- name: test-project
|
|
description: Kayobe test project
|
|
project_domain: default
|
|
user_domain: default
|
|
users:
|
|
- name: test-user
|
|
password: test-password
|
|
roles:
|
|
- admin
|
|
- heat_stack_owner
|
|
openrc_file: "{{ kayobe_config_path }}/test-user-openrc.sh"
|
|
keypairs:
|
|
- name: test-keypair
|
|
public_key: "{{ ssh_public_key.content | b64decode }}"
|
|
quotas: "{{ test_project_quotas }}"
|