有没有办法解决这个 "debconf-show" 路径问题?

Is there a way to fix this "debconf-show" path issue?

我正在尝试使用 ansible 为 MYSQL 数据库设置根密码。然而,我正在使用 debconf,它让我误以为:

Failed to find required executable debconf-show in paths: /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin

我的 yaml 文件包含:

- name: set root password
  become: yes
  debconf:
    name: 'mysql-server'
    question: 'mysql-server/root_password'
    value: '{{mysql_password}}'
    vtype: 'password'

我用的是centos7。有人有想法吗?

看起来您缺少 debconf Ansible 模块 requires.

的一些主机要求

你试过添加它们吗?

- name: Install debconf requirements
  package:
    name: "{{ item }}"
    state: present
  with_items:
    - debconf
    - debconf-utils