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 result in my hosts file is: 1.2.3.4 {{server_hostname}}. Here is the code:
vars_prompt:
- name: "server_ip"
prompt: "Please enter the server IP address"
private: no
- name: "server_hostname"
prompt: "Please enter the server hostname"
private: no
tasks:
- name: Install Tomcat
docker:
image: tomcat:8.0
pull: missing
name: tomcat
state: restarted
ports:
- "8080:8080"
- "443:443"
extra_hosts:
"{{server_hostname}}": "{{server_ip}}"
I am new to ansible playbook any help would be greatly appreciated.