LINUX.ORG.RU

а тебе под какую OS нужно? этот попробуй или перепиши под себя, если не подходит.

https://github.com/badri/drupal-ansible/

вообще их много на гитхаб. Может тебе повезет и вылезет волшебная палочка с playbook под твои хотелки.

ving2
()
Ответ на: комментарий от ving2

да там только установить

нужно просто поставить его , на убунту сервер , без всяких наворотов там и тд , тупо устанвоить и все

echo_
() автор топика
Ответ на: комментарий от ving2

сделал вот такой плейбук

- hosts: n
  tasks: 
  - name: Подготовка ... 
    apt: update_cache=yes cache_valid_time=3600
    become: true
  - name: Установка пакетов и бд
    apt: pkg={{ item }} state=present install_recommends=yes
    with_items:
       - python-mysqldb
       - drush
       - unzip
    become: true
    
  - name: Создаем бд
    mysql_db: name=drupal state=present login_user=root login_password=435345
   
  - name: Качаем друпал
    get_url: url=https://ftp.drupal.org/files/projects/drupal-7.51.zip dest=/var/www/ remote_src=yes     
    become: true
  - name: Распаковка друпал-а
    unarchive: src=/var/www/drupal-7.51.zip dest=/var/www/ copy=no  
    become: true
   
  - name: Копируем директорию
    command: cp -R /var/www/drupal-7.51 /var/www/drupal
    become: true       
 
  - name: Создаем папку
    file: name=/var/www/html state=absent
    become: true
    
  - name: Устанвока друпал 
    shell: chdir=/var/www/drupal  drush site-install minimal --account-name=admin --account-pass=admin --db-url=mysql://root@localhost/drupal -y
    become: true

[/bash]
все проходит кроме одного , на последнем таске вылезает вот это:
sudo drush site-install minimal --account-name=admin --account-pass=admin --db-url=mysql://root@localhost/drupal8 -y
You are about to CREATE  the 'drupal8' database. Do you want to continue? (y/n): y
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Starting Drupal installation. This takes a few seconds ...                                                                                 [ok]
WD php: Exception: Resolve all issues below to continue the installation. For help configuring your database server, see the installation  [error]
handbook, or contact your hosting provider.Failed to connect to your database server. The server reports the following message:
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO).Is the database server
running?Does the database exist, and have you entered the correct database name?Have you entered the correct username and password?Have you
entered the correct database hostname? in install_run_task() (line 415 of /var/www/drupal/includes/install.core.inc).
WD php: Warning: Cannot modify header information - headers already sent by (output started at /usr/share/php/drush/includes/output.inc:37)[warning]
in drupal_send_headers() (line 1471 of /var/www/drupal/includes/bootstrap.inc).
Exception: Resolve all issues below to continue the installation. For help configuring your database server, see the <a href="http://drupal.org/getting-started/install">installation handbook</a>, or contact your hosting provider.<p class="error">Failed to connect to your database server. The server reports the following message: <em>SQLSTATE[HY000] [1045] Access denied for user &#039;root&#039;@&#039;localhost&#039; (using password: NO)</em>.<ul><li>Is the database server running?</li><li>Does the database exist, and have you entered the correct database name?</li><li>Have you entered the correct username and password?</li><li>Have you entered the correct database hostname?</li></ul></p> in install_run_task() (line 415 of /var/www/drupal/includes/install.core.inc).
Drush command terminated abnormally due to an unrecoverable error. 
[/bash]
где я натупил ? 
echo_
() автор топика
Ответ на: сделал вот такой плейбук от echo_

drush подключится не может. Нужно еще в команде drush указывать пользователя наделенного провами создавать базы и пароль. вот тут посмотри:

http://infobsd.ru/content/ustanovka-drupal-7-s-pomoshchyu-drush

ving2
()
Последнее исправление: ving2 (всего исправлений: 2)
Ответ на: комментарий от ving2

спс, переделал вот так :

- hosts: n
  tasks: 
  - name: Подготовка ... 
    apt: update_cache=yes cache_valid_time=3600
    become: true
  - name: Установка пакетов и бд
    apt: pkg={{ item }} state=present install_recommends=yes
    with_items:
       - python-mysqldb
       - drush
       - unzip
    become: true
  - name: Качаем друпал 
    shell: chdir=/var/www/  sudo drush pm-download --drupal-project-rename=site drupal
    become: true
  - name: Установка прав
    path: /var/www/site
    group: www-data
    mode: 755
    become: true
  - name: Установка друпал 
    shell: chdir=/var/www/site  drush si minimal --account-name=admin --account-pass=admin --db-su=root --db-su-pw=ps --db-url=mysql://drupal:'password'@'localhost'/drupaldb --site-name='drupal.eastus2.cloudapp.azure.com' 
    become: true

