gibbs.update_motd
Ansible 角色: 更新 MOTD
描述
管理 Ubuntu 和 Debian 上的动态 MOTD 脚本。
安装
Ansible Galaxy
从 Ansible Galaxy 安装角色:
$ ansible-galaxy install gibbs.update_motd
示例
Playbook
Playbook 示例:
- hosts: all
roles:
- gibbs.update_motd
禁用 MOTD 脚本
通过传递文件名列表给 update_motd_disable_scripts
来禁用 MOTD 脚本。 /etc/update-motd.d/
下的所有其他脚本都会启用。
- hosts: all
roles:
- gibbs.update_motd
vars:
update_motd_disable_scripts:
- 88-esm-announce
- 91-release-upgrade
- 91-contract-ua-esm-status
添加自定义 MOTD 脚本
此角色会自动启用 /etc/update-motd.d/
下的任何未显式禁用的脚本。您如何将新脚本添加到主机上则完全取决于您:
- hosts: all
tasks:
- name: 复制我的 motd 脚本
ansible.builtin.copy:
src: files/my-script.sh
dest: /etc/update-motd.d/50-my-script
notify: "更新动态 motd"
角色变量
所有可以被重写的角色变量都可以在 defaults/main.yml 中找到。
名称 | 默认值 | 描述 |
---|---|---|
update_motd_remove_motd_directory |
false | 如果存在,是否删除 /etc/motd |
update_motd_package_name |
update-motd | 需要管理的 update-motd 包名(仅限 Ubuntu) |
update_motd_package_state |
present | update-motd 包的状态(仅限 Ubuntu) |
update_motd_service_state |
start | update-motd 服务的状态(仅限 Ubuntu) |
update_motd_service_enabled |
true | 是否启用 update-motd 服务(仅限 Ubuntu) |
update_motd_landscape_state |
present | landscape-common 包的状态(仅限 Ubuntu) |
update_motd_disable_motd_service |
true | 是否禁用 motd 服务(如果存在) |
update_motd_disable_scripts |
98-cloudguest | 要禁用的 MOTD 脚本文件名列表 |
默认 MOTD 脚本
Debian 和 Ubuntu 上常用的默认 MOTD 脚本名称列表。
文件名 | 发行版 |
---|---|
00-header |
Ubuntu 14, 16, 18, 20 |
10-help-text |
Ubuntu 14, 16, 18, 20 |
10-uname |
Debian 9, 10 |
50-landscape-sysinfo |
Ubuntu 14, 18, 20 |
50-motd-news |
Ubuntu 16, 18, 20 |
85-fwupd |
Ubuntu 20 |
88-esm-announce |
Ubuntu 16, 18, 20 |
90-updates-available |
Ubuntu 14, 16, 18 |
91-contract-ua-esm-status |
Ubuntu 16, 18, 20 |
91-release-upgrade |
Ubuntu 14, 16, 18, 20 |
92-unattended-upgrades |
Ubuntu 16, 18, 20 |
95-hwe-eol |
Ubuntu 14, 18, 20 |
97-overlayroot |
Ubuntu 14, 16, 18, 20 |
98-cloudguest |
Ubuntu 14 |
98-fsck-at-reboot |
Ubuntu 14, 16, 18, 20 |
98-reboot-required |
Ubuntu 14, 16, 18, 20 |
支持的系统
- Debian 9 stretch
- Debian 10 buster
- Debian 11 bullseye
- Ubuntu 14.04 Trusty Tahr
- Ubuntu 16.04 Xenial Xerus
- Ubuntu 18.04 Bionic Beaver
- Ubuntu 20.04 Focal Fossa
许可证
根据 MIT 许可证授权。请参阅 LICENSE。