Ich bin nicht sicher, warum ich diese Warnung erhalte. Ich habe das Apt-Modul bereits überprüft und dort steht:
update_cache
bool
Choices:
no ←
yes
Run the equivalent of apt-get update before the operation. Can be run as part of the package installation or as a separate step.
Dies sind die beiden Instanzen, in denen update_cache vorhanden ist:
- name: Install Apache
apt:
name: apache2
state: present
update_cache: yes
- name: install php7.2-fpm and all necessary modules
apt: name={{ item }} state=present
with_items:
- php7.2-fpm
- php7.2-gd
- php7.2-curl
- php7.2-mysql
#- php7.2-mcrypt
- php7.2-mbstring
- php7.2-xml
update_cache: yes
when: ppastable is success
Irgendwelche Ideen, warum ich diese Warnung bekomme?
Antwort1
update_cache
soll ein Argument für den apt
Befehl sein, Sie haben es aber stattdessen als Argument für die Aufgabe platziert.
Entfernen Sie es von seiner aktuellen Position und fügen Sie es dem apt
Befehl hinzu, also:
apt: name={{item}} state=present update_cache=yes
PS: Wenn update_cache
es abstürzt, können Sie Aptitude installieren. Beispiel:
- name: Install aptitude on Debian systems (https://github.com/ansible/ansible/issues/18987)
apt: pkg=aptitude state=latest
when: ansible_os_family == 'Debian'
- name: Update apt cache (https://github.com/ansible/ansible/issues/18987)
apt: update_cache=yes
when: ansible_os_family == 'Debian'