I am using ansible role. I have two dev servers, but I want to setup host variables based on the hosts.
I have created environments directory and also I created one directory dev
Environment > dev > main.yaml
all:
hosts:
host1.example.com:
vars:
file_name: “app1.jar”
SERVER_PATH: “/apps1”
I have another dev machine with hosts2.example.com with different variable
all:
hosts:
host2.example.com:
vars:
file_name: “app2.jar”
SERVER_PATH: “/apps2”
How can I put it in the same main.yaml file
I tried to put the below format but not workin.
all:
hosts:
host1.example.com:
vars:
file_name: “app1.jar”
SERVER_PATH: “/apps1”
hosts:
host2.example.com:
vars:
file_name: “app2.jar”
SERVER_PATH: “/apps2”