{"id":16019,"date":"2021-03-31T15:15:34","date_gmt":"2021-03-31T13:15:34","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/"},"modified":"2021-03-31T15:15:34","modified_gmt":"2021-03-31T13:15:34","slug":"automating-linux-patching-with-ansible","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/","title":{"rendered":"Automating Linux patching with Ansible"},"content":{"rendered":"<p>Since the beginning of the year, several vulnerabilities have been discovered in the Linux Kernel as well as in others important and widely-used packages. Among them, there was the famous <a href=\"https:\/\/cve.mitre.org\/cgi-bin\/cvename.cgi?name=CVE-2021-3156\" target=\"_blank\" rel=\"noopener\">CVE-2021-3156<\/a> affecting the sudo package and allowing any unprivileged user to gain root privileges. This one had a base score of 7.8, which is considered as high.<br \/>\nThis kind of events demonstrate the importance of having a strong patching strategy to ensure up-to-date softwares and operating systems (even when it&#8217;s Linux \ud83d\ude0e ).<\/p>\n<p>When your inventory is composed of few servers, you can easily and quickly patch all of them manually using &#8220;dnf\/yum update&#8221; for RHEL family OS, &#8220;apt update&#8221; for Debian based OS or with &#8220;zypper update&#8221; for SUSE servers.<br \/>\nBut when you have to update dozens of machines, doing it manually could be time consuming&#8230; and boring.<br \/>\nFor Enterprise distributions, there are tools that can help you (<a href=\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-red-hat-satellite-installation\/\" target=\"_blank\" rel=\"noopener\">Red Hat Satellite<\/a>, <a href=\"https:\/\/www.dbi-services.com\/blog\/suse-manager-installation\/\" target=\"_blank\" rel=\"noopener\">SUSE Manager<\/a>, aso.). But if you want to go with an open source solution, you can use Ansible to create playbooks and roles to patch your servers automatically.<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible-logo.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-48822\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible-logo.png\" alt=\"\" width=\"450\" height=\"196\" \/><\/a><\/p>\n<p>The goal of this blog is not to explain what Ansible is and how does it work. If you have no knowledge on Ansible, it would be better to start by reading the <a href=\"https:\/\/docs.ansible.com\/\" target=\"_blank\" rel=\"noopener\">official documentation,<\/a> which is written in a very simple way and contains a lot of useful exemples.<\/p>\n<h3>Playbook<\/h3>\n<div>The content of my playbook file is very limited. Its purpose is only to call a role :<\/div>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">---\n- name: OS update\n  hosts: dev\n  gather_facts: yes\n  tasks:\n    - name: OS update - all packages or security fixes only\n      include_role:\n        name: os_update \n...<\/pre>\n<div><\/div>\n<p>&nbsp;<\/p>\n<h3>Role<\/h3>\n<div>The main task of my role is also very short :<\/div>\n<div>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">---\n- include_tasks: redhat.yml\n  when: ansible_os_family == \"RedHat\"\n...<\/pre>\n<\/div>\n<div><\/div>\n<div>Its aim is to call the correct task file depending which operating system the playbook is running for.<\/div>\n<div>The role gives the user the possibility to choose between a full patching or to apply security fixes only (thanks to an extra-var &#8220;ev_security_only&#8221; you&#8217;ll see below). Nothing else in this file, as all the steps are described in the task.<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<h3>Task<\/h3>\n<div>The first step is to list all packages that will be modified. Thus, the user can double-check what will be installed before moving on, or cancel the process if desired :<\/div>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">---\n- name: Get packages that can be upgraded\n  become: yes\n  ansible.builtin.dnf:\n    list: upgrades\n    state: latest\n    update_cache: yes \n  register: reg_dnf_output_all\n  when: ev_security_only == \"no\" \n\n- name: List packages that can be upgraded\n  ansible.builtin.debug: \n    msg: \"{{ reg_dnf_output_all.results | map(attribute='name') | list }}\"\n  when: ev_security_only == \"no\" \n\n\n- name: Get packages that can be patched with security fixes\n  become: yes\n  ansible.builtin.dnf:\n    security: yes\n    list: updates\n    state: latest\n    update_cache: yes\n  register: reg_dnf_output_secu\n  when: ev_security_only == \"yes\"\n\n- name: List packages that can be patched with security fixes\n  ansible.builtin.debug: \n    msg: \"{{ reg_dnf_output_secu.results | map(attribute='name') | list }}\"\n  when: ev_security_only == \"yes\" \n\n\n- name: Request user confirmation\n  ansible.builtin.pause:\n    prompt: | \n\n      The packages listed above will be upgraded. Do you want to continue ? \n      -&gt; Press RETURN to continue.\n      -&gt; Press Ctrl+c and then \"a\" to abort.\n  when: reg_dnf_output_all is defined or reg_dnf_output_secu is defined<\/pre>\n<div><\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<div>Next step is to start the full upgrade or to install the security fixes only :<\/div>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">- name: Upgrade packages\n  become: yes\n  ansible.builtin.dnf:\n    name: '*'\n    state: latest\n    update_cache: yes\n    update_only: no\n  register: reg_upgrade_ok\n  when: ev_security_only == \"no\" and reg_dnf_output_all is defined\n\n- name: Patch packages\n  become: yes\n  ansible.builtin.dnf:\n    name: '*'\n    security: yes\n    state: latest\n    update_cache: yes\n    update_only: no\n  register: reg_upgrade_ok\n  when: ev_security_only == \"yes\" and reg_dnf_output_secu is defined\n\n\n- name: Print errors if upgrade failed\n  ansible.builtin.debug:\n    msg: \"Packages upgrade failed\"\n  when: reg_upgrade_ok is not defined<\/pre>\n<p>&nbsp;<\/p>\n<div>If the Kernel has been updated, it&#8217;s strongly recommended to reboot the server. To check if a reboot is required, we can use the command &#8220;needs-restarting&#8221; provided here by the package dnf-utils :<\/div>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">- name: Install dnf-utils\n  become: yes\n  ansible.builtin.dnf:\n    name: 'dnf-utils'\n    state: latest\n    update_cache: yes\n\n- name: Check if a reboot is required\n  become: yes\n  command: needs-restarting -r\n  register: reg_reboot_required\n  ignore_errors: yes\n  failed_when: false\n  changed_when: reg_reboot_required.rc != 0\n  notify:\n    - Reboot server \n...<\/pre>\n<p>&nbsp;<\/p>\n<h3>Handler<\/h3>\n<div>As you can see above, an Handler is called by the &#8220;notify&#8221; directive.\u00a0 Using an Handler is very suitable here, as we want to reboot the server once the patching is done, but only when the Kernel has been updated.<\/div>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">---\n- name : Reboot server\n  ansible.builtin.reboot:\n    msg: \"Reboot initiated by Ansible after OS update\"\n    reboot_timeout: 3600\n    test_command: uptime\n...<\/pre>\n<p>&nbsp;<\/p>\n<h3>Execution<\/h3>\n<div>Let&#8217;s start the playbook to perform a full update (ev_security_only=no) on a single host :<\/div>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1; highlight: [44,45,46,47]\">$ ansible-playbook playbooks\/os_update.yml --extra-vars \"ev_security_only=no\"\n\nPLAY [OS update] *****************************************************************************************************************************************************************************************************************************\n\nTASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************\nok: [192.168.22.101]\n\nTASK [OS update - all packages or security fixes only] ***************************************************************************************************************************************************************************************\n\nTASK [os_update : include_tasks] *************************************************************************************************************************************************************************************************************\nincluded: ...\/roles\/os_update\/tasks\/redhat.yml for 192.168.22.101\n\nTASK [os_update : Get packages that can be upgraded] *****************************************************************************************************************************************************************************************\nok: [192.168.22.101]\n\nTASK [os_update : List packages that can be upgraded] ****************************************************************************************************************************************************************************************\nok: [192.168.22.101] =&gt; {\n\"changed\": false,\n\"msg\": [\n\"tuned\",\n\"hwdata\",\n\"libstdc++\",\n\"libgomp\",\n\"libgcc\",\n\"openssl-libs\",\n\"openssl\",\n\"tuned\",\n\"hwdata\",\n\"python36\",\n\"libstdc++-devel\",\n\"tuned\"\n]\n}\n\nTASK [os_update : Get packages that can be patched with security fixes] *****************************************************************************************************************************\nskipping: [192.168.22.101]\n\nTASK [os_update : List packages that can be patched with security fixes] *********************************************************************************************************************************************************************\nskipping: [192.168.22.101]\n\nTASK [os_update : Request user confirmation] *************************************************************************************************************************************************************************************************\n[os_update : Request user confirmation]\n\nThe packages listed above will be upgraded. Do you want to continue ?\n-&gt; Press RETURN to continue.\n-&gt; Press Ctrl+c and then \"a\" to abort.\n:\nok: [192.168.22.101]\n\nTASK [os_update : Upgrade packages] **********************************************************************************************************************************************************************************************************\nchanged: [192.168.22.101]\n\nTASK [os_update : Patch packages] ************************************************************************************************************************************************************************************************************\nskipping: [192.168.22.101]\n\nTASK [os_update : Print errors if upgrade failed] ********************************************************************************************************************************************************************************************\nskipping: [192.168.22.101]\n\nTASK [os_update : Install dnf-utils] *********************************************************************************************************************************************************************************************************\nok: [192.168.22.101]\n\nTASK [os_update : Check if a reboot is required] *********************************************************************************************************************************************************************************************\nok: [192.168.22.101]\n\nPLAY RECAP ***********************************************************************************************************************************************************************************************************************************\n192.168.22.101 : ok=8 changed=1 unreachable=0 failed=0 skipped=4 rescued=0 ignored=0\n\n$<\/pre>\n<p><\/br><\/p>\n<h3>Possible improvements<\/h3>\n<p>At this stage, this role is rather basic. It could therefore benefit from some improvements, such as :<\/p>\n<ul>\n<li>Create tasks to patch Debian based and SUSE servers<\/li>\n<li>Add pre-task to send the list of packages by email before starting the patching<\/li>\n<li>Logging<\/li>\n<li>&#8230;.<\/li>\n<\/ul>\n<p>Perhaps in a next blog&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since the beginning of the year, several vulnerabilities have been discovered in the Linux Kernel as well as in others important and widely-used packages. Among them, there was the famous CVE-2021-3156 affecting the sudo package and allowing any unprivileged user to gain root privileges. This one had a base score of 7.8, which is considered&hellip;&nbsp;<\/p>\n","protected":false},"author":30,"featured_media":16020,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[1321,1320,42],"tags":[2308,72,152,73,154,155,1462,158],"class_list":["post-16019","post","type-post","status-publish","format-standard","has-post-thumbnail","category-ansible","category-devops","category-operating-systems","tag-automatic","tag-centos","tag-dnf","tag-linux","tag-os","tag-patching","tag-red-hat","tag-yum"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.9 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Automating Linux patching with Ansible - dbi services Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automating Linux patching with Ansible\" \/>\n<meta property=\"og:description\" content=\"Since the beginning of the year, several vulnerabilities have been discovered in the Linux Kernel as well as in others important and widely-used packages. Among them, there was the famous CVE-2021-3156 affecting the sudo package and allowing any unprivileged user to gain root privileges. This one had a base score of 7.8, which is considered&hellip;&nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi services Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dbiservices\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-31T13:15:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible-logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"886\" \/>\n\t<meta property=\"og:image:height\" content=\"386\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jo\u00ebl Cattin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:site\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jo\u00ebl Cattin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/\"},\"author\":{\"name\":\"Jo\u00ebl Cattin\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/caeaf637485f295f1be42de07b3ac4cf\"},\"headline\":\"Automating Linux patching with Ansible\",\"datePublished\":\"2021-03-31T13:15:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/\"},\"wordCount\":520,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/ansible-logo.png\",\"keywords\":[\"automatic\",\"CentOS\",\"dnf\",\"Linux\",\"os\",\"Patching\",\"Red Hat\",\"yum\"],\"articleSection\":[\"Ansible\",\"DevOps\",\"Operating System\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/\",\"name\":\"Automating Linux patching with Ansible - dbi services Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/ansible-logo.png\",\"datePublished\":\"2021-03-31T13:15:34+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/ansible-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/ansible-logo.png\",\"width\":886,\"height\":386},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automating-linux-patching-with-ansible\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automating Linux patching with Ansible\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi services Blog\",\"description\":\"#BeSharing\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\",\"name\":\"dbi services\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"width\":512,\"height\":512,\"caption\":\"dbi services\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dbiservices\\\/\",\"https:\\\/\\\/x.com\\\/dbiservices\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/dbi-services\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/dbiservices\"],\"description\":\"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.\",\"email\":\"info@dbi-services.com\",\"telephone\":\"+41 32 422 96 00\",\"legalName\":\"dbi services SA\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/caeaf637485f295f1be42de07b3ac4cf\",\"name\":\"Jo\u00ebl Cattin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/JOC_web-scaled.jpg\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/JOC_web-scaled.jpg\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/JOC_web-scaled.jpg\",\"caption\":\"Jo\u00ebl Cattin\"},\"description\":\"Jo\u00ebl Cattin has more than seven years of experience in database management, specializing in Oracle solutions including Data Guard, RMAN, Oracle Database Appliance (ODA), Real Application Clusters (RAC), and APEX development, alongside PostgreSQL and MySQL. He is also experienced with AWS cloud solutions and Ansible-based IT automation. He holds Oracle Database 12c Administrator Certified Professional, EDB Postgres Advanced Server Certified Professional, RedHat Certified System Administrator, and ITIL V3 Foundation certifications, and leads three InSite Workshops (Oracle Basics, Linux for DBAs, and Ansible). He holds a degree from ESIG Del\u00e9mont.\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/joel-cattin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Automating Linux patching with Ansible - dbi services Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/","og_locale":"en_US","og_type":"article","og_title":"Automating Linux patching with Ansible","og_description":"Since the beginning of the year, several vulnerabilities have been discovered in the Linux Kernel as well as in others important and widely-used packages. Among them, there was the famous CVE-2021-3156 affecting the sudo package and allowing any unprivileged user to gain root privileges. This one had a base score of 7.8, which is considered&hellip;&nbsp;","og_url":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/","og_site_name":"dbi services Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2021-03-31T13:15:34+00:00","og_image":[{"width":886,"height":386,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible-logo.png","type":"image\/png"}],"author":"Jo\u00ebl Cattin","twitter_card":"summary_large_image","twitter_creator":"@dbiservices","twitter_site":"@dbiservices","twitter_misc":{"Written by":"Jo\u00ebl Cattin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/"},"author":{"name":"Jo\u00ebl Cattin","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/caeaf637485f295f1be42de07b3ac4cf"},"headline":"Automating Linux patching with Ansible","datePublished":"2021-03-31T13:15:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/"},"wordCount":520,"commentCount":2,"publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible-logo.png","keywords":["automatic","CentOS","dnf","Linux","os","Patching","Red Hat","yum"],"articleSection":["Ansible","DevOps","Operating System"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/","url":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/","name":"Automating Linux patching with Ansible - dbi services Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible-logo.png","datePublished":"2021-03-31T13:15:34+00:00","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible-logo.png","width":886,"height":386},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/automating-linux-patching-with-ansible\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Automating Linux patching with Ansible"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi services Blog","description":"#BeSharing","publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.dbi-services.com\/#organization","name":"dbi services","url":"https:\/\/www.dbi-services.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","width":512,"height":512,"caption":"dbi services"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/dbiservices\/","https:\/\/x.com\/dbiservices","https:\/\/www.linkedin.com\/company\/dbi-services\/","https:\/\/www.youtube.com\/user\/dbiservices"],"description":"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.","email":"info@dbi-services.com","telephone":"+41 32 422 96 00","legalName":"dbi services SA"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/caeaf637485f295f1be42de07b3ac4cf","name":"Jo\u00ebl Cattin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/JOC_web-scaled.jpg","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/JOC_web-scaled.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/JOC_web-scaled.jpg","caption":"Jo\u00ebl Cattin"},"description":"Jo\u00ebl Cattin has more than seven years of experience in database management, specializing in Oracle solutions including Data Guard, RMAN, Oracle Database Appliance (ODA), Real Application Clusters (RAC), and APEX development, alongside PostgreSQL and MySQL. He is also experienced with AWS cloud solutions and Ansible-based IT automation. He holds Oracle Database 12c Administrator Certified Professional, EDB Postgres Advanced Server Certified Professional, RedHat Certified System Administrator, and ITIL V3 Foundation certifications, and leads three InSite Workshops (Oracle Basics, Linux for DBAs, and Ansible). He holds a degree from ESIG Del\u00e9mont.","url":"https:\/\/www.dbi-services.com\/blog\/author\/joel-cattin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/16019","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/30"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=16019"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/16019\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/16020"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=16019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=16019"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=16019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}