Bug 1469494 - Failed to get value from file of vars_files
Failed to get value from file of vars_files
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: python-shade (Show other bugs)
rawhide
All Linux
unspecified Severity high
: ---
: ---
Assigned To: Lars Kellogg-Stedman
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-11 07:55 EDT by kwsk
Modified: 2017-07-11 09:48 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-07-11 09:48:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description kwsk 2017-07-11 07:55:08 EDT
Description of problem:

Failed to get value from vars_files of ansible

Version-Release number of selected component (if applicable):
ansible: 2.3.1.0
python-shade: 1.22.2 

How reproducible:

Steps to Reproduce:

1.Prepare credential yaml file (openrc.yml) for OpenStack. eg

OS_AUTH_URL: https://test-tenant:5000/v2.0
OS_TENANT_ID: c6ca0969da0141e3a62e23eccab4a190
OS_TENANT_NAME: "test-tenant"
OS_USERNAME: 'user'
OS_PASSWORD: 'password'

2.Define external variable file in playbook 

vars_files:
 -  "{{ playbook_dir }}/env/openrc.yml"

3.ansible-playbook execute

Actual results:

Although OS_* values are set, It failed to execute command. 

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_kC8ycr/ansible_module_os_server.py", line 648, in <module>
    main()
  File "/tmp/ansible_kC8ycr/ansible_module_os_server.py", line 633, in main
    cloud = shade.openstack_cloud(**cloud_params)
  File "/usr/lib/python2.7/site-packages/shade/__init__.py", line 109, in openstack_cloud
    cloud_config = config.get_one_cloud(**kwargs)
  File "/usr/lib/python2.7/site-packages/os_client_config/config.py", line 1071, in get_one_cloud
    auth_plugin = loader.load_from_options(**config['auth'])
  File "/usr/lib/python2.7/site-packages/keystoneauth1/loading/base.py", line 162, in load_from_options
    raise exceptions.MissingRequiredOptions(missing_required)
keystoneauth1.exceptions.auth_plugins.MissingRequiredOptions: Auth plugin requires parameters which were not given: auth_url

fatal: [test.srv]: FAILED! => {
    "changed": false,
    "failed": true,
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_kC8ycr/ansible_module_os_server.py\", line 648, in <module>\n    main()\n  File \"/tmp/ansible_kC8ycr/ansible_module_os_server.py\", line 633, in main\n    cloud = shade.openstack_cloud(**cloud_params)\n  File \"/usr/lib/python2.7/site-packages/shade/__init__.py\", line 109, in openstack_cloud\n    cloud_config = config.get_one_cloud(**kwargs)\n  File \"/usr/lib/python2.7/site-packages/os_client_config/config.py\", line 1071, in get_one_cloud\n    auth_plugin = loader.load_from_options(**config['auth'])\n  File \"/usr/lib/python2.7/site-packages/keystoneauth1/loading/base.py\", line 162, in load_from_options\n    raise exceptions.MissingRequiredOptions(missing_required)\nkeystoneauth1.exceptions.auth_plugins.MissingRequiredOptions: Auth plugin requires parameters which were not given: auth_url\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE",
    "rc": 0
}

After hostvars environment set, It succeed

Expected results:

I think shade should set variable from vars_files

Additional info:
Comment 1 Lars Kellogg-Stedman 2017-07-11 09:48:15 EDT
This appears to be an ansible issue, not a shade issue. 

The os_server module doesn't look for *ansible* variables named OS_*, it looks for *environment* variables named OS_AUTH_URL, etc.  Otherwise, you need to provide the module with authentication information in the 'auth' parameter.

Alternatively, you can place your authentication in clouds.yaml file and use the 'cloud' parameter to the module.

This information is available in the documentation for the os_server module at http://docs.ansible.com/ansible/os_server_module.html.

Note You need to log in before you can comment on or make changes to this bug.