Error when trying to provision a production server

Hi guys,

I am trying to provision a production environment but got two errors:

The first one when running trellis provision production is:

PLAY [WordPress Server - Install LEMP Stack with PHP and MariaDB MySQL] ********

TASK [Gathering Facts] *********************************************************
[WARNING]: Unhandled error in Python interpreter discovery for host Failed to connect to the host via ssh: Permission denied (publickey).
fatal: []: UNREACHABLE! => {"changed": false, "msg": "Data could not be sent to remote host \"\". Make sure this host can be reached over ssh: Permission denied (publickey).\r\n", "unreachable": true}

I am not sure how to specify the ssh key to log in into the server. Don’t see any option at trellis/group_vars/production

The second one when running ansible-playbook server.yml -e env=production --key-file=~/.ssh/<SOME_SSH_KEY> is:

TASK [mariadb : Add MariaDB PPA] *******************************************************************************************************
fatal: [<DOMAIN>]: FAILED! => {"changed": false, "msg": "Failed to update apt cache: E:The repository ' kinetic Release' does not have a Release file."}

First error: Did you remember to add the url to your ssh key to group_vars/all/main.yml?

I only ask because I’ve done that before.

Second error is probably a plugin that needs to be added to support Maria DB on Ubuntu. Maybe the url to it got updated.

1 Like

Hi @rguttersohn

I don’t see any URL here, this is the content of that file:

apt_cache_valid_time: 3600
apt_package_state: present
apt_security_package_state: latest
apt_dev_package_state: latest
composer_keep_updated: true
php_version: "8.0"
ntp_timezone: Etc/UTC
ntp_manage_config: true
www_root: /srv/www
max_journal_size: 512M

# Values of raw_vars will be wrapped in `{% raw %}` to avoid templating problems if values include `{%` and `{{`.
# Will recurse dicts/lists. `*` is wildcard for one or more dict keys, list indices, or strings. Example:
#   - vault_wordpress_sites.*.*_salt    -- matches etc.
# Will not function for var names or topmost dict keys that contain a period ('.').
  - vault_mail_password
  - vault_mysql_root_password
  - vault_users.*.password
  - vault_users.*.salt
  - vault_wordpress_env_defaults
  - vault_wordpress_sites

The version of trellis I am using is: v1.19.0

Are you in roles/mariadb/defaults/main.yml?

I have this url there instead:

I believe our prod server is running off Ubuntu 16ish. It might be a different one if you are deploying a server using ubuntu 20+

Ubuntu Kinetic means 22.10.

Trellis only supports LTS releases up to 22.04 (which is Jammy).

@swalkinshaw Understood. I will try that version.

Do you know if I missed something in the first error? Is there a place where I can specify my ssh key to access the server for the first time?

Kind regards,

You need SSH access prior to provisioning your server, per Remote Server Setup | Trellis Docs | Roots

Many hosts like DigitalOcean offer to automatically add your SSH key when creating a server so take advantage of that. Or follow a guide such as this one.

Hi @ben

I created a droplet in Digital Ocean with only ssh access (no password access). But I every time I run trellis provision production, it throws the error of: Permission denied (publickey).

  - name: "{{ web_user }}"
      - "{{ web_group }}"
      - "{{ lookup('file', '~/.ssh/id_rsa', errors='ignore') }}"
      # -
  - name: "{{ admin_user }}"
      - sudo
      - "{{ lookup('file', '~/.ssh/id_rsa', errors='ignore') }}"
      # -

That was the piece the configuration I modified before running the code. I also make sure it works using the command:

ssh root@SERVER_IP -i ~/.ssh/id_rsa

Am I missing something?


I’d suggest seeing if your SSH keys work outside of Trellis:

ssh root@SERVER_IP
ssh web@SERVER_IP

Both of these should connect without asking for a password, and without having to explicitly specify a key.

ssh will automatically try to use your public keys found in your local ~/.ssh/ folder.

1 Like