Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ansible apt模块显示“;“更改项目”;当我不';我想没有_Ansible_Ansible Playbook_Ansible 2.x - Fatal编程技术网

Ansible apt模块显示“;“更改项目”;当我不';我想没有

Ansible apt模块显示“;“更改项目”;当我不';我想没有,ansible,ansible-playbook,ansible-2.x,Ansible,Ansible Playbook,Ansible 2.x,我正在尝试用Ansible安装Apache2。我有一个Apache的角色和处理程序 我的剧本(site.yml)包含: --- - hosts: webservers remote_user: ansrun become: true become_method: sudo --- - name: Install Apache 2 apt: name={{ item }} update_cache=yes state=present with_items: - apa

我正在尝试用Ansible安装Apache2。我有一个Apache的角色和处理程序

我的剧本(
site.yml
)包含:

---
- hosts: webservers
  remote_user: ansrun
  become: true
  become_method: sudo
---
- 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
Ansible角色文件包含:

---
- hosts: webservers
  remote_user: ansrun
  become: true
  become_method: sudo
---
- 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'])
我认为这与条件有关。

您遇到了一个引入到Ansible 2.2.0(并在2.2.1中修复)的问题

使用
update\u cache=yes
时,
apt
模块会在apt缓存更新发生时返回
changed
-状态,而不仅仅是在实际软件包升级时

您需要将Ansible升级到2.2.1版(1月16日正式发布)

您需要执行以下操作之一:

  • 将Ansible升级到至少2.2.1(当前处于发行候选状态,在PyPI中不可用,因此您必须)
  • 降级至2.1.3
  • 保留Ansible 2.2.0并将
    安装Apache 2
    任务分为两部分:
    • 一个仅用于缓存更新(当设置为false时,可能带有
      已更改的\u)
    • 一个用于实际的
      apache2
      包安装(不带
      update\u cache=yes
      ),调用处理程序

您可以发布整个输出吗?也将此添加到您的游戏中<代码>-debug:var=ansible\u分布