Skip to content

Commit

Permalink
Only add defined vars to config file
Browse files Browse the repository at this point in the history
and define multiple services
  • Loading branch information
codenrhoden committed May 10, 2017
1 parent 0afb7db commit 1ccc181
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 73 deletions.
142 changes: 91 additions & 51 deletions templates/config.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,112 @@ rexray:
logLevel: {{ rexray_log_level }}
libstorage:
service: {{ rexray_storage_drivers[0] }}

server:
services:
{% for driver in rexray_storage_drivers %}
{{ driver }}:
driver: {{ driver }}
{% endfor %}
{% if "ebs" in rexray_storage_drivers %}
ebs:
accessKey: {{ rexray_aws_accesskey }}
secretKey: {{ rexray_aws_secretkey }}
region: {{ rexray_aws_region }}
{% if rexray_aws_accesskey is defined %} accessKey: {{ rexray_aws_accesskey }}
{% endif %}
{% if rexray_aws_secretkey is defined %} secretKey: {{ rexray_aws_secretkey }}
{% endif %}
{% if rexray_aws_region is defined %} region: {{ rexray_aws_region }}
{% endif %}
{% endif %}

{% if "efs" in rexray_storage_drivers %}
efs:
accessKey: {{ rexray_aws_accesskey }}
secretKey: {{ rexray_aws_secretkey }}
region: {{ rexray_aws_region }}
{% if rexray_aws_accesskey is defined %} accessKey: {{ rexray_aws_accesskey }}
{% endif %}
{% if rexray_aws_secretkey is defined %} secretKey: {{ rexray_aws_secretkey }}
{% endif %}
{% if rexray_aws_region is defined %} region: {{ rexray_aws_region }}
{% endif %}
{% endif %}

{% if "gce" in rexray_storage_drivers %}
gcepd:
keyfile: {{ rexray_gce_keyfile }}
{% if rexray_gce_keyfile is defined %} keyfile: {{ rexray_gce_keyfile }}
{% endif %}
{% endif %}

{% if "isilon" in rexray_storage_drivers %}
isilon:
endpoint: {{ rexray_isilon_endpoint }}
insecure: {{ rexray_isilon_insecure }}
username: {{ rexray_isilon_username }}
password: {{ rexray_isilon_password }}
volumePath: {{ rexray_isilon_volumePath }}
nfsHost: {{ rexray_isilon_nfsHost }}
{% endif %}

{% if rexray_isilon_endpoint is defined %} endpoint: {{ rexray_isilon_endpoint }}
{% endif %}
{% if rexray_isilon_insecure is defined %} insecure: {{ rexray_isilon_insecure }}
{% endif %}
{% if rexray_isilon_username is defined %} username: {{ rexray_isilon_username }}
{% endif %}
{% if rexray_isilon_password is defined %} password: {{ rexray_isilon_password }}
{% endif %}
{% if rexray_isilon_volumePath is defined %} volumePath: {{ rexray_isilon_volumePath }}
{% endif %}
{% if rexray_isilon_nfsHost is defined %} nfsHost: {{ rexray_isilon_nfsHost }}
{% endif %}
{% endif %}
{% if "cinder" in rexray_storage_drivers %}
cinder:
authURL: {{ rexray_os_authurl }}
userID: {{ rexray_os_userid }}
userName: {{ rexray_os_username }}
password: {{ rexray_os_password }}
tenantID: {{ rexray_os_tenantid }}
tenantName: {{ rexray_os_tenantname }}
domainID: {{ rexray_os_domainid }}
domainName: {{ rexray_os_domainname }}
regionName: {{ rexray_os_regionname }}
availabilityZoneName: {{ rexray_os_availabilityzonename }}
{% endif %}

{% if rexray_os_authurl is defined %} authURL: {{ rexray_os_authurl }}
{% endif %}
{% if rexray_os_userid is defined %} userID: {{ rexray_os_userid }}
{% endif %}
{% if rexray_os_username is defined %} userName: {{ rexray_os_username }}
{% endif %}
{% if rexray_os_password is defined %} password: {{ rexray_os_password }}
{% endif %}
{% if rexray_os_tenantid is defined %} tenantID: {{ rexray_os_tenantid }}
{% endif %}
{% if rexray_os_tenantname is defined %} tenantName: {{ rexray_os_tenantname }}
{% endif %}
{% if rexray_os_domainid is defined %} domainID: {{ rexray_os_domainid }}
{% endif %}
{% if rexray_os_domainname is defined %} domainName: {{ rexray_os_domainname }}
{% endif %}
{% if rexray_os_regionname is defined %} regionName: {{ rexray_os_regionname }}
{% endif %}
{% if rexray_os_availabilityzonename is defined %} availabilityZoneName: {{ rexray_os_availabilityzonename }}
{% endif %}
{% endif %}
{% if "scaleio" in rexray_storage_drivers %}
scaleio:
endpoint: {{ rexray_sio_endpoint }}
insecure: {{ rexray_sio_insecure }}
useCerts: {{ rexray_sio_usecerts }}
userName: {{ rexray_sio_username }}
password: {{ rexray_sio_password }}
systemID: {{ rexray_sio_systemid }}
systemName: {{ rexray_sio_systemname }}
protectionDomainID: {{ rexray_sio_protectiondomainid }}
protectionDomainName: {{ rexray_sio_protectiondomainname }}
storagePoolID: {{ rexray_sio_storagepoolid }}
storagePoolName: {{ rexray_sio_storagepoolname }}
{% endif %}

