ansible#shell

安装Zabbix-playbook参考

---

- name: Install Zabbix
  hosts: all
  become: yes
  tasks:
    - name: Install the EPEL repository
      yum:
        name: epel-release
        state: present
    - name: Install Zabbix packages
      yum:
        name:
          - zabbix-server-mysql
          - zabbix-web-mysql
          - zabbix-agent
        state: present
    - name: Create the Zabbix database
      mysql_db:
        name: zabbix
        state: present
    - name: Create the Zabbix database user
      mysql_user:
        name: zabbix
        password: zabbix
        priv: '*.*:ALL,GRANT'
        state: present
    - name: Import the Zabbix database schema
      shell: zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
    - name: Configure the Zabbix database
      ini_file:
        dest: /etc/zabbix/zabbix_server.conf
        section: 'DB'
        option: 'DBName'
        value: zabbix
        section: 'DB'
        option: 'DBUser'
        value: zabbix
        section: 'DB'
        option: 'DBPassword'
        value: zabbix
    - name: Start the Zabbix server
      service:
        name: zabbix-server
        state: started
    - name: Start the Zabbix agent
      service:
        name: zabbix-agent
        state: started
Prev Next
No Comments

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注