- Puppet 5 Essentials(Third Edition)
- Martin Alfke Felix Frank
- 171字
- 2021-07-02 18:22:22
Using variables
Variable assignment works just like it does in most scripting languages. Any variable name is always prefixed with the $ sign:
$download_server = 'img2.example.net'
$url = "https://${download_server}/pkg/example_source.tar.gz"
Also, just like most scripting languages, Puppet performs variable value substitution in strings that are in double quotes, but no interpolation at all in single-quoted strings.
Variables are useful for making your manifest more concise and comprehensible. They help you with the overall goal of keeping your source code free from redundancy. An important distinction from variables in imperative programming and scripting languages is the immutability of variables in Puppet manifests. Once a value has been assigned, it cannot be overwritten.
Why is it called a variable at all if it is a constant? One should never look at Puppet as a tool that manages a single system. For a single system, a Puppet variable might look like a constant, but Puppet manages a multitude of systems with different operating systems. Across all these systems, variables will be different and not constants.
- Debian 7:System Administration Best Practices
- PHP基礎(chǔ)案例教程
- 構(gòu)建移動網(wǎng)站與APP:HTML 5移動開發(fā)入門與實戰(zhàn)(跨平臺移動開發(fā)叢書)
- 實戰(zhàn)Java程序設(shè)計
- Java Web程序設(shè)計
- 軟件項目管理實用教程
- 常用工具軟件立體化教程(微課版)
- Learning AngularJS for .NET Developers
- C++ Fundamentals
- Java Web開發(fā)實例大全(基礎(chǔ)卷) (軟件工程師開發(fā)大系)
- Java程序設(shè)計實用教程(第2版)
- Mastering Python
- 你好!Python
- 3D Printing Designs:Design an SD Card Holder
- Magento 2 Developer's Guide