Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Commit

Permalink
RHV provider can be added using env vars
Browse files Browse the repository at this point in the history
Change-Id: I01c7d3453d67a95611412967d11c8ca31160e17b
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1613914
Signed-off-by: Ondra Machacek <omachace@redhat.com>
  • Loading branch information
machacekondra committed Sep 4, 2018
1 parent 9e1fdd0 commit cab89d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 12 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
---
- block:
## Initialize authentication parameters:
- set_fact:
engine_url: "{{ 'https://' ~engine_fqdn | default(lookup('env', 'OVIRT_HOSTNAME')) ~ '/ovirt-engine/api' }}"
when: engine_fqdn is defined or lookup('env', 'OVIRT_HOSTNAME')

- set_fact:
engine_user: "{{ engine_user | default(lookup('env', 'OVIRT_USERNAME')) }}"
engine_password: "{{ engine_password | default(lookup('env', 'OVIRT_PASSWORD')) }}"
engine_url: "{{ engine_url | default(lookup('env', 'OVIRT_URL')) }}"
engine_cafile: "{{ engine_cafile | default(lookup('env', 'OVIRT_CAFILE')) }}"

- name: Login to oVirt engine
ovirt_auth:
username: "{{ engine_user | default(lookup('env', 'OVIRT_USERNAME')) | default(omit) }}"
password: "{{ engine_password | default(lookup('env', 'OVIRT_PASSWORD')) | default(omit) }}"
url: "{{ engine_url | default(lookup('env', 'OVIRT_URL')) | default(omit) }}"
ca_file: "{{ engine_cafile | default(lookup('env', 'OVIRT_CAFILE')) | default(omit) }}"
insecure: "{{ engine_cafile is undefined }}"
username: "{{ engine_user }}"
password: "{{ engine_password }}"
url: "{{ engine_url }}"
ca_file: "{{ engine_cafile }}"
insecure: "{{ engine_cafile == '' }}"
when: ovirt_auth is undefined or not ovirt_auth
register: loggedin
tags:
Expand Down
4 changes: 2 additions & 2 deletions templates/add_rhv_provider.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"port": "{{ engine_url | urlsplit('port') }}",
{% endif %}
{% endif %}
"verify_ssl": {{ engine_cafile is defined }},
{% if engine_cafile is defined %}
"verify_ssl": {{ engine_cafile != '' }},
{% if engine_cafile != '' %}
"certificate_authority": {{ lookup('file', engine_cafile) | to_json }}
{% endif %}
},
Expand Down

0 comments on commit cab89d8

Please sign in to comment.