Roots Discourse

Help Deploying Trellis with Bitbucket Pipelines

Hey I was wondering if anyone has successfully deployed their trellis site using bitbucket pipelines? I’m having trouble figuring it out. Here is my pipeline file.

pipelines:
  default:
    - step:
      image: python:2.7
      name: Build
      script:
        - pip install ansible
        - cd ./trellis
        - ansible-galaxy install -r requirements.yml
        - ansible-playbook deploy.yml -i hosts/staging -e env=staging -e site=smartsmiledentistry.com --limit=kinsta_staging
1 Like

Good start! What’s stopping you from making more progress?

Hey @benword thanks for getting back.

The error I’m getting is this.

The field 'environment' has an invalid value, which includes an undefined variable. The error was: 
'ssh_args_default' is undefined

I’m having a hard time figuring out what that error is. It’s worth noting that I can ssh into kinsta from the pipeline script just fine.

The task it’s failing in is this one.

TASK [connection : Check whether Ansible can connect as testssd] ***************

Alright I figured it out!!! :duck:

So for anyone else that has this issue, you need to set the correct file permissions for the folder your running your ansible-playbook script from, as according to this article. https://medium.com/@andrewhowdencom/the-curious-case-of-sudden-ansible-build-failures-eef1cf9ad1d0

Here’s my updated pipelines file that works.

pipelines:
  default:
    - step:
        image: python:2.7
        name: Build
        caches:
          - pip
        script:
          - pip install ansible
          - chmod 700 /opt/atlassian/pipelines/agent/build
          - chmod 700 /opt/atlassian/pipelines/agent/build/trellis
          - cd ./trellis
          - ansible-galaxy install -r requirements.yml
          - ansible-playbook deploy.yml -i hosts/staging -e env=staging -e site=smartsmiledentistry.com -- limit=kinsta_staging
6 Likes

Thanks for the tips on file permissions, that has given me much nicer error logs now!

I am having an issue with TASK [deploy : Failed connection to remote repo], specifically it can’t access the repo.

The repo is the same (private) repo the Pipeline is running in. I have added the pipeline’s SSH key to the repo’s Access Keys which I hoped would solve it.

Anyone have any ideas on how to get this part working?