Single Install, Many Sites

Ok, so I’m very unclear on the next step here.

I’ve setup five websites in my bedrock-ansible folder. One with the same name as the project, site1.com, in the folder site. The others in their own folders in the same level as site, site2.com, site3.com, etc. The development setup works just fine.

When I push up to production, the server provisions ok, but the deploy does not. I have two issues here.

One, why do I have to specify a sitename as part of the deploy command if I’m working on everything as one big projects. Two, how can I get this to work. The error I get when I try to deploy any of the others is:

TASK: [deploy | Move project subtree into root folder] ************************
fatal: [46.101.1.58] => error while evaluating conditional: site2

Does it have to do with the repo settings? Subtree? Thanks all, feeling frustrated.

Again, the folder structure is
site1.com
-ansible
-site
-site2.com
-site3.com
-site4.com
-site5.com

Is there anyone that has a working example of a two site install with bedrock-ansible? Or a version of production’s group_vars that’s commented?

I might be wrong, but if your git root is “site1.com”, and the name of the subfolder containing site2 is “site2.com”, then the subtree for site2 would have to be the path relative to the git root : “subtree: site2.com”.

1 Like

@patrickv is correct about the subtree value.

Although I do think there might be a bug in the Ansible conditional for it. A few people have gotten:

error while evaluating conditional: site2

You can always just try commenting out this line to test: https://github.com/roots/bedrock-ansible/blob/8f140132e485278d40b8ec7571bda0c233a88090/roles/deploy/tasks/main.yml#L20

Ok, great, it works. So, getting hung up on that conditional…

I think I fixed it. The Ansible docs say that ‘when’ as its used here evaluates for a boolean, true, false, but subtree is false or present, so it only passes if you change the line to:

when: project_subtree is defined

Not sure if this works when subtree is left off.

Thanks guys!

1 Like

That should work. Want to submit a PR for the fix?

Done. Wow, my first pull request. :no_mouth:

3 Likes