diff --git a/ansible/roles/yum-cron/defaults/main.yml b/ansible/roles/yum-cron/defaults/main.yml new file mode 100644 index 000000000..ff3c1b530 --- /dev/null +++ b/ansible/roles/yum-cron/defaults/main.yml @@ -0,0 +1,3 @@ +--- + +yum_cron_enabled: false diff --git a/ansible/roles/yum/handlers/main.yml b/ansible/roles/yum-cron/handlers/main.yml similarity index 100% rename from ansible/roles/yum/handlers/main.yml rename to ansible/roles/yum-cron/handlers/main.yml diff --git a/ansible/roles/yum-cron/tasks/main.yml b/ansible/roles/yum-cron/tasks/main.yml new file mode 100644 index 000000000..922950ba5 --- /dev/null +++ b/ansible/roles/yum-cron/tasks/main.yml @@ -0,0 +1,23 @@ +--- + +- name: Yum | Install yum-cron (CentOS) + yum: + name: yum-cron + state: present + when: yum_cron_enabled + +- name: Replace | Enable update applying for yum-cron (CentOS) + replace: + dest: /etc/yum/yum-cron.conf + regexp: "^apply_updates = no" + replace: "apply_updates = yes" + when: yum_cron_enabled + notify: + - Restart yum-cron + +- name: Service | Enable yum-cron (CentOS) + service: + name: yum-cron + state: started + enabled: yes + when: yum_cron_enabled diff --git a/ansible/roles/yum/defaults/main.yml b/ansible/roles/yum/defaults/main.yml index 7a8bf2de0..e9e4c8611 100644 --- a/ansible/roles/yum/defaults/main.yml +++ b/ansible/roles/yum/defaults/main.yml @@ -2,8 +2,6 @@ # Whether or not to use a local Yum mirror. yum_use_local_mirror: false -# Whether or not yum-cron is enabled. -yum_cron_enabled: false # Mirror FQDN for Yum repos. yum_centos_mirror_host: 'mirror.centos.org' # Mirror directory for Yum CentOS repos. diff --git a/ansible/roles/yum/tasks/redhat.yml b/ansible/roles/yum/tasks/redhat.yml index 4206a6daa..750fbce30 100644 --- a/ansible/roles/yum/tasks/redhat.yml +++ b/ansible/roles/yum/tasks/redhat.yml @@ -36,25 +36,3 @@ yum: update_cache: yes when: ansible_os_family == 'RedHat' - -- name: Yum | Install yum-cron (CentOS) - yum: - name: yum-cron - state: present - when: yum_cron_enabled - -- name: Replace | Enable update applying for yum-cron (CentOS) - replace: - dest: /etc/yum/yum-cron.conf - regexp: "^apply_updates = no" - replace: "apply_updates = yes" - when: yum_cron_enabled - notify: - - Restart yum-cron - -- name: Service | Enable yum-cron (CentOS) - service: - name: yum-cron - state: started - enabled: yes - when: yum_cron_enabled