{"id":117468,"date":"2022-06-10T13:01:16","date_gmt":"2022-06-10T10:01:16","guid":{"rendered":"https:\/\/computingforgeeks.com\/?p=117468"},"modified":"2023-09-15T01:23:33","modified_gmt":"2023-09-14T22:23:33","slug":"setup-lemp-stack-for-wordpress-using-ansible","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/setup-lemp-stack-for-wordpress-using-ansible\/","title":{"rendered":"How To Setup LEMP stack for WordPress using Ansible"},"content":{"rendered":"\n<p>Welcome to this guide on how to set up the LEMP stack for WordPress using Ansible. <strong>Trellis<\/strong> is an ansible-powered tool used to deploy WordPress sites. It lets you create and manage production-ready servers with optimized performance.<\/p>\n\n\n\n<p>Trellis offers the following features:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Local development<\/strong> &#8211; Trellis comes with Vagrant (opens new window)support for local development environments that run on isolated virtual machines. You can as well use the local dev tools as well.<\/li>\n\n\n\n<li><strong>Customizable<\/strong> &#8211; it gives you all the requirements for a standard WordPress server but is still customizable.<\/li>\n\n\n\n<li><strong>Portable without vendor-lock-in<\/strong> &#8211; It can be run on any hosting platform; traditional dedicated server hosting or cloud platforms.<\/li>\n\n\n\n<li><strong>Community backed<\/strong> &#8211; Trellis is an open-source tool with a large community that continuously improves the defaults over time<\/li>\n\n\n\n<li><strong>CLI<\/strong> &#8211; It comes with a CLI which makes management of local\/remote servers easy.<\/li>\n\n\n\n<li><strong>Zero-downtime deploys<\/strong> &#8211; It has atomic, zero-downtime deploys built-in that is completely configurable with a powerful hook system. It is possible to deploy and roll back with a single CLI command.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Provisioned Software<\/h2>\n\n\n\n<p>Trellis, provisions a server with Ubuntu 20.04 base and provisions the following software:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PHP 8.0+<\/li>\n\n\n\n<li>MariaDB database server<\/li>\n\n\n\n<li>SSL support (scores an A+ on the Qualys SSL Server Test<\/li>\n\n\n\n<li>Let&#8217;s Encrypt SSL certificates<\/li>\n\n\n\n<li>WP-CLI<\/li>\n\n\n\n<li>Composer<\/li>\n\n\n\n<li>Nginx webserver with HTTP2\/ and optional FastCGI micro-caching<\/li>\n\n\n\n<li>sSMTP (mail delivery)<\/li>\n\n\n\n<li>Fail2ban and ferm<\/li>\n\n\n\n<li>Memcached<\/li>\n\n\n\n<li>Other services like NTP and sshd<\/li>\n<\/ul>\n\n\n\n<p>In this guide, we will use systematically walk through how to set up the LEMP stack for WordPress using Ansible.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Requirements.<\/h2>\n\n\n\n<p>For this guide, you need the below packages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Python 3<\/li>\n\n\n\n<li>trellis-cli<\/li>\n<\/ul>\n\n\n\n<p>Install Python and other dependencies on your system using the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">##On Ubuntu \/ Debian<\/mark><\/em>\nsudo apt update<em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\n<\/mark><\/em>sudo apt install ansible python3 python3-pip python3-venv vim curl -y\n\n<em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">##On CentOS \/ Rocky Linux \/ AlmaLinux<\/mark><\/em>\nsudo yum -y install epel-release<em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\n<\/mark><\/em>sudo yum install ansible python3 python3-pip python3-virtualenv vim curl -y<\/code><\/pre>\n\n\n\n<p>Proceed and install the trellis-cli as below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -sL https:\/\/roots.io\/trellis\/cli\/get | sudo bash<\/code><\/pre>\n\n\n\n<p>If Shell completions aren&#8217;t working, install them manually with the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trellis --autocomplete-install<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1 &#8211; Create a WordPress Project<\/h2>\n\n\n\n<p>Creating a project with Trellis is simple. Use the command below and replace <strong>wordpress.example.com<\/strong> with your own project dame\/domain<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trellis new<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\"> wordpress.example.com<\/mark><\/code><\/pre>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Site domain &#91;wordpress.example.com]: \n\n? Select main site host: \n+   Other\n  \u25b8 wordpress.example.com\n\n&#91;\u2713] Created virtualenv (\/home\/admin\/wordpress.example.com\/trellis\/.trellis\/virtualenv)\n&#91;\u2713] Ensure pip is up to date\n&#91;\u2713] Dependencies installed\nStarting galaxy role install process\n- downloading role 'composer', owned by geerlingguy\n- downloading role from https:\/\/github.com\/geerlingguy\/ansible-role-composer\/archive\/1.9.0.tar.gz\n- extracting composer to \/home\/admin\/wordpress.example.com\/trellis\/vendor\/roles\/composer\n- composer (1.9.0) was installed successfully\n.....\nwordpress.example.com project created with versions:\n  Trellis v1.14.0\n  Bedrock v1.19.3<\/code><\/pre>\n\n\n\n<p>Trellis has two playbooks, the<strong> dev.yml<\/strong> and <strong>server.yml<\/strong>. Based on the two playbooks, there are two approaches:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Local development:<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Trellis uses the <strong><em>Vagrantfile<\/em><\/strong> that uses the ansible provisioner to run the playbook, <strong>dev.yaml<\/strong>. This will get a new Vagrant virtual machine running the WordPress site.<\/p>\n\n\n\n<p>You can as well edit the IP address in the <strong>vagrant.default.yml<\/strong> to allow running multiple boxes concurrently. The default IP is<em> 192.168.56.5<\/em>.<\/p>\n\n\n\n<p>Once that is configured, run the command below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">wordpress.example.com<\/mark>\/trellis\ntrellis up<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Remote server setup<\/strong> (staging\/production)<\/li>\n<\/ul>\n\n\n\n<p>This is similar to local deployment only that local development automatically creates a virtual machine and provisions it. <\/p>\n\n\n\n<p>Remember that a base Ubuntu 18.04|20.04 is required for the remote server. Here, the configuration used is <code>server.yml<\/code>.<\/p>\n\n\n\n<p>There are two concepts here:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Provision<\/li>\n\n\n\n<li>Deploy<\/li>\n<\/ul>\n\n\n\n<p><strong>Provisioning<\/strong> set up the server with the required software and configuration required for the WordPress site. In this stage, MariaDB and Nginx e.t.c are installed and configured.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2 &#8211;  Provision the Project<\/h2>\n\n\n\n<p>For this guide, we will a provision remote server using the steps below:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.1 &#8211; Set up target hosts<\/h3>\n\n\n\n<p>We will begin by configuring the ansible hosts defined in the \/hosts\/{env} file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">wordpress.example.com<\/mark>\/trellis<\/code><\/pre>\n\n\n\n<p>Here, we have production and staging hosts. Choose one environment that best works for you. This guide aims to demonstrate how to provision production(with Let&#8217;s Encrypt SSL) and staging(with self-signed certificates).<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>For Production<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Open the below file for editing:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim hosts\/production<\/code><\/pre>\n\n\n\n<p>Add the remote hosts to both group and type as below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;production]\n<strong><em>192.168.205.11\n<\/em><\/strong>\n&#91;web]\n<strong><em>192.168.205.11<\/em><\/strong><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>For Staging<\/strong><\/li>\n<\/ul>\n\n\n\n<p>If you choose to proceed with the staging setup, edit the hosts here:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim hosts\/staging<\/code><\/pre>\n\n\n\n<p>Add your hosts to both the group and type as you did for the production hosts.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;staging]\n192.168.205.11\n\n&#91;web]\n192.168.205.11<\/code><\/pre>\n\n\n\n<p>Once the above configurations have been made, generate and copy SSH keys to the remote system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-keygen -t rsa\nssh-copy-id -i ~\/.ssh\/id_rsa.pub <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">username<\/mark>@<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">remote_IP<\/mark><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.2 &#8211; Defining Users.<\/h3>\n\n\n\n<p>The users are defined by the<strong><em> users.yaml<\/em><\/strong> file. Here, you need to you can also add the GitHub\u2019  (SSH) keys by editing the file as below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim group_vars\/all\/users.yml<\/code><\/pre>\n\n\n\n<p>In the file, make the below settings. Remember to provide the remote user with sudo access under the <strong>admin_user<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Documentation: https:\/\/roots.io\/trellis\/docs\/ssh-keys\/\nadmin_user: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">ubuntu<\/mark><\/code><\/pre>\n\n\n\n<p>In our example, <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">ubuntu<\/mark> is the remote server username.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.3 &#8211; Configure Ansible vault password<\/h3>\n\n\n\n<p>The password variables are declared in the <strong><em>{env}\/vault.yml<\/em><\/strong> files. Here, provide the sudo password, MySQL root password, database password e.t.c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em><strong>##For Production\n<\/strong><\/em>vim group_vars\/production\/vault.yml\n\n<strong><em>##For Staging\n<\/em><\/strong>vim group_vars\/staging\/vault.yml<\/code><\/pre>\n\n\n\n<p>Enter the password for the remote user, MySQL database and root passwords.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Documentation: https:\/\/docs.roots.io\/trellis\/master\/vault\/\nvault_mysql_root_password: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">RootDBPassw0rd<\/mark>\nvault_users:\n- name: '{{ admin_user }}'\n  password: <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">&lt;Enter the sudo user password Here&gt;<\/mark><\/em>\n  salt: r53NvbZaTcpFohekOetrDh9EXo14JdzJQaYOEsOQJfzbLgOcdeIgj4SJyHZF0dyr\nvault_wordpress_sites:\n  wordpress.example.com:\n    admin_password: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Passw0rd<\/mark>\n    env:\n      db_password: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">Passw0rd<\/mark><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.4 &#8211; Configure the Site Meta<\/h3>\n\n\n\n<p>This is where the essential site information is stored. This includes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>set the canonical site URL (wordpress.example.com) for the site<\/li>\n\n\n\n<li>defined the URL for the repository<\/li>\n\n\n\n<li>the git repo branch that gets deployed.<\/li>\n\n\n\n<li>enabled SSL (set to true), which will also install an SSL certificate when the box provisions<\/li>\n<\/ul>\n\n\n\n<p>Edit the files as below:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>For Production<\/strong>(with Let&#8217;s Encrypt SSL)<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\">vim group_vars\/production\/wordpress_sites.yml<\/mark>\nwordpress_sites:\n  <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">wordpress.example.com<\/mark>:\n    site_hosts:\n    - canonical: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">wordpress.example.com<\/mark>\n      redirects: &#91;]\n    local_path: ..\/site\n    branch: master\n    repo: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">git@github.computingforgeeks.git<\/mark>\n    repo_subtree_path: site\n    multisite:\n      enabled: false\n    ssl:\n      enabled: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">true<\/mark>\n      provider: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">letsencrypt<\/mark>\n    cache:\n      enabled: false<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>For staging<\/strong>(with self-signed certificates)<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\">vim group_vars\/staging\/wordpress_sites.yml<\/mark>\nwordpress_sites:\n  wordpress.example.com:\n    site_hosts:\n    - canonical: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">wordpress.example.com<\/mark>\n      redirects: &#91;]\n    local_path: ..\/site\n    branch: <strong>master<\/strong>\n    repo: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">git@github.com:computingforgeeks.git<\/mark>\n    repo_subtree_path: site\n    multisite:\n      enabled: false\n    ssl:\n      enabled: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">true<\/mark>\n      provider:<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\"> self-signed<\/mark>\n    cache:\n      enabled: false<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3 &#8211; Set Up LEMP stack for WordPress using Ansible.<\/h2>\n\n\n\n<p>Install the requirements using the requirements.txt file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo pip3 install -U pip setuptools \npip3 install -r requirements.txt <\/code><\/pre>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.....\n  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)\nUsing legacy 'setup.py install' for ansible, since package 'wheel' is not installed.\nUsing legacy 'setup.py install' for ansible-base, since package 'wheel' is not installed.\nInstalling collected packages: pycparser, pyparsing, MarkupSafe, cffi, PyYAML, packaging, jinja2, cryptography, ansible-base, passlib, ansible\n    Running setup.py install for ansible-base ... done\n    Running setup.py install for ansible ... done\nSuccessfully installed MarkupSafe-2.0.1 PyYAML-6.0 ansible-2.10.7 ansible-base-2.10.16 cffi-1.15.0 cryptography-37.0.0 jinja2-3.0.3 packaging-21.3 passlib-1.7.4 pycparser-2.21 pyparsing-3.0.8<\/code><\/pre>\n\n\n\n<p>After the command, you will have Ansible set with all the requirements installed. Proceed and install the LEMP stack on the remote system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>##For Production\n<\/em><\/strong>ansible-playbook server.yml -e env=production\n\n<strong><em>##For Staging\n<\/em><\/strong>ansible-playbook server.yml -e env=staging<\/code><\/pre>\n\n\n\n<p>If everything goes well, you should see this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"606\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-1-1024x606.png\" alt=\"\" class=\"wp-image-117677\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-1-1024x606.png 1024w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-1-300x177.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-1-768x454.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-1-696x412.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-1-1068x632.png 1068w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-1-710x420.png 710w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-1.png 1270w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>That is it! You have the LEMP stack set up on the remote system. MySQL has been installed and the database details created depending on your domain name. For this case, we have:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong><em>##For Production\n<\/em><\/strong>Database: wordpress_example_com_production\nUser: wordpress_example_com\n\n<strong><em>##For Staging\n<\/em><\/strong>Database: wordpress_example_com_production\nUser: wordpress_example_com<\/code><\/pre>\n\n\n\n<p>The password used to connect to the database is defined in the<strong> vault.yml<\/strong> file. Now proceed and set up WordPress.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4 &#8211; Set Up WordPress on the Remote Host.<\/h2>\n\n\n\n<p>Now download WordPress using the <strong>wp<\/strong> command in the directory below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir -p \/srv\/www\/wordpress.example.com\/current\/web\nsudo chown -R $USER:$USER \/srv\/www\/wordpress.example.com\ncd \/srv\/www\/wordpress.example.com\/current\/web\nwp core download<\/code><\/pre>\n\n\n\n<p>Create the<strong> wp-config.php<\/strong> file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cp wp-config-sample.php wp-config.php<\/code><\/pre>\n\n\n\n<p>Edit the config file and add the database credentials.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim wp-config.php<\/code><\/pre>\n\n\n\n<p>Provide the database details accordingly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>##For Production\n<\/strong>wordpress_example_com_staging\n\/** The name of the database for WordPress *\/\ndefine( 'DB_NAME', 'wordpress_example_com_production' );\n\n\/** Database username *\/\ndefine( 'DB_USER', 'wordpress_example_com' );\n\n\/** Database password *\/\ndefine( 'DB_PASSWORD', 'Passw0rd!' );\n\n\/** Database hostname *\/\ndefine( 'DB_HOST', 'localhost' );\n\n\n<strong>##For Staging\n<\/strong>\/** The name of the database for WordPress *\/\ndefine( 'DB_NAME', 'wordpress_example_com_staging' );\n\n\/** Database username *\/\ndefine( 'DB_USER', 'wordpress_example_com' );\n\n\/** Database password *\/\ndefine( 'DB_PASSWORD', 'Passw0rd!' );\n\n\/** Database hostname *\/\ndefine( 'DB_HOST', 'localhost' );<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5 &#8211; Access WordPress.<\/h2>\n\n\n\n<p>Proceed and access WordPress using the URL <a href=\"https:\/\/domain_name.com\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/domain_name.com<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"630\" height=\"737\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible.png\" alt=\"\" class=\"wp-image-117671\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible.png 630w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-256x300.png 256w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-359x420.png 359w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/figure>\n\n\n\n<p>Provide the site information and create the admin user.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"415\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-2.png\" alt=\"\" class=\"wp-image-117672\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-2.png 660w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-2-300x189.png 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/figure>\n\n\n\n<p>The admin account will be created as above. Login to the admin dashboard.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"410\" height=\"490\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-3.png\" alt=\"\" class=\"wp-image-117673\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-3.png 410w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-3-251x300.png 251w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-3-351x420.png 351w\" sizes=\"auto, (max-width: 410px) 100vw, 410px\" \/><\/figure>\n\n\n\n<p>On the admin dashboard, you can create new posts and makes customizations to WordPress.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"586\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-4-1-1024x586.png\" alt=\"\" class=\"wp-image-117675\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-4-1-1024x586.png 1024w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-4-1-300x172.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-4-1-768x440.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-4-1-696x398.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-4-1-1068x611.png 1068w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-4-1-734x420.png 734w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2022\/04\/How-To-Setup-LEMP-stack-for-WordPress-using-Ansible-4-1.png 1272w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>That is it!<\/p>\n\n\n\n<p>We have successfully walked through how to set up the LEMP stack for WordPress using Ansible. We have also deployed the WordPress instance successfully. I hope this was significant.<\/p>\n\n\n\n<p>Related posts:<\/p>\n\n\n\n<p><a href=\"https:\/\/computingforgeeks.com\/how-to-upgrade-ansible-awx-running-in-kubernetes\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to upgrade Ansible AWX running in Kubernetes<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/computingforgeeks.com\/how-to-manage-postgresql-database-with-ansible\/\" target=\"_blank\" rel=\"noreferrer noopener\">How To Manage PostgreSQL Database with Ansible<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/computingforgeeks.com\/install-lamp-stack-on-ubuntu-debian-with-ansible\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install LAMP Stack on Ubuntu \/ Debian with Ansible<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to this guide on how to set up the LEMP stack for WordPress using Ansible. Trellis is an ansible-powered tool used to deploy WordPress sites. It lets you create and manage production-ready servers with optimized performance. Trellis offers the following features: Provisioned Software Trellis, provisions a server with Ubuntu 20.04 base and provisions the &#8230; <a title=\"How To Setup LEMP stack for WordPress using Ansible\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/setup-lemp-stack-for-wordpress-using-ansible\/\" aria-label=\"Read more about How To Setup LEMP stack for WordPress using Ansible\">Read more<\/a><\/p>\n","protected":false},"author":21,"featured_media":117674,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[606,329,299,50],"tags":[37500],"class_list":["post-117468","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ansible","category-automation","category-how-to","category-linux-tutorials","tag-wordpress-using-ansible"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/117468","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=117468"}],"version-history":[{"count":0,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/117468\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/117674"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=117468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=117468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=117468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}