speechmatics.hostname

Ansible 角色:主机名

描述

此角色将设置任何目标主机的主机名。 默认情况下,主机名与 inventory_hostname 相同, 但可以通过使用变量进行不同设置。也会更新 hosts 文件。

要求

没有要求。

  • CentOs 5 需要安装 python-simplejson 包以进行一般 Ansible 工作。
  • Ubuntu 16.04 默认没有安装 python 包。该包是 Ansible 正常工作的必要条件。

角色变量

变量 默认值 说明
hostname_hosts_file_location "/etc/hosts" hosts 文件位置。
hostname_hosts_backup False 您可以在更改之前备份 hosts 文件。
hostname_fqdn_full inventory_hostname 默认情况下,此角色使用 inventory_hostname 从清单文件获取主机名,但您可以设置 hostname_fqdn_fullhostname_fqdn_short 来更改此行为。
hostname_fqdn_short inventory_hostname_short
hostname_hosts_ipv4_enabled true 当为 true 时,向 /etc/hosts 添加 IPv4 条目。
hostname_hosts_ipv6_enabled true 当为 true 时,向 /etc/hosts 添加 IPv6 条目。

依赖关系

独立角色。

示例剧本

- hosts: localhost
  roles:
    - { role: insspb.hostname }

开发信息

该角色是在社区的帮助下开发的。

开发过程遵循以下规则:

  • 您可以自由地向 master 分支添加任何拉取请求。
  • 如果您想做出贡献,但不知道从何开始 - 请检查问题。
  • 请为新功能提供文档。
  • 请使用变量。
  • 请勿忘记设置默认值。
  • 如果可能,请尽力保持向后兼容。
  • 请使用包管理安装作为默认的软件安装方法。如果可能,源代码安装必须是可选的。
  • 请使用官方软件开发者的仓库,而不是一般的 Debian/Ubuntu/Centos 等主要应用程序。
  • 尽量保持角色独立于任何其他角色。用户必须有选择使用哪些角色的方式。

注意:

  • CI 使用 ansible-lint 版本 4.x。

许可证

MIT

作者信息

该角色是 https://github.com/insspb/ansible-role-hostname 的分支。

发布流程

  1. 合并您的代码到 master 分支
  2. 添加一个 Git 标签,根据语义版本控制规则并推送
  3. 在 Github.com 创建一个发布

注意

标记功能分支也会触发发布,但效果不会如您预期(因此应避免)。

发布到 galaxy 的是 master 分支上的最新代码,而不是标记的代码。

详细信息请参见 https://github.com/speechmatics/ansible-role-hostname/pull/2

关于项目

This role will set hostname on any target host. By default hostname is same as inventory_hostname, but can be set as different by using vars. Updates hosts file too. This is a fork of original role by Andrey Shpak (https://github.com/insspb/ansible-role-h

安装
ansible-galaxy install speechmatics.hostname
许可证
mit
下载
13.1k
拥有者