TASK [yum install mariadb zabbix httpd] **************************************** fatal: [192.168.100.112]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-server-mysql' found available, installed or updated", "rc": 126, "results": ["httpd-2.4.6-99.el7.centos.1.x86_64 providing httpd is already installed", "No package matching 'zabbix-server-mysql' found available, installed or updated"]}
时间: 2023-07-19 21:56:47 浏览: 124
这是一个 Ansible playbook 中的错误提示,它说明在执行该任务时,系统无法找到名为 'zabbix-server-mysql' 的软件包。可能的原因是该软件包没有被正确安装或者软件源配置不正确。你可以尝试检查一下系统中是否已经安装了该软件包,或者检查一下 playbook 中使用的软件源是否可用。另外,你也可以尝试使用其他方式来安装 'zabbix-server-mysql'。
相关问题
创建2台系统为centos7.5的云主机,其中一台作为Ansible的母机并命名为ansible,另一台云主机命名为node,通过http服务中的ansible.tar.gz软件包在ansible节点安装Ansible服务;并用这台母机,补全Ansible脚本(在HTTP中下载install_zabbix.tar.gz并解压到/root目录下),补全Ansible脚本使得执行install_zabbix.yaml可以在node节点上完成zabbix服务的安装。 ftp.repo: [zabbix] name=zabbix baseurl=file:///opt/Zabbix enabled=1 gpgcheck=0 [ftp_centos] name=ftp_centos baseurl=ftp://controller/centos enabled=1 gpgcheck=0 [root@ansible ~]# cat install_zabbix.yaml - hosts: zabbix remote_user: root tasks: - name: rm repo shell: rm -f /etc/yum.repos.d/* - name: cp repo copy: src=/etc/yum.repos.d/ftp.repo dest=/etc/yum.repos.d/ - name: cp zabbix copy: src=/opt/zabbix dest=/opt/ - name: yum install mariadb zabbix httpd yum: name=mariadb,mariadb-server,zabbix-server-mysql,zabbix-web-mysql,zabbix-agent,trousers state=present - name: start httpd service: name=httpd state=started enabled=yes - name: start mariadb service: name=mariadb state=started enabled=yes -name: mysql passwd shell: mysqladmin -u root password 123456 - name: grant shell: mysql -u root -p123456 -e "create database zabbix character set utf8 collate utf8_bin;" && mysql -u root -p123456 -e "grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';" && mysql -u root -p123456 -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';" - name: sql shell: zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz |mysql -u zabbix -pzabbix zabbix - name: cp config copy: src=/etc/zabbix/zabbix_server.conf dest=/etc/zabbix/ - name: start zabbix service: name=zabbix-server state=started
好的,我了解了您的问题。您想创建2台系统为CentOS 7.5的云主机,其中一台作为Ansible的母机并命名为ansible,另一台云主机命名为node,并通过http服务中的ansible.tar.gz软件包在ansible节点安装Ansible服务。然后用这台母机,补全Ansible脚本(在HTTP中下载install_zabbix.tar.gz并解压到/root目录下),补全Ansible脚本使得执行install_zabbix.yaml可以在node节点上完成zabbix服务的安装。
以下是您需要执行的步骤:
1. 在您的云平台上创建2台CentOS 7.5的云主机,分别命名为ansible和node。
2. 在ansible节点上安装Ansible服务,可以通过以下命令完成安装:
```
$ yum install ansible
```
3. 从http服务中下载ansible.tar.gz软件包,并将其解压到ansible节点上的/opt目录下:
```
$ wget http://your_http_server/ansible.tar.gz -P /opt/
$ tar -zxvf /opt/ansible.tar.gz -C /opt/
```
4. 在ansible节点上创建一个名为hosts的文件,并添加node节点的IP地址:
```
$ vi /etc/ansible/hosts
```
添加以下内容:
```
[node]
192.168.1.100
```
5. 从http服务中下载install_zabbix.tar.gz软件包,并将其解压到ansible节点上的/root目录下:
```
$ wget http://your_http_server/install_zabbix.tar.gz -P /root/
$ tar -zxvf /root/install_zabbix.tar.gz -C /root/
```
6. 创建一个名为install_zabbix.yaml的Ansible脚本,并将以下内容复制到脚本中:
```
---
- hosts: node
remote_user: root
tasks:
- name: rm repo
shell: rm -f /etc/yum.repos.d/*
- name: cp repo
copy: src=/etc/yum.repos.d/ftp.repo dest=/etc/yum.repos.d/
- name: cp zabbix
copy: src=/opt/zabbix dest=/opt/
- name: yum install mariadb zabbix httpd
yum:
name: "{{ item }}"
state: present
with_items:
- mariadb
- mariadb-server
- zabbix-server-mysql
- zabbix-web-mysql
- zabbix-agent
- trousers
- name: start httpd
service:
name: httpd
state: started
enabled: yes
- name: start mariadb
service:
name: mariadb
state: started
enabled: yes
- name: mysql passwd
shell: mysqladmin -u root password 123456
- name: grant
shell: mysql -u root -p123456 -e "create database zabbix character set utf8 collate utf8_bin;" && mysql -u root -p123456 -e "grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';" && mysql -u root -p123456 -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';"
- name: sql
shell: zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbix -pzabbix zabbix
- name: cp config
copy: src=/etc/zabbix/zabbix_server.conf dest=/etc/zabbix/
- name: start zabbix
service:
name: zabbix-server
state: started
```
7. 执行install_zabbix.yaml脚本,使得在node节点上完成zabbix服务的安装:
```
$ ansible-playbook /root/install_zabbix.yaml
```
以上就是您所需要执行的步骤,祝您顺利完成任务!
centos7.6如何部署zabbix6.0
可以使用以下步骤来部署zabbix 6.0:
1. 安装必要的软件包:yum -y install httpd mariadb-server mariadb zabbix-server-mysql zabbix-web-mysql zabbix-agent
2. 启动MariaDB和Apache:systemctl start mariadb systemctl start httpd
3. 配置MariaDB:mysql_secure_installation
4. 创建zabbix数据库和用户:mysql -uroot -p CREATE DATABASE zabbix CHARACTER SET UTF8 COLLATE UTF8_BIN; GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY 'password';
5. 导入zabbix数据库模板:zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
6. 编辑zabbix配置文件:vi /etc/zabbix/zabbix_server.conf
7. 配置zabbix web:vi /etc/httpd/conf.d/zabbix.conf
8. 启动zabbix服务:systemctl start zabbix-server systemctl start zabbix-agent
9. 打开zabbix web:http://your-server-ip/zabbix
希望这些步骤能够帮助您成功部署zabbix 6.0。如果您需要更多帮助,请随时问我。