MySQL 8 的 Ansible 安装 - 在没有 mysql-apt-config 的情况下安装存储库

Ansible installation of MySQL 8 - installing repository without mysql-apt-config

我正在尝试使用 ansible 自动安装 MySQL 8。

但是,此安装需要获取 mysql-apt-config。安装后,打开配置 window

我想绕过此配置,而是使用 apt_repository 在 ansible 中获取存储库。

正确的地址是什么?我在哪里可以找到这个存储库地址,以便我可以使用 apt 下载并安装 MySQL?

这给 ansible 带来了问题——我不知道如何在这个 window 中添加一个选项。我试过了 expect module

- name: install mysql repo
  expect:
    command: "dpkg -i /tmp/mysql-apt-config.deb"
    responses: 
      Question:
        - response4
  become: yes
  become_method: sudo

然而这引发了以下错误

TASK [mysql : install mysql repo] ******************************************************************************
fatal: [testserver]: FAILED! => {"changed": false, "msg": "The pexpect python module is required"}

我检查过,pexpect 模块可用。

是否可以在没有此提示的情况下手动添加 MySQL 个存储库?

以防万一有人会寻找类似的答案:

要使用 ansible 安装 MySQL 8,这是您应该添加的存储库:

- name: Add MySQL 8 ubuntu xenial repository
  apt_repository: 
    repo: "deb http://repo.mysql.com/apt/ubuntu xenial mysql-8.0"
    state: present

编辑地址以匹配您的分布。其余过程是自动的,更重要的是 - 无声。

我找到了仓库地址here.

select您的版本的另一种方式:

- name: Try to specify preference for mysql
  shell: echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | debconf-set-selections
  become: yes

# Download mysql debian package
- name: Add mysql apt-config debian
  apt: deb=http://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb update-cache=yes
  become: yes