{% if rexray_sio_endpoint is defined %} endpoint: {{ rexray_sio_endpoint }}
{% endif %}
{% if rexray_sio_insecure is defined %} insecure: {{ rexray_sio_insecure }}
{% endif %}
{% if rexray_sio_usecerts is defined %} useCerts: {{ rexray_sio_usecerts }}
{% endif %}
{% if rexray_sio_username is defined %} userName: {{ rexray_sio_username }}
{% endif %}
{% if rexray_sio_password is defined %} password: {{ rexray_sio_password }}
{% endif %}
{% if rexray_sio_systemid is defined %} systemID: {{ rexray_sio_systemid }}
{% endif %}
{% if rexray_sio_systemname is defined %} systemName: {{ rexray_sio_systemname }}
{% endif %}
{% if rexray_sio_protectiondomainid is defined %} protectionDomainID: {{ rexray_sio_protectiondomainid }}
{% endif %}
{% if rexray_sio_protectiondomainname is defined %} protectionDomainName: {{ rexray_sio_protectiondomainname }}
{% endif %}
{% if rexray_sio_storagepoolid is defined %} storagePoolID: {{ rexray_sio_storagepoolid }}
{% endif %}
{% if rexray_sio_storagepoolname is defined %} storagePoolName: {{ rexray_sio_storagepoolname }}
{% endif %}
{% endif %}
{% if "virtualbox" in rexray_storage_drivers %}
virtualbox:
endpoint: {{ rexray_vbox_endpoint }}
volumePath: {{ rexray_vbox_volume_path }}
userName: {{ rexray_vbox_user }}
password: {{ rexray_vbox_pass }}
tls: {{ rexray_vbox_tls }}
controllerName: {{ rexray_vbox_controller_name }}
localMachineNameOrId: {{ rexray_vbox_machine }}
{% if rexray_vbox_endpoint is defined %} endpoint: {{ rexray_vbox_endpoint }}
{% endif %}
{% if rexray_vbox_volume_path is defined %} volumePath: {{ rexray_vbox_volume_path }}
{% endif %}
{% if rexray_vbox_user is defined %} userName: {{ rexray_vbox_user }}
{% endif %}
{% if rexray_vbox_pass is defined %} password: {{ rexray_vbox_pass }}
{% endif %}
{% if rexray_vbox_tls is defined %} tls: {{ rexray_vbox_tls }}
{% endif %}
{% if rexray_vbox_controller_name is defined %} controllerName: {{ rexray_vbox_controller_name }}
{% endif %}
{% if rexray_vbox_machine is defined %} localMachineNameOrId: {{ rexray_vbox_machine }}
{% endif %}
{% endif %}
44 changes: 22 additions & 22 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ rexray_log_level: warn
rexray_storage_drivers: []

# AWS EC2 Storage Driver
rexray_aws_accesskey: ''
rexray_aws_secretkey: ''
rexray_aws_region: ''
#rexray_aws_accesskey: ''
#rexray_aws_secretkey: ''
#rexray_aws_region: ''

# GCE Storage Driver
rexray_gce_keyfile: ''
#rexray_gce_keyfile: ''

# Isilon Storage Driver
rexray_isilon_endpoint: ''
Expand All @@ -30,28 +30,28 @@ rexray_isilon_nfsHost: ''

# OpenStack Storage Driver
rexray_os_authurl: ''
rexray_os_userid: 0
rexray_os_username: ''
rexray_os_password: ''
rexray_os_tenantid: 0
rexray_os_tenantname: ''
rexray_os_domainid: 0
rexray_os_domainname: ''
rexray_os_regionname: ''
rexray_os_availabilityzonename: ''
#rexray_os_userid: 0
#rexray_os_username: ''
#rexray_os_password: ''
#rexray_os_tenantid: 0
#rexray_os_tenantname: ''
#rexray_os_domainid: 0
#rexray_os_domainname: ''
#rexray_os_regionname: ''
#rexray_os_availabilityzonename: ''

# ScaleIO Storage Driver
rexray_sio_endpoint: ''
rexray_sio_insecure: false
rexray_sio_usecerts: false
#rexray_sio_usecerts: false
rexray_sio_username: ''
rexray_sio_password: ''
rexray_sio_systemid: 0
rexray_sio_systemname: ''
rexray_sio_protectiondomainid: 0
rexray_sio_protectiondomainname: ''
rexray_sio_storagepoolid: 0
rexray_sio_storagepoolname: ''
#rexray_sio_password: ''
#rexray_sio_systemid: 0
#rexray_sio_systemname: ''
#rexray_sio_protectiondomainid: 0
#rexray_sio_protectiondomainname: ''
#rexray_sio_storagepoolid: 0
#rexray_sio_storagepoolname: ''

# Virtual Box Storage Driver
rexray_vbox_endpoint: ''
Expand All @@ -60,4 +60,4 @@ rexray_vbox_pass: ''
rexray_vbox_tls: false
rexray_vbox_volume_path: ''
rexray_vbox_controller_name: SATA
rexray_vbox_machine: ''
#rexray_vbox_machine: ''

0 comments on commit 1ccc181

Please sign in to comment.