Trellis server setup fail at github-ssh-keys

I’m having an issue with trellis server provisioning.
See error below:

TASK: [github-ssh-keys | Get GitHub SSH keys] ********************************* 
skipping: [] => (item=github_ssh_keys)

TASK: [github-ssh-keys | Add SSH keys] **************************************** 
fatal: [] => subelements lookup expects a list of two items, first a dict or a list, and second a string

FATAL: all hosts have already failed -- aborting

Anyone know how to fix this?

What does your group_vars file look like where you’ve added your Github SSH key?

here is the content of group_vars/all

apt_cache_valid_time: 86400
mariadb_dist: trusty
mysql_user: root
www_root: /srv/www

mail_user: smtp_user
mail_password: smtp_password

hhvm: false

web_user: web
web_group: www-data
  - "/usr/sbin/service php5-fpm *"

  - user: admin
    groups: [sudo]

  - name: "{{ web_user }}"
      - "{{ web_group }}"
      - "{{ lookup('file', '~/.ssh/') }}"

  - type: dport_accept
    dport: [http, https]
    filename: nginx_accept
  - type: dport_limit
    dport: [ssh]
    seconds: 300
    hits: 20

  - name: wordpress-sites
    path: "{{ www_root }}/**/logs/*.log"
      - weekly
      - maxsize 50M
      - missingok
      - rotate 8
      - compress
      - delaycompress
      - notifempty
      - create 0640 {{ web_user }} {{ web_group }}
      - sharedscripts
      prerotate: |
        if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
              run-parts /etc/logrotate.d/httpd-prerotate; \
            fi \
      postrotate: invoke-rc.d nginx rotate >/dev/null 2>&1

@ebhoren roots/trellis#247 adjusted how ssh keys are loaded, removing the github-ssh-keys role that appears to still be in your project. I’d suggest updating your trellis generally so that it would work with your users list in group_vars/all. But if you don’t want to update, you could define your ssh keys the old way that works with the old github-ssh-keys role.

I recognize that the roots example project hasn’t yet incorporated this updated handling of ssh keys, so it could be confusing. In all the time they’re volunteering to produce free tools, the Roots folks hope to soon develop a tool that updates the example project automatically. For now, it is volunteer manual work.

@fullyint updating Trellis to the latest version resolved my problem. Thank you so much.

Now, i’m having a weird behavior when deploying my changes to my staging server. First, my custom theme located in /web/app/themes/ as not been cloned initially. Also, i can’t find a way to pull my git repo to update the staging server to the repo’s latest commit. How to do this?


What approach did you take to get your theme on the server? There are many potential approaches.

The recommended approach is to have your theme committed to a bedrock project. In this case, when deploy.yml clones the project files, it is cloning your bedrock with theme, from the repo you’ve specified.

As a different approach, perhaps your theme is separate from bedrock and available on your local machine. You could sync it to the remote similar to how the example project lists the theme dist files in project_local_files. In your case, you’d sync the entire theme directory, instead of just dist. If you take this approach, I’d recommend avoiding syncing large unneeded directories like node_modules. Create a file named .rsync-filter at the root of your theme, which lists which files to sync or not (see example).

I’m guessing you’re referring to updating your bedrock repo to the latest commit. With branch: master, your next run of deploy.yml should grab the latest commit from the remote repo (be sure you’ve pushed changes to that remote repo). If it is not pulling the latest, try temporarily setting the branch to the SHA1 of the latest commit, running deploy.yml, then setting it back to master.

If you’re referring to reprovisioning your server using trellis at its latest commit, I think you can just git clone/pull the latest trellis to your local machine, then run the server.yml playbook on the existing staging server. My impression is that recent changes to trellis are mostly just in how the playbook runs, not in the resulting server setup, so your resulting staging server probably wouldn’t change much.

If it fails or you run into trouble, you could copy out your db if you need it, then spin up a totally fresh staging server with the latest trellis, and load up your db.

Thank you so much man. You solved all my problems.
You’re the KING!!

1 Like