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