Use Ansible to automatically install: MySQL-8, WordPress-6.4.1, Nginx-1.14, and PHP-8
- Ansible 2.16
- Operating system: Centos stream/RHEL 8.x
- Python 3.0 (installed by default) Verify installation:
python3 -V
- User with root privileges and public-key has been added
-
Configure the server address to inventory.ini; configure the user to remote_user in site.yml
-
Add SSH key: Do not add passphrase to the secret key
```bash eval "$(ssh-agent -s)" ssh-add ~/.ssh/private-key-file ```
-
One-click deployment:
```bash ansible-playbook -i inventory.ini site.yml ```
-
After successful execution, you can access your wordpress
-
Add in warehouse Actions secrets and variables
- SSH_PRIVATE_KEY: your SSH private key
- WORDPRESS_SERVER_IP: your server IP
- KNOW_HOSTS_FOR_WORDPRESS_SERVER: know_hosts file content, reference for obtaining method
-
Add a tag to Git: v0.0.1 and submit, the script will be executed automatically For execution rules, see .github/workflows/deploy.yml
-
After successful execution, you can access your wordpress
-
Ansible playbook reference: ansible-examples/wordpress-nginx
Modification points:
- Removed selinux, iptables, firewall related configurations
- Upgrade PHP to 8.0 and adjust the modules required for PHP-FPM Refer to the document
- Upgrade wordpress to 6.4.1, delete automatic updates and other configurations
- ansible-lint problem modification
-
How to obtain the contents of the know_hosts file:
```bash eval "$(ssh-agent -s)" ssh-add ~/.ssh/private-key-file ssh username@wordpress_server_ip -o UserKnownHostsFile=.ansible_known_hosts ```