Newton AIO fails - pip can't find 'HOME'

Bug #1642012 reported by Michael Gale
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack-Ansible
Won't Fix
Undecided
Unassigned

Bug Description

I am building an AIO instance inside an OpenStack environment, following the instructions from here:
http://docs.openstack.org/developer/openstack-ansible/developer-docs/quickstart-aio.html#quick-aio-build-on-rackspace-cloud

I am using stable/newton branch and have tried master and the latest tag.

I can build a liberty and mitaka AIO without an issue, however newton fails always with the following:

--snip--
/opt/openstack-ansible/tests /opt/openstack-ansible
+ '[' -z '' ']'
+ ansible-playbook bootstrap-aio.yml -i test-inventory.ini

PLAY [Bootstrap the All-In-One (AIO)] ******************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [sshd : Set OS dependent variables] ***************************************
ok: [localhost] => (item=/etc/ansible/roles/sshd/vars/Ubuntu_14.yml)

TASK [sshd : OS is supported] **************************************************
ok: [localhost]

TASK [sshd : Installed] ********************************************************
ok: [localhost] => (item=[u'openssh-server', u'openssh-sftp-server'])

TASK [sshd : Run directory] ****************************************************
ok: [localhost]

TASK [sshd : Configuration] ****************************************************
changed: [localhost]

TASK [sshd : Service enabled and running] **************************************
ok: [localhost]

TASK [sshd : Register that this role has run] **********************************
ok: [localhost]

TASK [pip_install : Gather variables for each operating system] ****************
ok: [localhost] => (item=/etc/ansible/roles/pip_install/vars/ubuntu-14.04.yml)

TASK [pip_install : Create pip config directory] *******************************
[DEPRECATION WARNING]: Skipping task due to undefined Error, in the future this
 will be a fatal error.: 'dict object' has no attribute 'HOME'.
This feature
will be removed in a future release. Deprecation warnings can be disabled by
setting deprecation_warnings=False in ansible.cfg.
fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'item' is undefined\n\nThe error appears to have been in '/etc/ansible/roles/pip_install/tasks/configure.yml': line 16, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Create pip config directory\n ^ here\n"}

NO MORE HOSTS LEFT *************************************************************

RUNNING HANDLER [sshd : reload_sshd] *******************************************

PLAY RECAP *********************************************************************
localhost : ok=9 changed=1 unreachable=0 failed=1
--snip--

tags: added: in-stable-newton
Revision history for this message
Michael Gale (gale-michael) wrote :

Looked like this issue is related to that tasks from here:
/etc/ansible/roles/pip_install/tasks/configure.yml

The var {{ansible_env.HOME}} appears to be missing.

I added the following to the top of configure.yml
debug:
  msg: "{{ansible_env}}"

