mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
Added ansible templating example
This commit is contained in:
@@ -74,3 +74,7 @@
|
||||
salt: "{{ lookup('community.general.random_string', special=false) }}"
|
||||
ansible.builtin.debug:
|
||||
var: password | password_hash('sha512', salt)
|
||||
|
||||
- name: Get a variable's type.
|
||||
ansible.builtin.debug:
|
||||
var: "'string' | type_debug"
|
||||
|
||||
@@ -121,12 +121,18 @@ ansible-galaxy remove namespace.role
|
||||
salt: "{{ lookup('community.general.random_string', special=false) }}"
|
||||
ansible.builtin.debug:
|
||||
var: password | password_hash('sha512', salt)
|
||||
|
||||
- name: Get a variable's type.
|
||||
ansible.builtin.debug:
|
||||
var: "'string' | type_debug"
|
||||
```
|
||||
|
||||
## Loops
|
||||
|
||||
```yaml
|
||||
- name: Fail when one of the given variables is an empty string.
|
||||
- name: >-
|
||||
Fail when any of the given variables is an empty string.
|
||||
Returns the ones which are.
|
||||
when: lookup('vars', item) == ''
|
||||
ansible.builtin.fail:
|
||||
msg: "The {{ item }} variable is an empty string"
|
||||
|
||||
Reference in New Issue
Block a user