[/bash]
все работает как часы , кроме одного =) после перехода по адресу rupal.eastus2.cloudapp.azure.com открывается страница авторизации , ввожу данные и вижу 
Not Found

The requested URL /node was not found on this server.

Apache/2.4.18 (Ubuntu) Server at drupal.eastus2.cloudapp.azure.com Port 80
[/html]
и что самое крутое папки /node там нету...то есть она не создается,почему ?
echo_
() автор топика
Ответ на: комментарий от ving2

так лучше

admins@server:/var/www/html/drupal$ ls -la
total 268
drwxr-xr-x  8 www-data www-data   4096 Dec  7  2016 .
drwxr-xr-x  3 root     root       4096 Oct 24 15:55 ..
-rwxr-xr-x  1 www-data www-data    948 Dec  7  2016 .csslintrc
-rwxr-xr-x  1 www-data www-data    350 Dec  7  2016 .editorconfig
-rwxr-xr-x  1 www-data www-data    185 Dec  7  2016 .eslintignore
-rwxr-xr-x  1 www-data www-data     36 Dec  7  2016 .eslintrc
-rwxr-xr-x  1 www-data www-data   3671 Dec  7  2016 .gitattributes
-rwxr-xr-x  1 www-data www-data   7865 Dec  7  2016 .htaccess
-rwxr-xr-x  1 www-data www-data  18092 Nov 16  2016 LICENSE.txt
-rwxr-xr-x  1 www-data www-data   5889 Dec  7  2016 README.txt
-rwxr-xr-x  1 www-data www-data    262 Dec  7  2016 autoload.php
-rwxr-xr-x  1 www-data www-data   1437 Dec  7  2016 composer.json
-rwxr-xr-x  1 www-data www-data 147889 Dec  7  2016 composer.lock
drwxr-xr-x 12 www-data www-data   4096 Dec  7  2016 core
-rwxr-xr-x  1 www-data www-data   1346 Dec  7  2016 example.gitignore
-rwxr-xr-x  1 www-data www-data    549 Dec  7  2016 index.php
drwxr-xr-x  2 www-data www-data   4096 Dec  7  2016 modules
drwxr-xr-x  2 www-data www-data   4096 Dec  7  2016 profiles
-rwxr-xr-x  1 www-data www-data   1596 Dec  7  2016 robots.txt
drwxr-xr-x  3 www-data www-data   4096 Dec  7  2016 sites
drwxr-xr-x  2 www-data www-data   4096 Dec  7  2016 themes
-rwxr-xr-x  1 www-data www-data    554 Dec  7  2016 update.php
drwxr-xr-x 18 www-data www-data   4096 Dec  7  2016 vendor
-rwxr-xr-x  1 www-data www-data   4555 Dec  7  2016 web.config
admins@server:/var/www/html/drupal$ 

echo_
() автор топика
Ответ на: так лучше от echo_

а вот его содержание(если это конечно нужно)

admins@server:/var/www/html/drupal$ sudo cat .htaccess 
#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$">
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order allow,deny
  </IfModule>
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Set the default handler.
DirectoryIndex index.php index.html index.htm

# Add correct encoding for SVGZ.
AddType image/svg+xml svg svgz
AddEncoding gzip svgz

# Most of the following PHP settings cannot be changed at runtime. See
# sites/default/default.settings.php and
# Drupal\Core\DrupalKernel::bootEnvironment() for settings that can be
# changed at runtime.

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value assert.active                   0
  php_flag session.auto_start               off
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_flag mbstring.encoding_translation    off
  # PHP 5.6 has deprecated $HTTP_RAW_POST_DATA and produces warnings if this is
  # not set.
  php_value always_populate_raw_post_data   -1
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On

  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600

  <FilesMatch \.php$>
    # Do not allow PHP scripts to be cached unless they explicitly send cache
    # headers themselves. Otherwise all scripts would have to overwrite the
    # headers set by mod_expires if they want another caching behavior. This may
    # fail if an error occurs early in the bootstrap process, and it may cause
    # problems if a non-Drupal PHP file is installed in a subdirectory.
    ExpiresActive Off
  </FilesMatch>
</IfModule>

