Additional Subdomain on Droplet and Hosts File



Just about to add a subdomain to an existing trellis setup with a TLQDN. So I adjusted wordpress_sites.yml for development and production:
      - canonical:
    local_path: ../members # path targeting local Bedrock site directory (relative to Ansible root)
    repo: # replace with your Git repo URL
    repo_subtree_path: members # relative path to your Bedrock/WP directory in your repo
    branch: master
      enabled: false
      enabled: true
      provider: letsencrypt
      enabled: true

as well as the vault files for both environments. I am not using staging.

Now I was wondering. What about the hosts/production file? I now have

# Add each host to the [production] group and to a "type" group such as [web] or [db].
# List each machine only once per [group], even if it will host multiple sites.



And the new subdomain will be on the same Droplet / ip address. Should I add here for production and web or should I just replace the domain by the ip address maybe?


Saw at To deploy a second site that I should just the ip. for under production. But not sure if I should keep the domain under [web]


In the end it was ip address for both:

# Add each host to the [production] group and to a "type" group such as [web] or [db].
# List each machine only once per [group], even if it will host multiple sites.



That worked. Had to fix the local .env as well as I forgot but that was only a local development issue.


This is the hostname Ansible will use in making its SSH connection to your server (e.g., ssh or ssh root@ You could keep, switch to, or use the IP.

Whatever hostname you use, be consistent between the [production] and [web] groups so that the Ansible host pattern will find a host from hosts/production that is in both the web and production groups.

Given that each Ansible task output shows the hostname, if you have multiple sites on the server, you might prefer tasks to show a generic hostname like IP. Or you could create and use a hostname alias which will appear in task output:

# hosts/production
my_production_hostname ansible_host=



If you keep, the slight disadvantage is that you may be running the server.yml playbook with the other site in mind, but the output shows Not a big deal. Another disadvantage is for new sites/domains when DNS is not already set up; you’d have to put a temporary entry in your /etc/hosts file to fake DNS (not necessary when you just use IP in hosts/production).

The advantage of keeping is that you do not have to indicate the IP, assuming you have public DNS set up. The implication is that if your IP changes and you have updated DNS, you don’t have to do anything in your hosts/production file. This would be best for sites/servers whose IPs end up changing often.


Did not know about the host alias function. That is a great option. And thanks for the general explanation. As I will keep my Droplet’s ip address and do not intend to change it for quite some time, the using of an ip address sounds like a great solution.