我正在尝试使用ansible从自定义存储库安装mariadb(或任何软件),但我不确定如何使用yum导入.repo文件。/
yum_repository
模块。
可溶的
这是我的剧本:
-
hosts: all
become: true
remote_user: root
tasks:
-
name: set system timezone
timezone:
name: America/Toronto
-
name: add custom repository
yum_repository:
name: centos_o
description: custom repositories
baseurl: http://example.net/mirror/centos_o.repo
-
name: ensure mariadb is installed
yum:
name: mariadb-server-5.5.*
state: installed
我尝试了所有
include
,
metalink
,
baseurl
和
mirrorlist
运气不好。此外,我还缺少GPG关键步骤,但我甚至无法正确添加回购协议。
centos_.repo文件如下:
# JENKINS
[jenkins]
name=CentOS-$releasever - JENKINS
baseurl=http://example.net/mirror/jenkins/
enabled=0
gpgcheck=1
# MariaDB 5.5
[mariadb]
name=CentOS-$releasever - MariaDB
baseurl=http://example.net/mirror/mariadb/yum/5.5/centos$releasever-amd64/
enabled=0
gpgcheck=1
# MariaDB 10.0
[mariadb]
name=CentOS-$releasever - MariaDB
baseurl=http://example.net/mirror/mariadb/yum/10.0/centos$releasever-amd64/
enabled=0
gpgcheck=1
壳牌
这是我试图转换为Ansible的shell脚本版本:
yum clean all
yum-config-manager --add-repo=http://example.net/mirror/centos_o.repo
yum-config-manager --enable mariadb
rpm --import http://example.net/mirror/mariadb/RPM-GPG-KEY-MariaDB
如果有什么区别的话,我就用流浪者的
Ansible local
在CentOS盒子上设置。