
上QQ阅读APP看书,第一时间看更新
Overriding variables
Before we finish, we should quickly discuss how we can override the default variables we have been setting. To do this, add the following lines to group_vars/common.yml file:
html_body: |
This HTML page has been deployed using Ansible to <b>{{ ansible_nodename }}</b>.<br>
The user is <b>{{ users.0.name }}</b> who is in the <b>{{ apache_group }}</b> group.<br>
The weboot is <b>{{ document_root }}</b>, the default index file is <b>{{ index_file }}</b>.<br>
You can access a <a href="/info.php">PHP Info file</a> or <a href="/adminer/">Adminer</a>.
Then, rerun the playbook. Once the playbook has finished, opening http://192.168.50.4.nip.io/ will show you the following page:

As you can see, the default index.html page has been updated with a link to our phpinfo page and also Adminer. Any of the variables we have configured as default can be overridden in this way.