Skip to content
Discussion options

You must be logged in to vote

If you have to use {{ ansible_env.USER }}, both work for your case.

  1. Try "{{ ansible_facts.user_id }}" in your role.
  2. Add an environment variable(USER: root) in molecule.yml as below.
---
dependency:
  name: galaxy
driver:
  name: docker
platforms:
  - name: instance
    image: xxx
    # image: x
    pre_build_image: true
    env:
      USER: root

When I run the same playbook in my machine it gets the user. Does anyone know the reason for this difference?

It's because the ansible connection is different.

When you run playbook in real target server, the connection plugin must be ssh while when in molecule with docker plugin, the connection is community.docker.docker. By default, the user…

Replies: 0 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@catarse-natural
Comment options

@staticdev
Comment options

Comment options

You must be logged in to vote
3 replies
@staticdev
Comment options

@zhan9san
Comment options

@staticdev
Comment options

Answer selected by staticdev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
docker
Labels
None yet
3 participants