Answer the question
In order to leave comments, you need to log in
How to remove spaces in configuration file when copying to file?
There is a task to remove backups from switches with ansymbol.
playbook
- name: sh running allied
hosts: switch
gather_facts: false
connection: network_cli
collections:
- alliedtelesis.awplus
tasks:
- name: run show version on remote devices
awplus_command:
commands:
- command: 'sh run'
register: config
- name: write
copy:
content: "{{config.stdout}}"
dest: "/etc/allied_ansible/{{ inventory_hostname }}"
nplatform hwfilter-size ipv4-full-ipv6\n!\nno service telnet\n!\nservice http\n!\nclock timezone MSK plus 3:00\n!\nno snmp-server ipv6\nsnmp-server community public \n!\n!\naaa authentication enable default local\naaa authentication login default local\n!\n!\n!\nstack virtual-chassis-id 1711\n!\n!\n!\nntp peer 10.13.2.1\n!\n!\nip name-server
Answer the question
In order to leave comments, you need to log in
https://blog.noblinkyblinky.com/2020/10/26/capturi...
content: "{{ config.stdout | replace('\\n', '\n') }}"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question