Skip to content

Instantly share code, notes, and snippets.

@JanKoppe
Created May 27, 2019 10:03
Show Gist options
  • Save JanKoppe/2ea9751f847867df06edd8babbe3fe8b to your computer and use it in GitHub Desktop.
Save JanKoppe/2ea9751f847867df06edd8babbe3fe8b to your computer and use it in GitHub Desktop.
Ansible Templating issue
test:
multiline: |
f4x6aaBtLPQk898Ymfkn
TQsi69wDY40aluFbdp99
jqdGOkx9CN2xgWOM8JeI
M4lXnXyctLTDejDb2eZu
XBPmvqXJStQFZIQwHzLF
by0cxOYjrY3On6hj3oqk
Xu0Ze6Sz8EbC7udHsyxE
jNv0M7lWNJCfegOlDCJH
UK56XrCbPj6HD4HfwT57
dtwpXGkWMjhpe3UcMJJ8
[all]
localhost
- hosts: all
tasks:
- name: test templating
delegate_to: localhost
template:
src: template.yaml.j2
dest: "{{ playbook_dir }}/template.yaml"
multiline: 'f4x6aaBtLPQk898Ymfkn
TQsi69wDY40aluFbdp99
jqdGOkx9CN2xgWOM8JeI
M4lXnXyctLTDejDb2eZu
XBPmvqXJStQFZIQwHzLF
by0cxOYjrY3On6hj3oqk
Xu0Ze6Sz8EbC7udHsyxE
jNv0M7lWNJCfegOlDCJH
UK56XrCbPj6HD4HfwT57
dtwpXGkWMjhpe3UcMJJ8
'
{multiline: 'f4x6aaBtLPQk898Ymfkn
TQsi69wDY40aluFbdp99
jqdGOkx9CN2xgWOM8JeI
M4lXnXyctLTDejDb2eZu
XBPmvqXJStQFZIQwHzLF
by0cxOYjrY3On6hj3oqk
Xu0Ze6Sz8EbC7udHsyxE
jNv0M7lWNJCfegOlDCJH
UK56XrCbPj6HD4HfwT57
dtwpXGkWMjhpe3UcMJJ8
'}
f4x6aaBtLPQk898Ymfkn
TQsi69wDY40aluFbdp99
jqdGOkx9CN2xgWOM8JeI
M4lXnXyctLTDejDb2eZu
XBPmvqXJStQFZIQwHzLF
by0cxOYjrY3On6hj3oqk
Xu0Ze6Sz8EbC7udHsyxE
jNv0M7lWNJCfegOlDCJH
UK56XrCbPj6HD4HfwT57
dtwpXGkWMjhpe3UcMJJ8
{{ test | to_nice_yaml }}
{{ test | to_yaml }}
{{ test.multiline }}
$ ansible --version
ansible 2.8.0
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/j/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.7.3 (default, Mar 26 2019, 21:43:19) [GCC 8.2.1 20181127]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment