在Hiera中进行基本数学运算 [英] Do basic math inside Hiera

查看:100
本文介绍了在Hiera中进行基本数学运算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试基于自定义事实和基本模数在hiera中设置crontab的工作日,但我什至不知道是否可能.

I'm trying to set a crontab's weekday in hiera based on a custom fact and a basic modulo but I can't even figure out if it's possible.

我想做类似的事情:

  cron-job:
    command:  "do something"
    user:    myuser
    hour:    "%{::instance}"
    minute:  "%{::instance}"
    weekday: "%{::instance}" % 7

那还能做到吗?

推荐答案

否,这是不可能的.请记住,YAML只是数据,而不是代码.

No, this is not possible. Please keep in mind that the YAML is just data, not code.

Hiera确实使用插值令牌提供了一些转换,但是只有您可以在其中使用的两个函数,无需算术.

Hiera does offer some transformations using Interpolation Tokens, but there are only two functions that you can use with these, no arithmetics.

这篇关于在Hiera中进行基本数学运算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