Here is the output:
--snip--
TASK [pip_install : Debug1] ****************************************************
ok: [localhost] => {
    "msg": {
        "AIO_REPO": "https://git.int.pason.com/scm/srt/openstack_aio_testing.git",
        "ANSIBLE_ACTION_PLUGINS": "/etc/ansible/roles/plugins/action",
        "ANSIBLE_CACHE_PLUGIN": "jsonfile",
        "ANSIBLE_CACHE_PLUGIN_CONNECTION": "/etc/openstack_deploy/ansible_facts",
        "ANSIBLE_CACHE_PLUGIN_TIMEOUT": "86400",
        "ANSIBLE_CALLBACK_PLUGINS": "/etc/ansible/roles/plugins/callback",
        "ANSIBLE_CONNECTION_PLUGINS": "/etc/ansible/roles/plugins/connection",
        "ANSIBLE_FILTER_PLUGINS": "/etc/ansible/roles/plugins/filter",
        "ANSIBLE_FORCE_COLOR": "true",
        "ANSIBLE_FORCE_HANDLERS": "True",
        "ANSIBLE_GATHERING": "smart",
        "ANSIBLE_GATHER_SUBSET": "network,hardware,virtual",
        "ANSIBLE_HOST_KEY_CHECKING": "False",
        "ANSIBLE_INVENTORY": "/opt/openstack-ansible/playbooks/inventory",
        "ANSIBLE_LIBRARY": "/etc/ansible/roles/plugins/library",
        "ANSIBLE_LOG_PATH": "/openstack/log/ansible-logging/ansible.log",
        "ANSIBLE_LOOKUP_PLUGINS": "/etc/ansible/roles/plugins/lookup",
        "ANSIBLE_RETRY_FILES_ENABLED": "False",
        "ANSIBLE_ROLES_PATH": "/etc/ansible/roles:roles",
        "ANSIBLE_SSH_PIPELINING": "True",
        "ANSIBLE_STRATEGY_PLUGINS": "/etc/ansible/roles/plugins/strategy",
        "ANSIBLE_TIMEOUT": "5",
        "ANSIBLE_TRANSPORT": "ssh",
        "BOOTSTRAP_OPTS": "",
        "BRANCH": "stable/newton",
        "DEPLOY_AIO": "true",
        "INSTANCE": "",
        "JOB": "cloud-config",
        "LANG": "en_US.UTF-8",
        "LC_ALL": "en_US.UTF-8",
        "LC_MESSAGES": "en_US.UTF-8",
        "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin",
        "PREVLEVEL": "N",
        "PWD": "/opt/openstack-ansible/tests",
        "PYTHONUNBUFFERED": "1",
        "REPO": "https://github.com/openstack/openstack-ansible",
        "RESULT": "ok",
        "RUNLEVEL": "2",
        "SHLVL": "2",
        "TERM": "linux",
        "UPSTART_EVENTS": "stopped stopped",
        "UPSTART_INSTANCE": "",
        "UPSTART_JOB": "cloud-final",
        "_": "/opt/ansible-runtime/bin/ansible-playbook"
    }
}

--snip--

Revision history for this message
Michael Gale (gale-michael) wrote :

I managed to get the sample "Quick AIO build on Rackspace Cloud" working:
http://docs.openstack.org/developer/openstack-ansible/developer-docs/quickstart-aio.html#reference-diagram-for-an-aio-build

By adding an "- export HOME=/root" to the runcmd list, obviously this is a hack on my end but it does seem to point out that ansible is missing information ... maybe because it is executed via cloud-init?

Revision history for this message
Jean-Philippe Evrard (jean-philippe-evrard) wrote :

By curiosity, which version of ansible do you have?

In any case we should either
list that we require the HOME to be set in the env variable in the documentation
or have a default in the code as fallback.

Home is quite an often use env variable..., I'm surprised it isn't defined in your shell.

Changed in openstack-ansible:
status: New → Won't Fix
Revision history for this message
Jimmy McCrory (jimmy-mccrory) wrote :

I'm wondering if this is related:
https://github.com/ansible/ansible/pull/18551

There are three environment variables used by ansible that can be overridden until this is merged back to an ansible release.

ANSIBLE_LOCAL_TEMP
ANSIBLE_REMOTE_TEMP
ANSIBLE_SSH_CONTROL_PATH_DIR

Revision history for this message
Michael Gale (gale-michael) wrote :

Here is the output of ansible --version on my newton install:
--snip--
/opt/openstack-ansible# ansible --version
Variable files: "-e @/etc/openstack_deploy/user_ldap.yml -e @/etc/openstack_deploy/user_secrets.yml -e @/etc/openstack_deploy/user_variables.yml "
ansible 2.1.1.0
  config file =
  configured module search path = ['/etc/ansible/roles/plugins/library']
--snip--

I think the problem is there that there is no shell executed by a user, the install is triggered via cloud-init using the suggestion from here:
http://docs.openstack.org/developer/openstack-ansible/developer-docs/quickstart-aio.html#quick-aio-build-on-rackspace-cloud

Sounds like just the docs need to be updated?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.