Learning Ansible 2.7(Third Edition)
上QQ阅读APP看书,第一时间看更新

Variables

As we have seen, we can print variable content simply by using the {{ VARIABLE_NAME }} syntax. If we want to print just an element of an array, we can use {{ ARRAY_NAME['KEY'] }}, and if we want to print a property of an object, we can use {{ OBJECT_NAME.PROPERTY_NAME }}.

So, we can improve our previous static page in the following way:

<html> 
    <body> 
        <h1>Hello World!</h1> 
        <p>This page was created on {{ ansible_date_time.date }}.</p> 
    </body> 
</html>