1

I have this in my drupal roles to download 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

and when i run ansible here is the error i get

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

when i checked the server to see if drupal git was donwloaded, there was nothing there.

How do i use the git module to download on centos 7? Thanks

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
grant tailor
  • 495
  • 2
  • 6
  • 13

1 Answers1

3

Well, follow the tracks...

First clue:

$ 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.

OK, so you have a wrong repo URL. Let's look further:

$ 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.

Now we're getting somewhere. Let's go to that page! What do we see down at the bottom of the page?

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

So that's the URL you should be using in your ansible git module play.

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • howcome that url `http://git.drupal.org/project/drupal.git` worked for ansible on Ubuntu 14.04? and when i used it on CentOS7 it doesn't? on Ubuntu 14.04 here is the same line in drupal module `- name: Clone Drupal git: > repo=http://git.drupal.org/project/drupal.git dest=/var/www/html/drupal/ update=no` and it worked perfect when i ran it..installed the drupal git...but the CentOS7 one gave the error? – grant tailor Feb 05 '15 at 15:49