Ansible 2.3.1.0 : Enable repo on CENTOS 7

标签 ansible

为了安装php7 7,我需要使用以下命令启用remi-php71 repo:

yum-config-manager --enable remi-php71

我怎样才能在 ansible 任务中做到这一点?

最佳答案

我有同样的需求(但对于 5.6)。遵循讨论中的建议 here我使用了以下内容:

- name: enable remi-php56
  ini_file:
    dest: /etc/yum.repos.d/remi.repo
    section: remi-php56
    option: enabled
    value: 1

优于使用 yum_repository是我不必维护定义 - 我从他提供的 RPM 安装 remi repos。优于shell变体(无论如何应该是 command)是我不需要运行命令,也不需要为此安装 yum utils

关于Ansible 2.3.1.0 : Enable repo on CENTOS 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44606514/

相关文章:

ssh - Ansible 无法使用不同用户在本地主机上创建文件夹

linux - 如何设置远程主机的环境变量

Ansible 2.4主机文件警告

ansible - 如何使用ansibleVault上传加密文件?

amazon-web-services - Ubuntu WSL Ansible - 用户@localhost 权限被拒绝(公钥,密码)

Gitlab CI Review Apps - 将部署脚本中的信息返回到 gitlab ci 环境变量中

regex - Ansible regex_replace 通过path(url)修改文件名

azure - 当 Kubespray 中其他节点丢失时,Kubernetes 集群节点不会自动创建

Ansible 不加载 ~/.profile

ansible - 如何在 Ansible 中的多个任务之间共享参数