Repository: openshift/openshift-ansible

Issue:
Any chance of getting this playbook to work without cinder ? 
#### Description

Provide a brief description of your issue here. For example:

We have access to an openstack without cinder. Any chance of getting this playbook to work without cinder ? 



##### Version

Please put the following version information in the code block
indicated below.

* Your ansible version per `ansible --version`

If you're operating from a **git clone**:

* The output of `git describe`


If you're running from playbooks installed via RPM or
`atomic-openshift-utils`

* The output of `rpm -q atomic-openshift-utils openshift-ansible`

Place the output between the code block below:

```
$ ansible --version
ansible 2.5.0
  config file = /home/arthur/local/openshift/ansible.cfg
  configured module search path = [u'/home/arthur/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-packages/ansible
  executable location = /home/arthur/.virtualenvs/ansible/bin/ansible
  python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]

$ git describe
openshift-ansible-3.10.0-0.15.0-9-gf28aba492
```

##### Steps To Reproduce

When I saw the following comment in all.yml 
```
# If you want to use the VM storage instead of Cinder volumes, set this to `true`.
```
I thought this might be possible but I get the following error when executing the ansible playbook : 

```
$ ansible-playbook [snip]
[snip]
 in endpoint_data_for     raise
exceptions.EndpointNotFound(msg) keystoneauth1.exceptions.catalog.EndpointNotFound: public
endpoint for volumev2 service in RegionOne region not found
[snip]
$ openstack volume list
public endpoint for volumev2 service in RegionOne region not found

```




Discussion:
Could you share a bit more of the ansible output? I'm afraid you've snipped too much. Which task was this failing on?

Assuming the option you set was `openshift_openstack_ephemeral_volumes: true`, that should work, but I don't have an OpenStack without Cinder at the moment.
Here is the full log : 

```
 [WARNING]:  * Failed to parse /home/arthur/local/openshift/openshift-ansible/playbooks/openstack/inventory.py with
script plugin: Inventory script (/home/arthur/local/openshift/openshift-ansible/playbooks/openstack/inventory.py) had
an execution error: Traceback (most recent call last):   File "/home/arthur/local/openshift/openshift-
ansible/playbooks/openstack/inventory.py", line 219, in <module>     print(json.dumps(build_inventory(), indent=4,
sort_keys=True))   File "/home/arthur/local/openshift/openshift-ansible/playbooks/openstack/inventory.py", line 146,
in build_inventory     cloud.list_volumes())   File "/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-
packages/shade/openstackcloud.py", line 1885, in list_volumes     data = self._volume_client.get('/volumes/detail')
File "/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-packages/keystoneauth1/adapter.py", line 304, in get
return self.request(url, 'GET', **kwargs)   File "/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-
packages/shade/_adapter.py", line 154, in request     response = self.manager.submit_task(RequestTask(**kwargs))
File "/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-packages/shade/task_manager.py", line 259, in
submit_task     return self.run_task(task=task, raw=raw)   File "/home/arthur/.virtualenvs/ansible/local/lib/python2.7
/site-packages/shade/task_manager.py", line 270, in run_task     return self._run_task(task, raw=raw)   File
"/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-packages/shade/task_manager.py", line 284, in _run_task
return task.wait(raw)   File "/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-
packages/shade/task_manager.py", line 98, in wait     self._traceback)   File
"/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-packages/shade/task_manager.py", line 109, in run
self.done(self.main(client))   File "/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-
packages/shade/_adapter.py", line 152, in main     return request_method(**self.args)   File
"/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-packages/keystoneauth1/adapter.py", line 189, in request
return self.session.request(url, method, **kwargs)   File "/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-
packages/keystoneauth1/session.py", line 595, in request     **endpoint_filter)   File
"/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-packages/keystoneauth1/session.py", line 942, in
get_endpoint     return auth.get_endpoint(self, **kwargs)   File
"/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-packages/keystoneauth1/identity/base.py", line 379, in
get_endpoint     allow_version_hack=allow_version_hack, **kwargs)   File
"/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-packages/keystoneauth1/identity/base.py", line 278, in
get_endpoint_data     service_name=service_name)   File "/home/arthur/.virtualenvs/ansible/local/lib/python2.7/site-
packages/keystoneauth1/access/service_catalog.py", line 400, in endpoint_data_for     raise
exceptions.EndpointNotFound(msg) keystoneauth1.exceptions.catalog.EndpointNotFound: public endpoint for volumev2
service in RegionOne region not found

 [WARNING]:  * Failed to parse /home/arthur/local/openshift/openshift-ansible/playbooks/openstack/inventory.py with
ini plugin: /home/arthur/local/openshift/openshift-ansible/playbooks/openstack/inventory.py:2: Error parsing host
definition '"""': No closing quotation

 [WARNING]: Unable to parse /home/arthur/local/openshift/openshift-ansible/playbooks/openstack/inventory.py as an
inventory source

 [WARNING]: Unable to parse /home/arthur/local/openshift/inventory as an inventory source

ERROR! No inventory was parsed, please check your configuration and options.

```
@tomassedovic thanks for the prompt response

Resolving patch:
diff --git a/playbooks/openstack/inventory.py b/playbooks/openstack/inventory.py
--- a/playbooks/openstack/inventory.py
+++ b/playbooks/openstack/inventory.py
@@ -13,6 +13,7 @@
 import json
 import os
 
+from keystoneauth1.exceptions.catalog import EndpointNotFound
 import shade
 
 
@@ -141,9 +142,14 @@ def build_inventory():
 
     inventory['_meta'] = {'hostvars': {}}
 
+    # Some clouds don't have Cinder. That's okay:
+    try:
+        volumes = cloud.list_volumes()
+    except EndpointNotFound:
+        volumes = []
+
     # cinder volumes used for docker storage
-    docker_storage_mountpoints = get_docker_storage_mountpoints(
-        cloud.list_volumes())
+    docker_storage_mountpoints = get_docker_storage_mountpoints(volumes)
     for server in cluster_hosts:
         inventory['_meta']['hostvars'][server.name] = _get_hostvars(
             server,


Test patch: