Inexplicable apt module showing "item changed" when I don't think it

I am trying to install Apache2 with Ansible. I have a role and handler for Apache.

My playbook ( site.yml) contains:

---
- hosts: webservers
  remote_user: ansrun
  become: true
  become_method: sudo

Ansible role file contains:

---
- 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

Whenever I start the playbook, I get this message, but nothing has changed.

changed: [10.0.1.200] => (item=[u'apache2'])

I think this has something to do with the conditional.

+4
source share
1 answer

You have encountered a problem introduced in Ansible 2.2.0 (and fixed in 2.2.1).

update_cache=yes apt changed -status , APT, .

Ansible 2.2.1 ( 16 )

:

  • 2.2.1 ( PyPI, Ansible from source);
  • 2.1.3;
  • Ansible 2.2.0 Install Apache 2 :
    • (, changed_when false),
    • apache2 ( update_cache=yes), .
+2

Source: https://habr.com/ru/post/1665788/


All Articles