![]() ![]() You can provide default values for variables directly in your templates using the Jinja2 ‘default’ filter. If you configure Ansible to ignore most undefined variables, you can mark some variables as requiring values with the mandatory filter. Searching strings with regular expressionsįilters can help you manage missing or undefined variables by providing defaults or making some variables optional. Hashing and encrypting strings and passwords Selecting from sets or lists (set theory) Selecting values from arrays or hashtables You can create custom Ansible filters as plugins, though we generally welcome new filters into the ansible-core repo so everyone can use them.īecause templating happens on the Ansible controller, not on the target host, filters execute on the controller and transform data locally.ĭefining different values for true/false/null (ternary)Ĭombining items from multiple lists: zip and zip_longest You can also use Python methods to transform data. You can use the Ansible-specific filters documented here to manipulate your data, or use any of the standard filters shipped with Jinja2 - see the list of built-in filters in the official Jinja2 template documentation. Controlling how Ansible behaves: precedence rulesįilters let you transform JSON data into YAML data, split a URL to extract the hostname, get the SHA1 hash of a string, add or multiply integers, and much more.Virtualization and Containerization Guides.Protecting sensitive data with Ansible vault Python’s OrderedDict is a dict subclass that preserves the order in which key-value pairs, commonly known as items, are inserted into the dictionary.Playbook Example: Continuous Delivery and Rolling Upgrades.Discovering variables: facts and magic variables.Working with language-specific version managers.Controlling where tasks run: delegation and local actions. ![]() ![]() Hashing and encrypting strings and passwords.Selecting from sets or lists (set theory).Defining different values for true/false/null (ternary). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |