zabbix yum and package module


The management of zabbix installation software packages can usually be carried out through yum or packages module. There are two parameters:
name: the name of the installed software package.
Status: The status of the maintenance package. The default value is present, which means installation, absent means uninstallation, and latest means update.

1. yum module:

Example 1: Install nmap software 
-hosts: tt 
  gather_facts: no 
  tasks: -name: 
  Install nmap package 
    yum: 
      name: nmap 
      state: present 

Example 2: Install the specified version 
-hosts: all 
  tasks: 
  -name: Install git-1.8.3.1 -6.el7. 
    yum: 
      name: git-1.8.3.1-6.el7 
      state: present 

Example 3: Install multiple packages 
-hosts: all 
  tasks: -name 
  : yum 
    yum: 
      name: "{{ item }}" 
      State: Present 
    with_items: 
    - Vim 
    - htop 
    - Git 

example 4: update package 
- name: All upgrade packages 
  yum: 
    name: '*'
    state: latest 

Example 5: Update package, exclude kernel*,foo* 
-name: upgrade all packages, excluding kernel & foo related packages 
  yum: 
    name:'*' 
    state: latest 
    exclude: kernel*,foo* 

Example 6: Uninstall git 
-hosts: all 
  tasks: 
  -name: Deinstall git-1.8.3.1-6.el7. 
    yum: 
      name: git-1.8.3.1-6.el7 
      state: absent


2.package module

Example 1: Install ntpdate 
-name: install ntpdate 
  package: 
    name: ntpdate 
    state: present 

Example 2: Uninstall ntpdate 
-name: install ntpdate 
  package: 
    name: ntpdate 
    state: absent 

Example 3: Install multiple packages 
-name: install the latest of the Apache and MariaDB Version 
  Package: 
    name: 
      - the httpd 
      - MariaDB-Server 
    State: Latest


Guess you like

Origin blog.51cto.com/hunt1574/2678952