manala.motd
#######################################################################################################
:exclamation: 废弃通知 :exclamation:
本仓库及相关角色已废弃,推荐使用 Manala Ansible Collection
您可以在 集合仓库 中找到使用说明
#######################################################################################################
Ansible 角色:每日消息 
:exclamation: 报告问题 和 发送拉取请求 到 主要的 Ansible 角色仓库 :exclamation:
该角色用于设置每日消息。
它是 Manala Ansible 堆栈 的一部分,但也可以作为独立组件使用。
要求
无。
依赖项
无。
安装
Ansible 2+
使用 ansible galaxy 命令行工具:
ansible-galaxy install manala.motd
使用 ansible galaxy 需求文件:
- src: manala.motd
角色处理程序
无
角色变量
名称 | 默认值 | 类型 | 描述 |
---|---|---|---|
manala_motd_scripts_exclusive |
false | 布尔值 | 脚本独占性 |
manala_motd_scripts_dir |
'/etc/update-motd.d' | 字符串 | 脚本目录路径 |
manala_motd_scripts_defaults |
{} | 数组 | 默认脚本参数 |
manala_motd_scripts |
[] | 数组 | 脚本 |
manala_motd_template |
'template/_default.j2' | 字符串 | 模板路径 |
manala_motd_message |
~ | 字符串 | 消息 |
配置示例
使用脚本(推荐)
manala_motd_scripts_exclusive: true # 仅保留定义的脚本
manala_motd_scripts:
# 基于模板(文件名基于模板)
- template: scripts/uname.j2
# 基于模板(强制文件名)
- file: 10-uname
template: scripts/uname.j2
# 简单自定义消息
- file: 20-message
message: Hello world!
# 预定义模板(cow|dragon|stegosaurus|turkey|yoda)
# 配以冰岛语自定义消息
- file: 30-template
template: scripts/cow.j2
message: Hjartað hamast
# 原始脚本
- file: 40-raw
script: |
#!/bin/sh
printf "Hello world!\n"
# 确保脚本不存在
- file: 50-absent
message: Look mum no hands!
state: absent # 默认值为 "present"
# 忽略脚本
- file: 60-ignore
message: Look daddy there's an airplane up in the sky!
state: ignore
# 展平脚本
- "{{ my_custom_scripts_array }}"
静态模板(已废弃)
manala_motd_template: template/turkey.j2 # 预定义模板(cow|dragon|stegosaurus|turkey|yoda)
manala_motd_message: My awesome message # 自定义消息
示例剧本
- hosts: servers
roles:
- role: manala.motd
许可证
MIT
作者信息
Manala (http://www.manala.io/)