role should not depend on ansible_user variable
Summary
role should not depend on ansible_user variable
Steps to reproduce
try to use install_base
action without using ansible_user on host (using same user as local user)
Expected behavior
docker should install successfully and give user access to docker
Actual behavior
docker fail on adding access for user
Relevant logs and/or screenshots
TASK [docker : giving {{ ansible_user }} access to docker] ********************************************************************************************************
Friday 16 February 2018 09:26:33 +0100 (0:00:03.503) 0:03:23.212 *******
fatal: [baremetal]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible_user' is undefined\n\nThe error appears tohave been in '/all/Admin/TASK/projects/task-cloud/baremetal-manager/roles_external/docker/tasks/install_base_configuration.yml': line 29, 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: \"giving {{ ansible_user }} access to docker\"\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n with_items:\n - {{ foo }}\n\nShould be written as:\n\n with_items:\n - \"{{ foo }}\"\n\nexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>\nexception: 'ansible_user' is undefined"}
Possible fixes
swap ansible_user
to ansible_user_id
which is populated in any case