Line too long, need to break over two lines -

I’m using yamllint to validate my code and its telling me my line is too long - read many posts online, and can’t understand how to fix this.

  • name: copy multiple items into multiple locations
    copy:
    src: “{{ item.src }}”
    dest: “{{ item.dest }}”
    owner: “{{ item.owner }}”
    mode: “{{ item.mode }}”
    with_items:
  • {src: ‘/home/user/motd’, dest: ‘/etc/motd’, owner: “root”, mode: ‘0644’}
  • {src: ‘/home/user/file’, dest: ‘/etc/file’, owner: “root”, mode: ‘0600’}

How can i take the last two lines and have them over two lines each?

thank you :slight_smile:
Rick

I'm using yamllint to validate my code and its telling me my line is too
long - read many posts online, and can't understand how to fix this.

You don't need to fix it, Ansible doesn't care about how long a lines is.

- name: copy multiple items into multiple locations
  copy:
      src: "{{ item.src }}"
      dest: "{{ item.dest }}"
      owner: "{{ item.owner }}"
      mode: "{{ item.mode }}"
  with_items:
      - {src: '/home/user/motd', dest: '/etc/motd', owner: "root", mode:
'0644'}
      - {src: '/home/user/file', dest: '/etc/file', owner: "root", mode:
'0600'}

How can i take the last two lines and have them over two lines each?

One way to write it is like this:

  with_items:
      - src: '/home/user/motd'
        dest: '/etc/motd'
        owner: "root"
        mode: '0644'
      - src: '/home/user/file'
        dest: '/etc/file'
        owner: "root"
        mode: '0600'