# Set a fallback resource if mod_rewrite is not enabled. This allows Drupal to
# work without clean URLs. This requires Apache version >= 2.2.16. If Drupal is
# not accessed by the top level URL (i.e.: http://example.com/drupal/ instead of
# http://example.com/), the path to index.php will need to be adjusted.
<IfModule !mod_rewrite.c>
  FallbackResource /index.php
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # Set "protossl" to "s" if we were accessed via https://.  This is used later
  # if you enable "www." stripping or enforcement, in order to ensure that
  # you don't bounce between http and https.
  RewriteRule ^ - [E=protossl]
  RewriteCond %{HTTPS} on
  RewriteRule ^ - [E=protossl:s]

  # Make sure Authorization HTTP header is available to PHP
  # even when running as CGI or FastCGI.
  RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

  # Block access to "hidden" directories whose names begin with a period. This
  # includes directories used by version control systems such as Subversion or
  # Git to store control files. Files whose names begin with a period, as well
  # as the control files used by CVS, are protected by the FilesMatch directive
  # above.
  #
  # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  # not possible to block access to entire directories from .htaccess because
  # <DirectoryMatch> is not allowed here.
  #
  # If you do not have mod_rewrite installed, you should remove these
  # directories from your webroot or otherwise protect them from being
  # downloaded.
  RewriteRule "(^|/)\.(?!well-known)" - [F]

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/foo will be redirected to http://www.example.com/foo)
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} .
  # RewriteCond %{HTTP_HOST} !^www\. [NC]
  # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/foo will be redirected to http://example.com/foo)
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

  # Redirect common PHP files to their new locations.
  RewriteCond %{REQUEST_URI} ^(.*)?/(install.php) [OR]
  RewriteCond %{REQUEST_URI} ^(.*)?/(rebuild.php)
  RewriteCond %{REQUEST_URI} !core
  RewriteRule ^ %1/core/%2 [L,QSA,R=301]

  # Rewrite install.php during installation to see if mod_rewrite is working
  RewriteRule ^core/install.php core/install.php?rewrite=ok [QSA,L]

  # Pass all requests not referring directly to files in the filesystem to
  # index.php.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

  # For security reasons, deny access to other PHP files on public sites.
  # Note: The following URI conditions are not anchored at the start (^),
  # because Drupal may be located in a subdirectory. To further improve
  # security, you can replace '!/' with '!^/'.
  # Allow access to PHP files in /core (like authorize.php or install.php):
  RewriteCond %{REQUEST_URI} !/core/[^/]*\.php$
  # Allow access to test-specific PHP files:
  RewriteCond %{REQUEST_URI} !/core/modules/system/tests/https?.php
  # Allow access to Statistics module's custom front controller.
  # Copy and adapt this rule to directly execute PHP files in contributed or
  # custom modules or to run another PHP application in the same directory.
  RewriteCond %{REQUEST_URI} !/core/modules/statistics/statistics.php$
  # Deny access to any other PHP files that do not match the rules above.
  # Specifically, disallow autoload.php from being served directly.
  RewriteRule "^(.+/.*|autoload)\.php($|/)" - [F]

  # Rules to correctly serve gzip compressed CSS and JS files.
  # Requires both mod_rewrite and mod_headers to be enabled.
  <IfModule mod_headers.c>
    # Serve gzip compressed CSS files if they exist and the client accepts gzip.
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.css $1\.css\.gz [QSA]

    # Serve gzip compressed JS files if they exist and the client accepts gzip.
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.js $1\.js\.gz [QSA]

    # Serve correct content types, and prevent mod_deflate double gzip.
    RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
    RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]

    <FilesMatch "(\.js\.gz|\.css\.gz)$">
      # Serve correct encoding type.
      Header set Content-Encoding gzip
      # Force proxies to cache gzipped & non-gzipped css/js files separately.
      Header append Vary Accept-Encoding
    </FilesMatch>
  </IfModule>
</IfModule>

# Various header fixes.
<IfModule mod_headers.c>
  # Disable content sniffing, since it's an attack vector.
  Header always set X-Content-Type-Options nosniff
  # Disable Proxy header, since it's an attack vector.
  RequestHeader unset Proxy
</IfModule>

echo_
() автор топика
Ответ на: комментарий от ving2

думал мож я с кривыми руками, переделал плейбук:


