Closed artis3n closed 4 years ago
I should add that the Molecule Docker container I am using is modified to include an ansible
user with sudo privileges: https://github.com/artis3n/docker-ubuntu1804-ansible/blob/master/Dockerfile#L52
I'm guessing it's a problem with your sudo
configuration. I've changed the Molecule tests to run using a non-privileged user (see #167). Be aware the name of the sudo group varies between Linux distributions (sometimes it's sudo
and others it's wheel
). Be aware you may want to be more selective with the permissions grant to the user/group in the /etc/sudoers
.
Hope that helps.
I appreciate you taking the time to look into it. I'll have to play around with this ubuntu sudo configuration and make sure my Docker image has properly set it up.
...... I updated requirements.yml
to use ansible_user
for the username to this role but did not update my playbook.
roles:
- role: gantsign.visual-studio-code
users:
- username: "{{ ansible_user }}" # <-- this was still set to lookup('env', 'USER')
visual_studio_code_extensions:
- Shan.code-settings-sync
- role: artis3n.bitwarden_app
... well I hate everything but thanks again @freemanjp for looking into it. I still get an error running from a GitHub Actions workflow but now it has to do with missing dependencies in my docker image, that I can work with.
TASK [gantsign.visual-studio-code : install extensions] ************************
failed: [instance] (item=[{'username': 'ansible'}, 'Shan.code-settings-sync']) => {"ansible_loop_var": "item", "changed": false, "item": [{"username": "ansible"}, "Shan.code-settings-sync"], "msg": "Error querying installed extensions [Shan.code-settings-sync]: /usr/share/code/bin/../code: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory\n"}
I don't really think this is an issue with this project but I'm hoping you might provide some guidance.
I am Molecule-izing a large playbook to get it to run a full CI inside a GitHub Action workflow. Regardless of whether I run it locally or on the workflow, I need to get the Molecule Docker container running first with privilege and then as a non-root "ansible" user for this extension to work. I do so here and have the username for this role set in
requirements.yml
here:However, when I run Molecule on my local system or on a GitHub Actions workflow I get an error at:
For the GitHub Workflow I get the same error for the user
runner
.I've tried modifying the
ansible_user
viamolecule.yml
:and my
playbook.yml
:But it looks like
ansible_user
isn't correctly being set when the roles are run. Or, maybe there is something else happening in your role that I am completely missing? This should correspond to this:which suggests it should be accepting my modified
ansible_user
asansible
.Do you have any suggestions how I might continue to troubleshoot this?