Skip to content

Commit

Permalink
jinja spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Jan 8, 2025
1 parent df22608 commit 64582f5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions tests/playbooks/backup-cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
tasks:
- name: Delete old config files
ansible.builtin.file:
path: "{{item}}"
path: "{{ item}}"
state: absent
with_fileglob:
- "/tmp/{{inventory_hostname}}.cfg.*"
- "/tmp/{{ inventory_hostname }}.cfg.*"

- name: Get entire running config
nokia.srlinux.get:
Expand All @@ -22,16 +22,16 @@

- name: Save fetched config in JSON
ansible.builtin.copy:
content: "{{response.result[0] | to_nice_json}}"
dest: "/tmp/{{inventory_hostname}}.cfg.json"
content: "{{ response.result[0] | to_nice_json }}"
dest: "/tmp/{{ inventory_hostname }}.cfg.json"

- name: Save fetched config in YAML
ansible.builtin.copy:
content: "{{response.result[0] | to_nice_yaml}}"
dest: "/tmp/{{inventory_hostname}}.cfg.yml"
content: "{{ response.result[0] | to_nice_yaml }}"
dest: "/tmp/{{ inventory_hostname }}.cfg.yml"

- name: check if saved file contains "srl_nokia"
ansible.builtin.shell:
cmd: "grep srl_nokia {{item}}"
cmd: "grep srl_nokia {{ item }}"
with_fileglob:
- "/tmp/{{inventory_hostname}}.cfg.*"
- "/tmp/{{ inventory_hostname }}.cfg.*"
2 changes: 1 addition & 1 deletion tests/playbooks/cli-put-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
tasks:
- name: template config
ansible.builtin.template:
src: "{{playbook_dir}}/golden/{{inventory_hostname}}-golden.cfg.json.j2"
src: "{{ playbook_dir }}/golden/{{ inventory_hostname }}-golden.cfg.json.j2"
dest: /tmp/config.json
# - name: Run "show version" CLI command with text output format
# hosts: clab
Expand Down
4 changes: 2 additions & 2 deletions tests/playbooks/golden/clab-ansible-srl-golden.cfg.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -1587,12 +1587,12 @@
"srl_nokia-interfaces:interface": [
{
"admin-state": "enable",
"description": "ethernet-1/1 interface on {{inventory_hostname}}",
"description": "ethernet-1/1 interface on {{ inventory_hostname }}",
"name": "ethernet-1/1"
},
{
"admin-state": "enable",
"description": "{{inventory_hostname}} management interface",
"description": "{{ inventory_hostname }} management interface",
"name": "mgmt0",
"subinterface": [
{
Expand Down
2 changes: 1 addition & 1 deletion tests/playbooks/replace-full-cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
nokia.srlinux.config:
replace:
- path: /
value: "{{lookup('ansible.builtin.template', '{{playbook_dir}}/golden/{{inventory_hostname}}-golden.cfg.json.j2') }}"
value: "{{ lookup('ansible.builtin.template', '{{ playbook_dir }}/golden/{{ inventory_hostname }}-golden.cfg.json.j2') }}"
register: set_response
diff: true
# check_mode: true
Expand Down

0 comments on commit 64582f5

Please sign in to comment.