通常は変数展開される
tower_credential_type
モジュールを利用して、カスタムクレデンシャルの injectors
オプションを利用して、以下のような値を投入する Playbook を作ろうと思ったことがありました。
しかし、以下の「ここ」のように普通にしていしまうと、custom_user
や custom_password
という変数を展開しようとして、変数が undifined
というエラーになってしまいます。
- name: cred_type_custom description: my credential type kind: cloud inputs: fields: - type: string id: custom_user label: custom_user - type: string id: custom_password label: custom_password secret: true required: - custom_user - custom_password injectors: extra_vars: custom_user: '{{ custom_user }}' # ここ custom_password: '{{ custom_password }}' # ここ
!unsafe
タグを使用する
以下のように、!unsafe
タグを付けると展開されなくなり、文字列として指定できます。
...(略)... extra_vars: custom_user: !unsafe '{{ custom_user }}' custom_password: !unsafe '{{ custom_password }}'
他に良い方法ありそうですが思いつかず・・・