{"action":"created","issue":{"url":"https://api.github.com/repos/roots/trellis/issues/313","labels_url":"https://api.github.com/repos/roots/trellis/issues/313/labels{/name}","comments_url":"https://api.github.com/repos/roots/trellis/issues/313/comments","events_url":"https://api.github.com/repos/roots/trellis/issues/313/events","html_url":"https://github.com/roots/trellis/pull/313","id":103394799,"number":313,"title":"Refactor hosts files","user":{"login":"fullyint","id":7338513,"avatar_url":"https://avatars.githubusercontent.com/u/7338513?v=3","gravatar_id":"","url":"https://api.github.com/users/fullyint","html_url":"https://github.com/fullyint","followers_url":"https://api.github.com/users/fullyint/followers","following_url":"https://api.github.com/users/fullyint/following{/other_user}","gists_url":"https://api.github.com/users/fullyint/gists{/gist_id}","starred_url":"https://api.github.com/users/fullyint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fullyint/subscriptions","organizations_url":"https://api.github.com/users/fullyint/orgs","repos_url":"https://api.github.com/users/fullyint/repos","events_url":"https://api.github.com/users/fullyint/events{/privacy}","received_events_url":"https://api.github.com/users/fullyint/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/roots/trellis/labels/needs%20docs","name":"needs docs","color":"bfd4f2"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-08-27T00:38:00Z","updated_at":"2016-01-27T10:56:44Z","closed_at":"2015-12-28T20:52:02Z","pull_request":{"url":"https://api.github.com/repos/roots/trellis/pulls/313","html_url":"https://github.com/roots/trellis/pull/313","diff_url":"https://github.com/roots/trellis/pull/313.diff","patch_url":"https://github.com/roots/trellis/pull/313.patch"},"body":"* Enables cross-environment playbooks (e.g., syncing files/database) by loading entire `hosts` directory\r\n* Accommodates separate web vs. db servers by making `[web]` its own group instead of a child group of `<environment>`.\r\n* Pairs nicely with #314 \r\n* Initial discussion in #288\r\n\r\nCommands\r\n* Replace `-i hosts/<environment>` with `-e env=<environment>`\r\n* Dev can just be `ansible-playbook dev.yml`. You'd need vagrant vm in ssh config till #314 is merged.\r\n* unchanged: `./deploy.sh <environment> <site>`\r\n\r\nI kept hosts files separate by environment. Alternatively, a single file could look like this: \r\n\r\n```\r\n# Each host machine should appear in the \"Environments\" section and in the \"Types\" section.\r\n# Each host must only be listed once per [group], even if it will host multiple sites.\r\n\r\n\r\n# Environments\r\n\r\n[development]\r\n127.0.0.1\r\n\r\n[staging]\r\n192.168.50.6\r\n\r\n[production]\r\n192.168.50.7\r\n\r\n\r\n# Types\r\n\r\n[web]\r\n127.0.0.1\r\n192.168.50.6\r\n192.168.50.7\r\n\r\n[db]\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/roots/trellis/issues/comments/175556496","html_url":"https://github.com/roots/trellis/pull/313#issuecomment-175556496","issue_url":"https://api.github.com/repos/roots/trellis/issues/313","id":175556496,"user":{"login":"scherii","id":946853,"avatar_url":"https://avatars.githubusercontent.com/u/946853?v=3","gravatar_id":"","url":"https://api.github.com/users/scherii","html_url":"https://github.com/scherii","followers_url":"https://api.github.com/users/scherii/followers","following_url":"https://api.github.com/users/scherii/following{/other_user}","gists_url":"https://api.github.com/users/scherii/gists{/gist_id}","starred_url":"https://api.github.com/users/scherii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scherii/subscriptions","organizations_url":"https://api.github.com/users/scherii/orgs","repos_url":"https://api.github.com/users/scherii/repos","events_url":"https://api.github.com/users/scherii/events{/privacy}","received_events_url":"https://api.github.com/users/scherii/received_events","type":"User","site_admin":false},"created_at":"2016-01-27T10:56:44Z","updated_at":"2016-01-27T10:56:44Z","body":"*Please feel free to tell that I should open a new issue if this doesn't belong here:*\r\n\r\nWith this change we now have to enter the domain name instead of the server's IP.\r\n\r\n`./deploy.sh alpha alpha.domain.tld`\r\n```\r\nTASK: [Ensure site is valid] **************************************************\r\nfailed: [XXX.XXX.XXX.XXX] => {\"failed\": true}\r\nmsg: Site `alpha.domain.tld` is not valid. Available sites to deploy: beta.domain.tld\r\n```\r\n\r\n(Our staging stages are named `alpha` and `beta`.)\r\nSo our host files look like this:\r\n\r\n```\r\n[beta]\r\nbeta.domain.tld\r\n\r\n[web]\r\nbeta.domain.tld\r\n```\r\n\r\nAfter replacing the IP with the domain name it works again."}}