{"action":"created","issue":{"url":"https://api.github.com/repos/roots/bedrock-ansible/issues/95","labels_url":"https://api.github.com/repos/roots/bedrock-ansible/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/roots/bedrock-ansible/issues/95/comments","events_url":"https://api.github.com/repos/roots/bedrock-ansible/issues/95/events","html_url":"https://github.com/roots/bedrock-ansible/pull/95","id":48946509,"number":95,"title":"[WIP] Ansible based site deploys","user":{"login":"swalkinshaw","id":295605,"avatar_url":"https://avatars.githubusercontent.com/u/295605?v=3","gravatar_id":"","url":"https://api.github.com/users/swalkinshaw","html_url":"https://github.com/swalkinshaw","followers_url":"https://api.github.com/users/swalkinshaw/followers","following_url":"https://api.github.com/users/swalkinshaw/following{/other_user}","gists_url":"https://api.github.com/users/swalkinshaw/gists{/gist_id}","starred_url":"https://api.github.com/users/swalkinshaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swalkinshaw/subscriptions","organizations_url":"https://api.github.com/users/swalkinshaw/orgs","repos_url":"https://api.github.com/users/swalkinshaw/repos","events_url":"https://api.github.com/users/swalkinshaw/events{/privacy}","received_events_url":"https://api.github.com/users/swalkinshaw/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/roots/bedrock-ansible/labels/under%20development","name":"under development","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2014-11-16T05:00:26Z","updated_at":"2015-03-26T01:19:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/roots/bedrock-ansible/pulls/95","html_url":"https://github.com/roots/bedrock-ansible/pull/95","diff_url":"https://github.com/roots/bedrock-ansible/pull/95.diff","patch_url":"https://github.com/roots/bedrock-ansible/pull/95.patch"},"body":"This is a work in-progress to deploy sites with Ansible instead of Capistrano through Bedrock itself. The main benefits are:\r\n\r\n1. Removes Ruby requirements\r\n2. Ansible can run the deploy itself easily\r\n3. Re-using hosts/settings from Ansible configs\r\n\r\nTodo:\r\n\r\n- [ ] `README`/docs update\r\n- [x] Improve separation of `wordpress-sites` role\r\n- [x] Figure out `.env` generation. Create on provision + on each deploy\r\n- [x] Figure out workflow for installing remote WP sites after deploys\r\n- [ ] sudoers for running commands like restarting php5-fpm\r\n- [ ] Consistent `logs` folder location/creating for dev/remote\r\n- [ ] Update `deploy_user` to `web_user`\r\n- [ ] Proper solution for cloning private repos"},"comment":{"url":"https://api.github.com/repos/roots/bedrock-ansible/issues/comments/86280712","html_url":"https://github.com/roots/bedrock-ansible/pull/95#issuecomment-86280712","issue_url":"https://api.github.com/repos/roots/bedrock-ansible/issues/95","id":86280712,"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},"created_at":"2015-03-26T01:19:57Z","updated_at":"2015-03-26T01:19:57Z","body":"**Rsyncing compiled assets.** I plan to compile my theme locally and will probably add a custom [rsync](http://docs.ansible.com/synchronize_module.html) task instead of specifying `project_files` for the \"Copy project files\" task. That way I can use filename matching patterns. I haven't checked whether the `copy` module can do that. I suspect my approach doesn't belong in the official project, but just to share...\r\n\r\n**1. Add `rsync_theme` to `group_vars/<staging|production>`.** It's optional, fine to omit.\r\n```diff\r\n  wordpress_sites:\r\n    staging.example.com:\r\n      repo: git@github.com:roots/bedrock.git\r\n+     rsync_theme: ../mytheme # path targeting local theme directory (relative to bedrock-ansible root)\r\n```\r\nI don't store/commit the theme in my bedrock repo. They have separate repos. I symlink local theme into local bedrock and Vagrant is none the wiser. I do the same with the client's custom plugin. \r\n```\r\n├── sites\r\n    ├── client_name\r\n        ├── example.dev (bedrock)\r\n        ├── bedrock-ansible\r\n        ├── mytheme\r\n        └── myplugin\r\n```\r\nThere are probably better ways. Feedback welcome.\r\n\r\n**2. Add custom rsync task.** Right after \"Copy project files\" task (`roles/deploy/tasks/main.yml`):\r\n```\r\n- name: Rsync theme files\r\n  synchronize: src=\"{{ project.rsync_theme }}\"\r\n               dest=\"{{ deploy_helper.new_release_path }}/web/app/themes\"\r\n               rsync_timeout=30\r\n               archive=no\r\n               recursive=yes\r\n               delete=yes\r\n               rsync_opts=\"--include-from={{ project.rsync_theme }}/.rsync\"\r\n  when: project.rsync_theme is defined\r\n```\r\nMaybe I'll precede this with a task to compile theme assets locally with a [local_action](http://docs.ansible.com/playbooks_delegation.html#delegation).\r\n\r\n**3. Add `.rsync` file to `mytheme` root.** A bunch of exclude rules, followed by \"include all the rest\" (`+*`).\r\n```\r\n- .git\r\n- assets\r\n- bower_components\r\n- node_modules\r\n- .bowerrc\r\n- .editorconfig\r\n- .jshintrc\r\n- .jscsrc\r\n- .travis.yml\r\n- bower.json\r\n- composer.json\r\n- CONTRIBUTING.md\r\n- package.json\r\n- .gitignore\r\n- .gitkeep\r\n- .DS_Store\r\n\r\n+ *\r\n```\r\n"}}