March 2019
Intermediate to advanced
412 pages
9h 49m
English
Often, paths to various things are supplied with a user shortcut, such as ~/.stackrc. However, some tasks may require the full path to the file. Rather than the complicated command and register calls, the expanduser filter provides a way to expand the path to the full definition. In this example, the username is jfreeman:
---- name: demo the filters hosts: localhost gather_facts: false tasks: - name: demo filter debug: msg: "{{ '~/.stackrc' | expanduser }}"
The output is shown in the following screenshot:

We have successfully expanded the path here, which could be useful for creating configuration files or performing other file ...
Read now
Unlock full access