Gitlab ci/cd with ansible

Hello,

Forgive for my bad english. I have some trouble to run gitlab with ansible.
I have a job that execute ansible-playbook to delivers new versions of system’s configurations files.

Actually, the job is running well, just because the private ssh key is integrated in ansible playbook:
private_key_file = ./sshkey

And the sshkey file contains the private sshkey.

I’d like to add a gitlab variable containing this key. When I create the sshkey file, I can see that they is in the begining of each line starting at the second line a space character. So ansible crashes with:
"fatal: [utopia]: UNREACHABLE! => {"changed": false, "msg": "not a valid RSA private key file", "unreachable": true}"

$ cat /root/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
 MIIEpAIBAAKCAQEAtAImzYLIsZsPONprVVoBOvKlU63jR9nTYek1k00x0f1AQt7x
 bL6YPBKla3XZOgUdRabIS+jjfliLYPNDwZr5D4l6fsUla9d4Io1yMjIpZcT14MJX
 Ab45Syvg3fWOMSMqSA6ikEc0VlPw0VA5qzcnk+x0OmRxLnHXBu6e40ncxawiiDtV
 qffqHFH8G4iA9OP76nCzorI9jEU4E+Cw7PK0RuR8EXjEmbxMheBcv2EqguCGIQ0K

Is there a way to solve this ? Thanks.

it is solved:
echo $SSH_PRIVATE_KEY | tr -d '\r'