部署 LAMP 与 WordPress 栈:从基础到实践
1. 部署 LAMP 栈
LAMP 栈由 Linux、Apache、MariaDB 和 PHP 组成。下面将详细介绍如何使用 Ansible 部署这个栈。
1.1 导入示例数据库
使用 mysql_db 模块将示例数据库导入到 MariaDB 中,代码如下:
- name: import the sample database
mysql_db:
name: "{
{ mariadb_sample_database.db_name }}"
state: "import"
target: "{
{ mariadb_sample_database.path }}/{
{ item }}"
with_items: "{
{ mariadb_sample_database.dump_files }}"
when: db_imported is defined and db_imported.stat.exists == false
运行 playbook 调用该角色:
---
- hosts: boxes
gather_facts: true
become: yes
become_method: sudo
vars_files:
- group_vars/common.
超级会员免费看
订阅专栏 解锁全文
34

被折叠的 条评论
为什么被折叠?



