v1
This commit is contained in:
43
roles/kernelcare/tasks/updateHTTPS_CentOS.yml
Normal file
43
roles/kernelcare/tasks/updateHTTPS_CentOS.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
# tasks file for kernalcare
|
||||
# Update from HTTP to HTTPS
|
||||
|
||||
- block:
|
||||
- name: "Check /etc/sysconfig/kcare/kcare.conf if exists"
|
||||
ansible.builtin.stat:
|
||||
path: "/etc/sysconfig/kcare/kcare.conf"
|
||||
register: result_config
|
||||
|
||||
- name: "Update to HTTPS in /etc/sysconfig/kcare/kcare.conf"
|
||||
ansible.builtin.replace:
|
||||
path: "/etc/sysconfig/kcare/kcare.conf"
|
||||
regexp: "{{ item.regexp | default(omit) }}"
|
||||
replace: "{{ item.replace | default(omit) }}"
|
||||
loop:
|
||||
- regexp: "^PATCH_SERVER=http"
|
||||
replace: "PATCH_SERVER=https"
|
||||
- regexp: "^REGISTRATION_URL=http"
|
||||
replace: "REGISTRATION_URL=https"
|
||||
notify:
|
||||
- "Restart KernelCare agent"
|
||||
when: result_config.stat.exists
|
||||
|
||||
|
||||
- name: "Check /etc/yum.repos.d/kernelcare.repo if exists"
|
||||
ansible.builtin.stat:
|
||||
path: "/etc/yum.repos.d/kernelcare.repo"
|
||||
register: result_yumrepo
|
||||
|
||||
- name: "Update to HTTPS in /etc/yum.repos.d/kernelcare.repo"
|
||||
ansible.builtin.replace:
|
||||
path: "/etc/yum.repos.d/kernelcare.repo"
|
||||
regexp: "{{ item.regexp | default(omit) }}"
|
||||
replace: "{{ item.replace | default(omit) }}"
|
||||
loop:
|
||||
- regexp: "^baseurl=http"
|
||||
replace: "baseurl=https"
|
||||
- regexp: "^gpgkey=http"
|
||||
replace: "gpgkey=https"
|
||||
when: result_yumrepo.stat.exists
|
||||
|
||||
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
|
||||
Reference in New Issue
Block a user