0

I have the following task in my ansible playbook:

- name: MOTD NX
  hosts: lab_nxos
  gather_facts: false
  connection: local
  become: false

  tasks:
    - name: add motd
      cisco.nxos.nxos_banner:
        banner: motd
        text: "{{ lookup('file', '/etc/ansible/motd.txt') }}"
        state: present
      register: output

    - name: print output
      debug:
        var: "{{ output }}"

Here is the motd.txt file:

"===========================================================
=              Lab                                        =
=          Contact: me@me.com                             =
=                                                         =
===========================================================
"

When I run the playbook it fails due to the '@' sign (remove it and it works fine). % Invalid command at '^' marker

I've tried escaping it with '@' and also '@@' but still same issue. Also tried the following format with same negative results:

- name: configure the exec banner
  cisco.nxos.nxos_banner:
    banner: exec
    text: |
      this is my exec banner
      that contains a multiline
      string
    state: present

Any help appreciated.

0 Answers0