如何在使用Ansible安装软件包时自动接受条款?

如何在使用Ansible安装软件包时自动接受条款?,ansible,Ansible,安装pkgs时,Ansible失败,因为需要接受许可条款 如何通过ansible playbook自动接受条款 --- - hosts: client1 remote_user: ansible become: True tasks: - name: testing apt_repository: repo=ppa:webupd8team/java state=present - name: updating apt: update_cache

安装pkgs时,Ansible失败,因为需要接受许可条款

如何通过ansible playbook自动接受条款

---
- hosts: client1
  remote_user: ansible
  become: True
  tasks:
    - name: testing
      apt_repository: repo=ppa:webupd8team/java state=present
    - name: updating
      apt: update_cache=yes
    - name: installaing oracle pkg
      apt: pkg=oracle-java8-installer state=present update_cache=yes

对于“包”,没有通用的方法

对于Oracle Java,在调用
apt
之前添加任务:

- debconf:
    name: oracle-java8-installer
    question: shared/accepted-oracle-license-v1-1
    value: true
    vtype: select

对于virtualbox ext pack

- debconf:
    name: virtualbox-ext-pack
    question: virtualbox-ext-pack/license
    value: "true"
    vtype: select

在apt install命令之前。

对于每个特定情况,如何找到问题的确切措辞?在安装了软件包的任何Debian或衍生产品上使用
debconf show
,查看可用的问题/设置。Oracle更改其许可方案后,使用WebUpd8team PPA的剧本不再有效。请参阅上的以下通知:“Oracle Java下载现在需要登录到Oracle帐户才能下载Java更新,如最新的Oracle Java 8u211/Java SE 8u212。因此,我无法使用最新的Java更新PPA(并且旧链接已被Oracle断开)。因此,此PPA已停止(除非我能找到绕过此限制的方法)。”