Hi
I am writing a post build verification task and servers are located in three difference location.
US, EU and AU
I want to check chrony.conf output so that if servers in group_names US it should check chrony.conf file to see server parameter is reflect NTP server in that region and so on. How do I achieve this goal.
In /var/main.yml I have following server list
ntp_server1: "IP address based on location"
ntp_server2: "IP address based on location"
ntp_server3: "IP address based on location"
ntp_server4: "IP address based on location"
ntp_server5: "IP address based on location"
ntp_server6: "IP address based on location"
in task/main.yml
I have following task
- name: read the chrony file
shell: grep 'server' /etc/chrony.conf
register: source_one
From here I don't know how to proceed further to check how ntp_server1 to ntp_server6 based on location.
I have jinja2 template in template directory
{% if 'US' in group_names %}
server {{ ntp_server1 }}
server {{ ntp_server2 }}
{% elif 'AU' in group_names %}
server {{ ntp_server3 }}
server {{ ntp_server4 }}
{% else %}
server {{ ntp_server5 }}
server {{ ntp_server6 }}
{% endif %}
Not sure how to integrate with the verification task. Please help me how to achieve verification outcome based on location.
Regards,
Siva