Line too long, need to break over two lines -

15 views
Skip to first unread message

richard d

unread,
Jan 31, 2018, 12:36:21 PM1/31/18
to Ansible Project
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 :)
Rick

Kai Stian Olstad

unread,
Jan 31, 2018, 1:14:13 PM1/31/18
to ansible...@googlegroups.com
On Wednesday, 31 January 2018 18.36.20 CET richard d wrote:
> 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'


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages