community.general.locale_gen 模块 – 创建或删除语言环境

注意

此模块是 community.general 集合 (版本 10.1.0) 的一部分。

如果您正在使用 ansible 软件包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install community.general

要在 playbook 中使用它,请指定: community.general.locale_gen

摘要

  • 通过编辑 /etc/locale.gen 并调用 locale-gen 来管理语言环境。

参数

参数

注释

name

列表 / 元素=字符串 / 必需

语言环境的名称和编码,例如 en_GB.UTF-8

在 community.general 9.3.0 之前,这是一个字符串。使用字符串仍然有效。

state

字符串

语言环境是否应该存在。

选项

  • "absent"

  • "present" ← (默认)

属性

属性

支持

描述

check_mode

支持:完全支持

可以在 check_mode 下运行,并在不修改目标的情况下返回更改状态预测。

diff_mode

支持:不支持

在差异模式下,将返回有关已更改内容(或可能需要在 check_mode 中更改的内容)的详细信息。

备注

注意

  • 此模块不支持基于 RHEL 的系统。

示例

- name: Ensure a locale exists
  community.general.locale_gen:
    name: de_CH.UTF-8
    state: present

- name: Ensure multiple locales exist
  community.general.locale_gen:
    name:
      - en_GB.UTF-8
      - nl_NL.UTF-8
    state: present

作者

  • Augustus Kling (@AugustusKling)