【发布时间】:2017-01-04 21:09:32
【问题描述】:
我正在尝试使用 Ansible 安装 Apache2。我有一个 Apache 的角色和处理程序。
我的剧本 (site.yml) 包含:
---
- hosts: webservers
remote_user: ansrun
become: true
become_method: sudo
Ansible 角色文件包含:
---
- name: Install Apache 2
apt: name={{ item }} update_cache=yes state=present
with_items:
- apache2
when: ansible_distribution == "Ubuntu"
- name: Enable mod_rewrite
apache2_module: name=rewrite state=present
notify:
- reload apache2
每当我运行 playbook 时,我都会收到此消息,但没有任何变化。
changed: [10.0.1.200] => (item=[u'apache2'])
我认为这与条件有关。
【问题讨论】:
-
你能发布整个输出吗?也将其添加到您的游戏中。
- debug: var=ansible_distribution
标签: ansible ansible-playbook ansible-2.x