- hosts: n
  tasks: 
  - name: Подготовка ... 
    apt: update_cache=yes cache_valid_time=3600
    become: true
  - name: Установка пакетов и бд
    apt: pkg={{ item }} state=present install_recommends=yes
    with_items:
       - apache2
       - drush
       - unzip
       - software-properties-common
       - python-software-properties
       - php5.6-gd
    become: true
  - name: Установка mysql
    apt: pkg={{ item }} state=installed
    with_items:
      - mysql-common
      - mysql-server
      - python-mysqldb
    become: true
  - name: Качаем друпал  
    get_url:
       url: "https://ftp.drupal.org/files/projects/drupal-8.2.4.zip"
       dest: /var/www/html/drupal.zip
    become: true
  - name: Распаковка архива
    unarchive: src=/var/www/html/drupal.zip dest=/var/www/html/ copy=no 
    become: true
  - name: Cмена имени каталога 
    shell: mv /var/www/html/drupal-8.2.4 /var/www/html/drupal
    become: true
  - name: Установка прав на файлы 
    shell: chown -R www-data.www-data /var/www/html/drupal/ ; chmod -R 755 /var/www/html/drupal/
    become: true
  - name: Рестарт апач
    service:
       name: apache2
       state: restarted
    become: true

та же дичь , только теперь заходит на сайт , а дальше никуда...

echo_
() автор топика
Ответ на: комментарий от ving2

там все по дефолту (в конфигах виртуального хоста )

admins@server:/etc/apache2/sites-available$ cat 000-default.conf 
<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

echo_
() автор топика
Ответ на: комментарий от ugoday

так ,вот что сделал :

- hosts: my
  tasks: 
  - name: Подготовка ... 
    apt: update_cache=yes cache_valid_time=3600
    ignore_errors: yes
    become: true
  - name: Добавление репозитория
    apt_repository:
       repo: 'ppa:ondrej/php'
    become: true
  - name: Установка пакетов и бд
    apt: pkg={{ item }} state=present install_recommends=yes
    with_items:
       - apache2
       - drush
       - unzip
       - software-properties-common
       - python-software-properties
       - php5.6-gd
       - php7.0-fpm
       - php7.0-cli
       - php7.0-common
       - php7.0-curl
       - php7.0-json
       - php7.0-gd
       - php7.0-mcrypt
       - php7.0-odbc
       - php7.0-mbstring
       - php7.0-mysql
       - php7.0-xmlrpc
       - php7.0-opcache
       - php7.0-intl
       - php7.0-bz2
       - php7.0-xml
       - libapache2-mod-php7.0 
       - libzip4 
       - php7.0 
       - php7.0-cgi
       - php7.0-zip
       - composer
    become: true
  - name: Установка mysql
    apt: pkg={{ item }} state=installed
    with_items:
      - mysql-common
      - mysql-server
      - python-mysqldb
    become: true
  - name: Конфигурация бд
    mysql_db: 
       db: drupal 
       state: present
    become: true
  - name: Создание пользователя бд
    mysql_user:
       login_user: root
       login_password: ""
       name: drupal_user
       password: drupal_pass 
       priv: drupal.*:ALL
       host: localhost
    become: true
  - name: Качаем друпал  
    get_url:
       url: "https://ftp.drupal.org/files/projects/drupal-8.2.4.zip"
       dest: /var/www/html/drupal.zip
    become: true
  - name: Распаковка архива
    unarchive: src=/var/www/html/drupal.zip dest=/var/www/html/ copy=no 
    become: true
  - name: Cмена имени каталога 
    shell: mv /var/www/html/drupal-8.2.4 /var/www/html/drupal
    become: true
  - name: Установка прав на файлы 
    shell: chown -R www-data.www-data /var/www/html/drupal/ ; chmod -R 755 /var/www/html/drupal/
    become: true
  - name: Копирование файла виртаульных хостов  
    copy:
       src: 000-default.conf
       dest: /etc/apache2/sites-available/000-default.conf
       backup: yes
    become: true
  - name: rewrite
    shell: a2enmod rewrite
    become: true
  - name: Рестарт апач
    service:
       name: apache2
       state: restarted
    become: true

все стартует и пашет збс но вот что меня интересует , очень хотелось бы понять нужно и сам друпал поставить через консоль , при попытке использования drush для установки , вылетает вот какая дичь :

who@it:/var/www/html/drupal$ sudo drush si standart --account-name=admin --account-pass=admin --db-su=root --db-su-pw=  --db-url=mysql://drupal_user:'drupal_pass'@'localhost'/drupal --site-name='sitename'
PHP Fatal error:  Class 'Drupal\Core\Session\AccountInterface' not found in /var/www/html/drupal/core/includes/bootstrap.inc on line 62
Drush command terminated abnormally due to an unrecoverable error.                                                                        [error]
Error: Class 'Drupal\Core\Session\AccountInterface' not found in /var/www/html/drupal/core/includes/bootstrap.inc, line 62
who@it:/var/www/html/drupal$ 

у кого нить есть идеи ??? уже и переустанавливал и че только не делал......зарание благодарен ....

echo_
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.