Commit a738fec8 by nadeemshahzad

Enable auto security updates for amazon linux

parent f626f23a
......@@ -34,4 +34,6 @@ security_debian_pkgs:
- unattended-upgrades
- gcc
security_redhat_pkgs: []
security_redhat_pkgs:
- yum-plugin-security
- yum-cron
......@@ -23,3 +23,7 @@
- include: security-ubuntu.yml
when: ansible_distribution == 'Ubuntu'
- include: security-amazon.yml
when: ansible_distribution == 'Amazon'
---
#### Enable periodic security updates
- name: Install security packages
yum:
name: "{{ item }}"
state: latest
update_cache: yes
with_items: "{{ security_redhat_pkgs }}"
- name: Enable automatic start for update service
service:
name: yum-cron
enabled: yes
state: started
- name: Update all system packages
yum:
name: '*'
state: latest
when: SAFE_UPGRADE_ON_ANSIBLE
- name: Configure security auto-updates
lineinfile:
dest: /etc/yum/yum-cron.conf
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: '^update_cmd', line: 'update_cmd = security' }
- { regexp: '^apply_updates', line: 'apply_updates = yes' }
- name: "Take security updates during ansible runs"
command: "{{ item }}"
when: SECURITY_UPGRADE_ON_ANSIBLE
with_items:
- yum check-update --security
- yum update --security -y
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment