Chandan Kumar 34f030b5a2 Use --non-admin for non admin users in zuul jobs
python-tempestconf-tempest-packstack/devstack-demo zuul job
uses generate-tempestconf-file role to generate tempest.conf.
Since demo is a non-admin user with non-admin user we cannot use
--create option but it was used since it is a bug, so we need to
check for admin/demo user then enable the proper option.

Used Jinja templates for creating tempest configuration script

Create test-demo-user role which prepares resources for a demo
user.
Create generate-accounts-file role, which generates accounts.yaml
file for Tempest needed for running tests as user who doesn't
have persmissions to create resources.

Change-Id: I727a6cfd154cb3f95c33da02440f25ae1765153f
Story: #2001695
Co-Authored-By: Martin Kopec <mkopec@redhat.com>
2018-04-20 21:16:54 +00:00

56 lines
1.7 KiB
YAML

- name: get cloud variables
shell: |
for key in $( set | awk '{FS="="} /^OS_/ {print $1}' ); do unset $key ; done
{{ source_credentials_commands }}
echo -n "clouds: \
{ {{cloudname}}: \
{'auth': \
{ 'auth-url': '$OS_AUTH_URL', \
'username': '$OS_USERNAME', \
'password': '$OS_PASSWORD', \
$(if [ -n "$OS_USER_DOMAIN_NAME" ]; then echo "'user_domain_name': '${OS_USER_DOMAIN_NAME}',"; fi) \
$(if [ -n "$OS_PROJECT_DOMAIN_NAME" ]; then echo "'project_domain_name': '${OS_PROJECT_DOMAIN_NAME}',"; fi) \
'project-name': '${OS_PROJECT_NAME:-$OS_TENANT_NAME}' \
} $(if [ -n "$OS_IDENTITY_API_VERSION" ]; then echo ", 'identity_api_version': '${OS_IDENTITY_API_VERSION}'"; fi) } }"
register: cloud_details
args:
executable: /bin/bash
- debug:
msg: "{{ cloud_details }}"
- name: Remove the file if it exists
become: yes
file:
path: "{{ clouds_file_path | dirname}}"
state: absent
- name: Create directory for clouds.yaml
become: yes
file:
path: "{{ clouds_file_path | dirname}}"
state: directory
mode: 0755
- name: Create clouds.yaml
become: yes
copy:
content: ""
dest: "{{ clouds_file_path }}"
force: yes
mode: 0666
- name: Insert cloud parameters
become: yes
lineinfile:
path: "{{ clouds_file_path }}"
line: "{{ item }}"
with_items:
- "{{ cloud_details.stdout|from_yaml|to_nice_yaml(indent=4) }}"
- name: Cat the created clouds.yaml file
become: yes
shell: |
set -ex
cat {{ clouds_file_path }}