It should be possible. I do intend to split out the deploy role to make this easier. There’s a placeholder issue for it.
Are your sites Bedrock-based or not? It would definitely take more work for non-Bedrock sites.
Basic steps would be:
- Follow normal installation
- Add your server to a
hosts
file - Configure the matching
group_vars
file to define a site underwordpress_sites
(these settings should match up with your existing WP install) - Just run the deploy command/playbook
You could get away with only defining the minimum set of variables for a WP site. Something like this:
wordpress_sites:
example.com:
local_path: '../site' # path targeting local Bedrock site directory (relative to Ansible root)
repo: git@github.com:roots/bedrock.git
branch: master
# env section only needed if you need to generate a `.env` file
env:
wp_home: http://staging.example.com
wp_siteurl: http://staging.example.com/wp
wp_env: staging
db_name: example_staging
db_user: example_dbuser
db_password: example_dbpassword
# Generate your keys here: https://api.wordpress.org/secret-key/1.1/salt/
auth_key: "generateme"
auth_salt: "generateme"
logged_in_key: "generateme"
logged_in_salt: "generateme"
nonce_key: "generateme"
nonce_salt: "generateme"
secure_auth_key: "generateme"
secure_auth_salt: "generateme"
If your site isn’t Bedrock based, it would take more work to override some defaults in the deploy
role.
You’d also have to manually figure out adding SSH keys but that’s the same as Capistrano.