Key format for deployement using bitbucket

Hello folks,

I’m learning how to deploy following the tutorial from Jason Lengstorf
Automatic WordPress Deployment + Free SSL: Trellis How-To.
Running into an issue configuring trellis/group_vars/all/users.yml


as I’m using bitbucket I tried
https://bitbucket.org/api/1.0/users/mybitbucketusername/ssh-keys and
https://bitbucket.org/api/1.0/users/<my bitbucket username>/ssh-keys
but it’s throwing me this error
error
Could someone point me in the right direction to solve this issue ?
Thank you.

I’m not sure if anyone has figured this out yet, I think you’d need to authenticate that request.

Any chance you could add the same SSH key you have on BitBucket to an account on GitHub? You could also reference a local file, or add your public key to the your repo and reference it like that:

      - "{{ lookup('file', 'keys/example.pub') }}" # This references trellis/keys/example.pub

Thank you @ben for your reply,
the noob here didn’t understand what you meant with “You could also reference a local file, or add your public key to the your repo and reference it like that:”
- “{{ lookup(‘file’, ‘keys/example.pub’) }}” # This references trellis/keys/example.pub
but I started from scratch with a public github repo and was able to deploy http://178.128.197.220/.
However, it seems like bootstrap isn’t active but I guess I’ ll make another post in sage for that and not trellis.
On a side note, I would love to know how to proceed to deploy with a bitbucket private repo, if anyone knows how to do it?

I use a different url for bitbucket…
https://api.bitbucket.org/1.0/users/mybitbucketusername/ssh-keys

There’s no tricks to this - just use the BitBucket repo for your repo URL

This is the same URL the OP tried and it requires authentication. Have you figured out how to use this with Trellis?

I reference a local file as suggested and it works fine with Trellis.

  • “{{ lookup(‘file’, ‘~/.ssh/example.pub’) }}”

Thank you both for your replies @ben @blu,

I started again from scratch, cloning the root example project GitHub - roots/roots-example-project.com: Example Roots stack project (Trellis, Bedrock, Sage)
and init it as a bitbucket private repo and try to deploy on digitalocean.
the problem I encounter is not in group_vars/production/wordpress_sites.yml but in
group_vars/all/users/yml.
Mine look like this

Giving me this error when running ansible-playbook server.yml -e env=production

Failed to connect to bitbucket.keys at port 443: [Errno -2] Name or service
not known
failed: [46.101.206.192] (item=[{u’name’: u’admin’, u’groups’: [u’sudo’]}, u’https://@bitbucket.keys’]) => {“changed”: false, “item”: [{“groups”: [“sudo”], “name”: “admin”}, “https://@bitbucket.keys”]}

My question is : how am I suppose to write in users.yml my url to bitbucket account keys ?
I deployed successfully with a repo on github and a url pointing to my github account url key but I’m unsuccessful with bitbucket.

@Tanuki Ignore the GitHub vs BitBucket part of things for keys. Think of https://github.com/username.keys as just a repository of your public SSH keys.

Use https://github.com/username.keys, where username is a GH account that has your public SSH key. This would be the same public key on your BitBucket account.

Then use your BitBucket repo for your repo URL as mentioned above :smiley:

Allright ! Thank you @ben it’s working !
Not sure to understand the reason behind having to use github and not being able to do it only with a bitbucket account but at least it’s working and I can continue on my learning journey.
Thank you again for your help :smiley:

This topic was automatically closed after 42 days. New replies are no longer allowed.