Ansible系列基础篇 1.7.2、PlayBook之include
一、include定义
功能:提取公共的逻辑代码段,通过include语法,在主程序中引入公共代码段,使结构清晰,方便阅读。
基础使用示例:
# cat install_MysqlAndPhp.yml - yum: name: mysql state: present - yum: name: php-fpm state: present # cat lamp.yml --- - hosts: test70 remote_user: root gather_facts: no tasks: - include: install_MysqlAndPhp.yml - yum: name: httpd state: present
二、include高级用法
2.1、handlers中使用include
1