LoginSignup
2
3

More than 5 years have passed since last update.

Ansibleで「template error while templating string: expected token」というエラーが起こった時の対処方法

Last updated at Posted at 2016-07-16

原因

Capistranoで自動デプロイ環境をAnsibleにて構築していた時、下記の箇所で「template error while templating string: expected token」というエラーが起こった。Ansibleの変数は{{ 変数名 }}で参照できるが{{{ 変数名 }}となっていたため変数として認識できずエラーを起こしていた。

role :app, %w{{{ public_user_name }}@localhost}

解決方法

下記のように{{{の箇所を{{ '{' }}{{と書き換えることでエスケープして解決出来た。

role :app, %w{{ '{' }}{{ public_user_name }}@localhost}

参考

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3