How can I use Ansible to claim that I accept the Microsoft EULA agreement for ttf-mscorefonts-installer?

How can I accept the Microsoft EULA agreement for ttf-mscorefonts-installer? lists some ways to achieve this (GUI, script, puppet config).

But I am at loss how to handle echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true in Ansible.

Simply running this command on every run of Ansible playbook seems substandard.


Solution 1:

Got this problem on Ubuntu 20.04 with Ansible 2.11 when trying to install ubuntu-restricted-extras meta package that includes ttf-mscorefonts-installer.

With @bstabens answer and comment, I figured out how to accept msttcorefonts license agreement.

On an already installed machine, I checked which question I add to agree during msttcorefonts install

debconf-show ttf-mscorefonts-installer command gave me this output

* msttcorefonts/accepted-mscorefonts-eula: true
  msttcorefonts/dldir:
  msttcorefonts/baddldir:
  msttcorefonts/error-mscorefonts-eula:
* msttcorefonts/present-mscorefonts-eula:
  msttcorefonts/dlurl:

Saying that I've answered true to msttcorefonts/accepted-mscorefonts-eula question.

I then wrote my playbook like this :

---
- hosts : dev
  tasks:
    - name: prepare eula 
      debconf:
        name: ttf-mscorefonts-installer
        question: msttcorefonts/accepted-mscorefonts-eula
        vtype: boolean
        value: true

    - name: Install a list of packages
      apt:
        update_cache: yes
        state: latest
        pkg:
        - ubuntu-restricted-extras
        - ... OTHER PACKAGES HERE

  become : yes
  become_method : sudo

Invoked it with ansible-playbook my_playbook.yaml --ask-become-pass and it worked like a charm.