{ "uuid": [ { "value": "8a88f79c-3593-4316-8308-8bbc9622d0ec" } ], "langcode": [ { "value": "en" } ], "type": [ { "target_id": "daily_email", "target_type": "node_type", "target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7" } ], "revision_timestamp": [ { "value": "2025-05-11T09:00:55+00:00" } ], "revision_uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "revision_log": [], "status": [ { "value": true } ], "uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "title": [ { "value": "Deploying applications with Ansible" } ], "created": [ { "value": "2022-09-06T00:00:00+00:00" } ], "changed": [ { "value": "2025-05-11T09:00:55+00:00" } ], "promote": [ { "value": false } ], "sticky": [ { "value": false } ], "default_langcode": [ { "value": true } ], "revision_translation_affected": [ { "value": true } ], "path": [ { "alias": "\/daily\/2022\/09\/06\/deploying-applications-with-ansible", "langcode": "en" } ], "body": [ { "value": "\n

The last few days' emails have been about using Ansible to create and configure infrastructure, but it can also be used to deploy application code.<\/p>\n\n

The simplest way being that an artifact is built locally - e.g. a directory of static HTML pages from a static site generator - and uploaded onto the server, and for this you could use Ansible's synchronize<\/code> module.<\/p>\n\n

It's a wrapper around the rsync<\/code> command and makes it as simple as specifying src<\/code> and dest<\/code> values for the local and remote paths.<\/p>\n\n

For more complicated deployments, I like to use a tool called Ansistrano - an Ansible port of a deployment tool called Capistrano.<\/p>\n\n

It creates a new directory for each release and updates a current<\/code> symlink to identify and serve the current release, and can share files and directories between releases.<\/p>\n\n

As well as being able to configure settings such as the deployment strategy, how many old releases to keep, and even the directory and symlink names, there are a number of hooks that you can listen for an add your own steps as playbooks so you can install dependencies, generate assets, run migrations, or rebuild a cache as part of each deployment.<\/p>\n\n

If you're running your applications in Docker, you could use Ansible to pull the latest images and restart your applications.<\/p>\n\n

For more information and examples, I've given a talk on Ansible at various PHP events, which covers some Ansible basics before moving on to deploying applications with Ansistrano<\/a>.<\/p>\n\n


\n\n

Want to learn more about how I use Ansible? Register for my upcoming free email course<\/a>.<\/p>\n\n ", "format": "full_html", "processed": "\n

The last few days' emails have been about using Ansible to create and configure infrastructure, but it can also be used to deploy application code.<\/p>\n\n

The simplest way being that an artifact is built locally - e.g. a directory of static HTML pages from a static site generator - and uploaded onto the server, and for this you could use Ansible's synchronize<\/code> module.<\/p>\n\n

It's a wrapper around the rsync<\/code> command and makes it as simple as specifying src<\/code> and dest<\/code> values for the local and remote paths.<\/p>\n\n

For more complicated deployments, I like to use a tool called Ansistrano - an Ansible port of a deployment tool called Capistrano.<\/p>\n\n

It creates a new directory for each release and updates a current<\/code> symlink to identify and serve the current release, and can share files and directories between releases.<\/p>\n\n

As well as being able to configure settings such as the deployment strategy, how many old releases to keep, and even the directory and symlink names, there are a number of hooks that you can listen for an add your own steps as playbooks so you can install dependencies, generate assets, run migrations, or rebuild a cache as part of each deployment.<\/p>\n\n

If you're running your applications in Docker, you could use Ansible to pull the latest images and restart your applications.<\/p>\n\n

For more information and examples, I've given a talk on Ansible at various PHP events, which covers some Ansible basics before moving on to deploying applications with Ansistrano<\/a>.<\/p>\n\n


\n\n

Want to learn more about how I use Ansible? Register for my upcoming free email course<\/a>.<\/p>\n\n ", "summary": null } ], "feeds_item": [ { "imported": "1970-01-01T00:33:45+00:00", "guid": null, "hash": "77a04f54c7ca12e8f95a6282d7667d35", "target_type": "feeds_feed", "target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76" } ] }