You indentation on with_items is wrong.
with_items is a property for the task and not yum_repository, so indentation should be at the same level as name and yum_repository.
No its still the same,
=========samer error
atal: [192.168.211.129]: FAILED! => {“failed”: true, “msg”: “the field ‘args’ has an invalid value, which appears to include a variable that is undefined. The error was: ‘item’ is undefined\n\nThe error appears to have been in ‘/etc/ansible/lamp.yml’: line 3, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n tasks:\n - name: "install EPEL and Remi reps"\n ^ here\n”}
fatal: [192.168.211.130]: FAILED! => {“failed”: true, “msg”: “the field ‘args’ has an invalid value, which appears to include a variable that is undefined. The error was: ‘item’ is undefined\n\nThe error appears to have been in ‘/etc/ansible/lamp.yml’: line 3, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n tasks:\n - name: "install EPEL and Remi reps"\n ^ here\n”}
fatal: [192.168.211.131]: FAILED! => {“failed”: true, “msg”: "the field ‘args’ has an invalid value, which appears to include a variable that is undefined. The error was: ‘item’ is undefined\n\nThe error appears to have been in ‘/etc/ansible/lamp.yml’: line 3, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n tasks:\n - nam
No its still the same,
That's as expected, you with_items indentation is exactly the same as your previous mail.
- hosts: all
tasks:
- name: "install EPEL and Remi reps"
yum_repository:
name: "{{ item.href }}"
basurl: "{{ item.repo }}"
with_items:
- { href:
"http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm",
repo: "/etc/yum.repos.d/epel.repo" }
- { href:
"http://rpms.famillecollet.com/enterprise/remi-release-7.rpm", repo:
"/etc/yum.repos.d/remi.repo" }
Your with_items: is indented too fare, remove 2 space in front of it.
- name: "install EPEL and Remi reps"
yum_repository:
name: "{{ item.href }}"
basurl: "{{ item.repo }}"
with_items:
- { href: "http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm", repo: "/etc/yum.repos.d/epel.repo" }
- { href: "http://rpms.famillecollet.com/enterprise/remi-release-7.rpm", repo: "/etc/yum.repos.d/remi.repo" }