【发布时间】:2021-01-04 13:36:09
【问题描述】:
我正在使用下面的 ansible 脚本在 centOS 中安装 php-fpm 模块,但无法找出错误。
---
- hosts: all
become: yes
tasks:
- name: download remi release repo for php
get_url:
url: http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
dest: /tmp/remi-release-6.rpm
tags: php-fpm
- name: install remi repo
shell: /bin/rpm -Uvh /tmp/remi-release-6.rpm
register: remi_repo_result
failed_when: "'conflict' in remi_repo_result.stderr"
tags: php-fpm
- name: enable remi repo
ini_file: dest=/etc/yum.repos.d/remi.repo
section=remi
option=enabled
value=1
- name: install php-fpm and its deps
yum: name={{item}} state=present
with_items:
- php
- php-fpm
tags: php-fpm
- name: backup default php configuration
shell: /bin/cp /etc/php.ini /etc/php.default.ini creates=/etc/php.default.ini
tags: php-fpm
- name: display php errors when not in production
ini_file: dest=/etc/php.ini
section=PHP
option=display_errors
value=On
when: env is defined and env != "production"
notify:
- restart php-fpm
tags: php-fpm
- name: do not show php errors when in production
ini_file: dest=/etc/php.ini
section=PHP
option=display_errors
value=Off
when: env is defined and env == "production"
notify:
- restart php-fpm
tags: php-fpm
- name: backup default php-fpm configuration
shell: /bin/cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf.default creates=/etc/php-fpm.d/www.conf.default
tags: php-fpm
- name: change php-fpm to listen on socket
ini_file: dest=/etc/php-fpm.d/www.conf
section=www
option=listen
value=/var/run/php-fpm/php-fpm.sock
notify:
- restart php-fpm
tags: php-fpm
- name: php-fpm listen mode should always be 0666
ini_file: dest=/etc/php-fpm.d/www.conf
section=www
option=listen.mode
value=0666
notify:
- restart php-fpm
tags: php-fpm
- name: change php-fpm user
ini_file: dest=/etc/php-fpm.d/www.conf
section=www
option=user
value=nginx
notify:
- restart php-fpm
tags: php-fpm
- name: change php-fpm group
ini_file: dest=/etc/php-fpm.d/www.conf
section=www
option=group
value=nginx
notify:
- restart php-fpm
tags: php-fpm
- name: start php-fpm
service: name=php-fpm state=running enabled=yes
tags: php-fpm
我在任务“install php-fpm and its deps”中收到以下错误
失败:[127.0.0.1] (item=[u'php', u'php-fpm']) => {"ansible_loop_var": "item", "changed": false, "item": [" php", "php-fpm"], "msg": "与 yum 交谈失败:找不到 repo 的有效 baseurl:remi"}
有人可以帮忙解决这个问题吗?
【问题讨论】:
-
1/ EL-6 已死亡,几周前已达到 EOL。顺便说一句,无法复制...
-
确保您使用的是正确的配置包,参见rpms.remirepo.net/wizard,还有EPEL
-
你查看
/etc/yum.repos.d/remi.repo的内容了吗?错误似乎表明baseurl没有[remi]repo。