I've got a problem with providing a value via extra vars when I run my playbook using:
ansible-playbook gitolite-docker.yml -e "GITOLITE_SSH_KEY=$(cat roles/gitolite-docker/files/john_rsa.pub)" --ask-vault-pass
Here is the extract of the gitolite-docker.yml
- name: logging admin.pub
  shell: echo "{{GITOLITE_SSH_KEY}}" > /home/ansusersu/gitoliteadmin.pub
- name: create gitolite--docker container
  docker_container: 
    name: gitolite
    image: alex2357/docker-gitolite
    state: started
    ports:
      - "8081:22"
    volumes:
      - "/docker/volumes/gitoliterepositories:/home/git/repositories"
    env:
      SSH_KEY: "{{GITOLITE_SSH_KEY}}"
      KEEP_USERS_KEYS: "dummytext"      
  become: yes 
The problem is that I get only first few characters "ssh-rsa" from the SSH key.
john@john-VirtualBox:~$ sudo cat /home/ansusersu/gitoliteadmin.pub
ssh-rsa
john@john-VirtualBox:~$ 
I get exactly the same value in both usages of {{GITOLITE_SSH_KEY}}. In the Docker container I have exactly the same value in log files.
For Docker similar line works fine:
docker run -d -p 8081:22 --name gitolite -e SSH_KEY="$(cat ~/.ssh/id_rsa.pub)" -v /docker/volumes/gitoliterepositories:/home/git/repositories alex2357/docker-gitolite
When I saw that it seems to me I won't be able to achieve the same behavior with Ansible-playbook as with Docker as it considers the remaining staff as another extra var. Is there way to make it work?
 
     
    