Misconfiguration of wordpress site names

For some reason trellis doesn’t see the matching site names for my production config. Here’s my (production)vault:

vault_mysql_root_password: <redacted>

# Documentation: https://roots.io/trellis/docs/security/
vault_users:
  - name: "{{ admin_user }}"
    password: <redacted>
    salt: "<redacted>"

# Variables to accompany `group_vars/production/wordpress_sites.yml`
# Note: the site name (`example.com`) must match up with the site name in the above file.
vault_wordpress_sites:
  carre.ninja:
    env:
      db_password: <redacted>
      auth_key: "<redacted>"
      secure_auth_key: "<redacted>"
      logged_in_key: "<redacted>"
      nonce_key: "<redacted>"
      auth_salt: "<redacted>"
      secure_auth_salt: "<redacted>"
      logged_in_salt: "<redacted>"
      nonce_salt: "<redacted>"

and my wordpress_site file:

# Documentation: https://roots.io/trellis/docs/remote-server-setup/
# `wordpress_sites` options: https://roots.io/trellis/docs/wordpress-sites
# Define accompanying passwords/secrets in group_vars/production/vault.yml

wordpress_sites:
  carre.ninja:
    site_hosts:
      - canonical: carre.ninja
        redirects:
          - www.carre.ninja
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@github.com:dodo/carre.ninja.git # replace with your Git repo URL
    repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
    branch: master
    multisite:
      enabled: false
    ssl:
      enabled: true
      provider: letsencrypt
    cache:
      enabled: false

here’s the exact output:

Invalid WordPress sites configuration: site names in `wordpress_sites` must
have matching entry in `vault_wordpress_sites`.

Sites without a matching vault entry:
* `carre.ninja`

Update `group_vars/production/vault_wordpress_sites.yml` to continue.

Docs: https://roots.io/trellis/docs/wordpress-sites/#passwordssecrets

fatal: [138.197.3.141]: FAILED! => {
    "changed": false, 
    "failed": true
}

Here’s a long shot, but just maybe…

I changed the hosts for production and staging to be different. Still no dice.

I remember a thread (and cannot find it) in which someone reported that Ansible was reading variables from an old temp file that their text editor had left in group_vars. I can’t find the thread. If it were vim, the filename might be something like .vault.yml.swp. Maybe you could check for such files with a command like
find . -name "*vault*"
(run from the root of your Trellis project)

I had the same issue when provisioning a new environment.

In the end it was caused by the Site Name being the same in the Staging and Production wordpress_site.yml files, even though they had matching vault entries in their respective Production / Staging folders.

thanks to your mention of old temp file I managed to get rid of s similar issue; I renamed the files to keep a backup, but i had to move them out of the directory to sort out the issue. Somehow Ansible/Trellis was still referring to those instead of the new ones for some reasons…

I had the same problem
it was due to an error in the wordpress website name in development
wordpress_site.yml and vault.yml files

now I got this error:
unable to connect to database, check login_user and login_password are
correct or /root/.my.cnf has the credentials.