- name: ‘Install required packages through LOOPS’
hosts: DEV_NIFI_AMB_RANGER_1.12
vars:
packages:
- httpd
- nfs-utils
- wget
- telnet
- ntp
- nscd
tasks:
-
yum:
name: ‘{{ item }}’
state: ‘present’
update_cache: True
loop: ‘{{packages}}’
ansible-playbook -i /opt/scripts/ansible/inventory/inventory.txt /opt/scripts/ansible/code/install_nifi_loop.yml
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
PLAY [Install required packages] ******************************************************************************************************************************
TASK [Gathering Facts] ****************************************************************************************************************************************
ok: [ldappambari01]
ok: [ldappranger001]
ok: [ldappnifirgt001]
ok: [ldappcdf002]
ok: [ldappcdf001]
ok: [ldappranger002]
TASK [yum] ****************************************************************************************************************************************************
fatal: [ldappambari01]: FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘item’ is undefined\n\nThe error appears to be in ‘/opt/scripts/ansible/code/install_nifi_loop.yml’: line 15, column 13, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n -\n yum:\n ^ here\n”}
fatal: [ldappcdf001]: FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘item’ is undefined\n\nThe error appears to be in ‘/opt/scripts/ansible/code/install_nifi_loop.yml’: line 15, column 13, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n -\n yum:\n ^ here\n”}
fatal: [ldappcdf002]: FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘item’ is undefined\n\nThe error appears to be in ‘/opt/scripts/ansible/code/install_nifi_loop.yml’: line 15, column 13, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n -\n yum:\n ^ here\n”}
fatal: [ldappnifirgt001]: FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘item’ is undefined\n\nThe error appears to be in ‘/opt/scripts/ansible/code/install_nifi_loop.yml’: line 15, column 13, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n -\n yum:\n ^ here\n”}
fatal: [ldappranger001]: FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘item’ is undefined\n\nThe error appears to be in ‘/opt/scripts/ansible/code/install_nifi_loop.yml’: line 15, column 13, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n -\n yum:\n ^ here\n”}
fatal: [ldappranger002]: FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘item’ is undefined\n\nThe error appears to be in ‘/opt/scripts/ansible/code/install_nifi_loop.yml’: line 15, column 13, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n -\n yum:\n ^ here\n”}
PLAY RECAP ****************************************************************************************************************************************************
ldappambari01 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
ldappcdf001 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
ldappcdf002 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
ldappnifirgt001 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
ldappranger001 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
ldappranger002 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0