I'm fairly new to ansible, i wrote a playbook that will be used for checking and installing kernel upgrades for multiple machines but I keep running into the issue below.
*ERROR! 'register' is not a valid attribute for a Play
The error appears to have been in '/etc/ansible/kernel_upgrade/tasks/main.yml': line 4, column 5, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: View current kernel version
^ here*
here is what I have in my playbook.
---
# tasks file for kernel_upgrade
- name: View current kernel version
command: uname -mrs
register: uname_result
- debug: msg="{{uname_result.stdout_lines}}"
tags:
- current kernel versions
- name: update kernel version
apt:
update_cache: yes
upgrade: dist
when: ansible_distribution == 'Ubuntu'
tags:
- Upgrading kernel Ubuntu
- name: update kernel CentOS
yum:
update_cache: yes
upgrade: dist
when: ansible_distribution == 'CentOS'
tags:
- Upgrading Kernel CentOS
- name: Reboot box if kernel/libs updated and requested by the system
shell: sleep 10 && /sbin/shutdown -r now
args:
removes: /var/run/reboot-required
async: 300
poll: 0
ignore_errors: true
tags:
- system reboot to apply latest patches
- name: Wait for system to become reachable again
wait_for_connection:
delay: 60
timeout: 300
tags:
- wait for system to become reachable again
- name: Verify new update
command: uname -mrs
register: uname_result
tags:
- verifying new update
- name: Display new kernel version
debug: msg="{{uname_result.stdout_lines}}"
tags:
- new kernel version
...