Use Ansible to automatically install LNMP
Use Ansible to automatically install: MySQL-8, WordPress-6.4.1, Nginx-1.14, and PHP-8
Requires
Management side
Ansible 2.16Controlled server
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
How to run
a. Local execution on the management side
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
b. Or GitHub Action execution
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 methodAdd 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
refer to
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 modificationAnsible: managed-node-requirements
Ansible collections: builtin
How to build your inventory
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
```
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。