ansible 无法在 centos 7 上下载 git repo

ansible 无法在 centos 7 上下载 git repo

我在我的 drupal 角色中有这个来下载 drupal git

---

- name: Install git
  yum: name=git state=latest

- name: Clone Drupal
  git: repo=http://git.drupal.org/project/drupal.git
       dest=/var/www/html/drupal/
       update=no

- name: Create settings.php
  command: cp /var/www/html/drupal/sites/default/default.settings.php /var/www/html/drupal/sites/default/settings.php

- name: Create services.yml
  command: cp /var/www/html/drupal/sites/default/default.services.yml /var/www/html/drupal/sites/default/services.yml

- name: Update permissions of settings.php
  file: path=/var/www/html/drupal/sites/default/settings.php mode=777

- name: Update permissions of services.yml
  file: path=/var/www/html/drupal/sites/default/services.yml mode=777

- name: Update permissions of files directory
  file: >
    path=/var/www/html/drupal/sites/default/files
    mode=777
    state=directory
    recurse=yes

当我运行 ansible 时,我收到以下错误

TASK: [drupal | Clone Drupal] *************************************************
changed: [ansiblev1]

TASK: [drupal | Create settings.php] ******************************************
failed: [ansiblev1] => {"changed": true, "cmd": ["cp", "/var/www/html/drupal/sites/default/default.settings.php", "/var/www/html/drupal/sites/default/settings.php"], "delta": "0:00:00.004656", "end": "2015-02-04 23:27:12.815990", "rc": 1, "start": "2015-02-04 23:27:12.811334", "warnings": []}
stderr: cp: cannot stat '/var/www/html/drupal/sites/default/default.settings.php': No such file or directory

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/home/bbusari/site.retry

ansiblev1                  : ok=22   changed=1    unreachable=0    failed=1

当我检查服务器以查看 drupal git 是否已下载时,那里什么也没有。

如何使用 git 模块在 centos 7 上下载?谢谢

答案1

嗯,跟着足迹走...

第一个线索:

$ wget http://git.drupal.org/project/drupal.git
--2015-02-05 00:06:57--  http://git.drupal.org/project/drupal.git
Resolving git.drupal.org... 140.211.10.6
Connecting to git.drupal.org|140.211.10.6|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2015-02-05 00:06:58 ERROR 404: Not Found.

好的,所以你的 repo URL 是错误的。让我们进一步看看:

$ curl http://git.drupal.org/
Drupal.org does not provide repository listings in gitweb. You must access repositories directly by fully-qualified URI - e.g. for Drupal core, http://drupalcode.org/project/drupal.git . If you want a listing of repositories, consult the listings of projects on Drupal.org itself.

现在我们开始有所了解了。让我们转到该页面!我们在页面底部看到了什么?

Clone
git://git.drupal.org/project/drupal.git

所以那是您应该在 ansible git 模块播放中使用的 URL。

相关内容