How does Ansible skip the human interaction page during package installation

Viewed 213

I would like to upgrade MySQL from 5.7 to 8.0 on my Ubuntu 18.04

I installed the package with the command :

$ sudo dpkg -i mysql-apt-config_0.8.22-1_all.deb

And I have this page pop up and need to manually select the option. enter image description here

Is there any way I can do automatic upgrade MySQL by Ansible?

I am very new to Ansible, any help is appreciated!

1 Answers

You should just be able to use the normal apt module to install your .deb file:

- hosts: localhost
  tasks:
    - apt:
        deb: /path/to/mysql-apt-config_0.8.22-1_all.deb

To answer your question about suppressing the configuration dialog:

You can skip that dialog yourself by setting the DEBIAN_FRONTEND environment variable to noninteractive before running dpkg or apt commands:

sudo env DEBIAN_FRONTEND=noninteractive dpkg -i mysql-apt-config_0.8.22-1_all.deb

The DEBIAN_FRONTEND variable can take other values; you can read more here.

Related