YAML の書き方
参考:
プログラマーのための YAML 入門 初級編 | Rubyist Magazine (るびま)
Ansible のための YAML 入門 | DevelopersIO
Learn yaml in Y Minutes | Learn X in Y Minutes
YAML Syntax | Ansible Documentation
Reference | YAML Ain’t Markup Language [Official]
概要
参考:
スカラー値
YAML では、以下のデータ型を自動的に判別する。
- 整数
- 浮動小数点
- 真偽値 (
true
/yes
/false
/no
) - Null値 (
null
/~
) - 日付 (
yyyy-mm-dd
) - タイムスタンプ (
yyyy-mm-dd hh:mm:ss [+-]hh:mm
)
これら以外は文字列として認識される。また引用符「'
」や二重引用符「"
」で囲むと、強制的に文字列として認識される。
参考:
スカラーとデータ型 – プログラマーのための YAML 入門 初級編 | Rubyist Magazine (るびま)
YAML での true とか nil とか空文字列とか [] の出力 | Going My Ruby Way
アンカーとエイリアスを使う
参考:
YAML の Anchor と Alias を使って config を DRY に書く | valid, invalid
Link for variables in group vars – Stack Overflow
Using YAML anchors in Ansible role tasks file – Stack Overflow
Override YAML subkey – Stack Overflow
Using node anchors and merge keys split over different yaml files – Stack Overflow
extend
参考:
yaml の anchor で継承 (extend) して繰り返し書いている部分を減らすメモ | ひと夏の技術
Anchors, References, Extend | daemonl
キーにアンカーを使う
参考:
Anchors for keys? – Stack Overflow
エイリアスを展開する
参考:
alias を展開して出力するツールを作りました | Shin x Blog
タグ
参考:
I don’t understand what a YAML tag is – Stack Overflow
タグディレクティブ
参考:
TAG Directives | YAML Version 1.2 [Official]
オンラインツール
参考:
Online YAML Parser (yaml-online-parser.appspot.com)
Best YAML Formatter: Format & Beautify YAML | MTP Tools
Best YAML Validator Online (codebeautify.org)
サイト
参考: