Lack of remote server setup variables

After a new trellis install I do vagrant up and works fine. When I try to set up remote server with:

ansible-playbook server.yml -e env=staging

I get:

PLAY [Ensure necessary variables are defined] **********************************

TASK [Ensure environment is defined] *******************************************
skipping: [localhost]

PLAY [Determine Remote User] ***************************************************
skipping: no hosts matched

PLAY [WordPress Server - Install LEMP Stack with PHP 7.0 and MariaDB MySQL] ****
skipping: no hosts matched

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=0   

Seems there is some missing variable. I checked it again and again but found nothing. My hosts/stagingis pointing to a DO droplet. It looks:

[staging]
188.226.213.77

I forget something? Thank you.

The hosts/staging file mentions…

Add each host to the [staging] group and to a “type” group such as [web]

Did you include the [web] group?

[staging]
188.226.213.77

[web]
188.226.213.77

Both group names are needed for the hosts parameter in server.yml to match your host.

1 Like

That was. Fixed!

(20 chars)

1 Like

After that I have another error

TASK [setup] *******************************************************************
fatal: [188.226.213.77]: FAILED! => {"failed": true, "msg": "ERROR! Incorrect sudo password"}

I have gorup_vars/all/users.yml:

admin_user: aitor

# Also define sudoer_passwords in group_vars/<environment>/main.yml
users:
  - name: "{{ web_user }}"
    groups:
      - "{{ web_group }}"
    keys:
      - "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
      # - https://github.com/username.keys
  - name: "{{ admin_user }}"
    groups:
      - sudo
    keys:
      - "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
      # - https://github.com/username.keys

web_user: web
web_group: www-data
web_sudoers:
  - "/usr/sbin/service php7.0-fpm *"

And I can connect by hand at ssh aitor@staging-IP because I have copied my public key to remote server.

Thank you.

Please don’t use the same thread for different issues. This is also covered in the docs: https://roots.io/trellis/docs/ssh-keys/

1 Like