ansible [警告]: 無効な属性を無視します: update_cache

ansible [警告]: 無効な属性を無視します: update_cache

なぜこの警告が表示されるのかわかりません。すでに apt モジュールをチェックしましたが、次のように書かれています:

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.

これらは update_cache が存在する 2 つのインスタンスです。

- 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

この警告が表示される理由について何か考えはありますか?

答え1

update_cacheはコマンドの引数となるはずですaptが、代わりにタスクの引数として配置されています。

現在の位置から削除し、aptコマンドに追加します。つまり、次のようになります。

apt: name={{item}} state=present update_cache=yes

PSupdate_cache問題が発生した場合の回避策は、aptitude をインストールすることです。例:

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

関連情報