docker extra_host parameter expects a dictionary value for hostname, how can I use a variable?

前端 未结 1 1339
没有蜡笔的小新
没有蜡笔的小新 2021-01-29 01:53

In ansible playbook docker parameter extra_host takes two parts host: ip_address. I am trying to pass the host and ipaddress in as variables. They are from prompt vars. The end

1条回答
  •  鱼传尺愫
    2021-01-29 02:24

    Make server_host_ip dict with set_fact before your task:

    - set_fact:
        server_host_ip: "{'{{host_name}}':'{{host_ip}}'}"
    

    And use {{server_host_ip}} in the docker module.

    0 讨论(0)
提交回复
热议问题