-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install Druplal on ubuntu 22.04 - [Errno 2] No such file or directory: b'vendor/bin/drush' #583
Comments
The error `No such file or directory` means that the shell that Ansible is
running on the remote command can't find the `vendor/bin/drush`.
I assume it is actually available in the `{{ drupal_core_path }}` folder.
But your code for that `command:` module may have some indenting problems
that confuse the Ansible interpreter (it confuses me).
Your play is this:
- name: Install Drupal.
command: >
vendor/bin/drush si -y --site-name="{{ drupal_site_name }}"
--account-name=admin
--account-pass=admin
--db-url=mysql://{{ domain ***@***.***/{{ domain }}
--root={{ drupal_core_path }}/web
chdir={{ drupal_core_path }}
creates={{ drupal_core_path }}/web/sites/default/settings.php
notify: restart apache
become_user: www-data
I think the "chdir=` and the `creates=` stanzas for the `command:` module
are being added to the end of the command and not passed to the `command:`
module. The indenting for the command and it's parameters (--account-name,
--account-pass, --db-url, --root) are also getting `chdir=` and `creates=`
appended to the command.
Try rewriting the `command:` module like this:
- name: Install Drupal.
ansible.builtin.command:
argv:
- vendor/bin/drush si -y --site-name="{{ drupal_site_name
}}" - --account-name=admin - --account-pass=admin
- --db-url=mysql://{{ domain ***@***.***/{{ domain }}
- --root={{ drupal_core_path }}/web
chdir: '{{ drupal_core_path }}'
creates: '{{ drupal_core_path }}/web/sites/default/settings.php'
notify: restart apache
become_user: www-data
Basically you need the `argv:`, `chdir:`, and `creates:` options for the
`command:` module to be at the same indent level, and the lines following
the `argv:` to be indented by two additional spaces.
I'm doing this on-the-fly and note validating this syntax but I think this
gets the idea across.
DanL
…On Mon, Apr 29, 2024 at 4:33 PM Taubin ***@***.***> wrote:
I'm attempting to follow the book and perform the installation of Drupal
on an Ubuntu VM.
I created a new ubuntu 20.04 VM and performed updates on the host (sudo
apt update && sudo apt upgrade -y).
I then ran the following playbook against the host (ubu-1.home)
---
- hosts: ubu1
become: yes
vars_files:
- vars.yml
pre_tasks:
- name: Update apt cache if needed.
apt: update_cache=yes cache_valid_time=3600
handlers:
- name: restart apache
service: name=apache2 state=restarted
tasks:
- name: Get software for apt repository management.
apt:
state: present
name:
- python3-apt
- python3-pycurl
- name: Add ondrej repository for later versions of PHP.
apt_repository: repo='ppa:ondrej/php' update_cache=yes
- name: "Install Apache, MySQL, PHP, and other dependencies."
apt:
state: present
name:
- acl
- git
- curl
- unzip
- sendmail
- apache2
- php8.2-common
- php8.2-cli
- php8.2-dev
- php8.2-gd
- php8.2-curl
- php8.2-opcache
- php8.2-xml
- php8.2-mbstring
- php8.2-pdo
- php8.2-mysql
- php8.2-apcu
- libpcre3-dev
- libapache2-mod-php8.2
- python3-mysqldb
- mysql-server
- name: Disable the firewall (since this is for local dev only).
service: name=ufw state=stopped
- name: "Start Apache, MySQL, and PHP."
service: "name={{ item }} state=started enabled=yes"
with_items:
- apache2
- mysql
- name: Enable Apache rewrite module (required for Drupal).
apache2_module: name=rewrite state=present
notify: restart apache
- name: Add Apache virtualhost for Drupal.
template:
src: "templates/drupal.test.conf.j2"
dest: "/etc/apache2/sites-available/{{ domain }}.test.conf"
owner: root
group: root
mode: 0644
notify: restart apache
- name: Enable the Drupal site.
command: >
a2ensite {{ domain }}.test
creates=/etc/apache2/sites-enabled/{{ domain }}.test.conf
notify: restart apache
- name: Disable the default site.
command: >
a2dissite 000-default
removes=/etc/apache2/sites-enabled/000-default.conf
notify: restart apache
- name: Adjust OpCache memory setting.
lineinfile:
dest: "/etc/php/8.2/apache2/conf.d/10-opcache.ini"
regexp: "^opcache.memory_consumption"
line: "opcache.memory_consumption = 96"
state: present
notify: restart apache
- name: Create a MySQL database for Drupal.
mysql_db: "db={{ domain }} state=present"
- name: Create a MySQL user for Drupal.
mysql_user:
name: "{{ domain }}"
password: "1234"
priv: "{{ domain }}.*:ALL"
host: localhost
state: present
- name: Download Composer installer.
get_url:
url: https://getcomposer.org/installer
dest: /tmp/composer-installer.php
mode: 0755
- name: Run Composer installer.
command: >
php composer-installer.php
chdir=/tmp
creates=/usr/local/bin/composer
- name: Move Composer into globally-accessible location.
command: >
mv /tmp/composer.phar /usr/local/bin/composer
creates=/usr/local/bin/composer
- name: Ensure Drupal directory exists.
file:
path: "{{ drupal_core_path }}"
state: directory
owner: www-data
group: www-data
- name: Check if Drupal project already exists.
stat:
path: "{{ drupal_core_path }}/composer.json"
register: drupal_composer_json
- name: Create Drupal project.
composer:
command: create-project
arguments: drupal/recommended-project "{{ drupal_core_path }}"
working_dir: "{{ drupal_core_path }}"
no_dev: true
become_user: www-data
when: not drupal_composer_json.stat.exists
- name: Add drush to the Drupal site with Composer.
composer:
command: require
arguments: drush/drush:11.*
working_dir: "{{ drupal_core_path }}"
become_user: www-data
when: not drupal_composer_json.stat.exists
- name: Install Drupal.
command: >
vendor/bin/drush si -y --site-name="{{ drupal_site_name }}"
--account-name=admin
--account-pass=admin
--db-url=mysql://{{ domain ***@***.***/{{ domain }}
--root={{ drupal_core_path }}/web
chdir={{ drupal_core_path }}
creates={{ drupal_core_path }}/web/sites/default/settings.php
notify: restart apache
become_user: www-data
My vars file
---
# The path where Drupal will be downloaded and installed
drupal_core_path: "/var/www/drupal"
# the resulting domain will be [domain].test (with .test appended)
domain: "drupal"
# Drupal site name
drupal_site_name: "Drupal Test"
My ansible.cfg is as follows
[defaults]
inventory = hosts.ini
remote_tmp = /var/tmp/${USER}/ansible
[ssh_connection]
pipelining=True
And relevant hosts.ini portion
# Ubuntu vm on proxmox-1
[ubu1]
ubu-1.home
I am using WSL2 on Windows 11 to run the playbook against the host.
I receive the following output which does not complete at TASK [Install
Drupal]
BECOME password:
PLAY [ubu1] ********************************************************************************************************************
TASK [Gathering Facts] *********************************************************************************************************
ok: [ubu-1.home]
TASK [Update apt cache if needed.] *********************************************************************************************
ok: [ubu-1.home]
TASK [Get software for apt repository management.] *****************************************************************************
ok: [ubu-1.home]
TASK [Add ondrej repository for later versions of PHP.] ************************************************************************
ok: [ubu-1.home]
TASK [Install Apache, MySQL, PHP, and other dependencies.] *********************************************************************
ok: [ubu-1.home]
TASK [Disable the firewall (since this is for local dev only).] ****************************************************************
ok: [ubu-1.home]
TASK [Start Apache, MySQL, and PHP.] *******************************************************************************************
ok: [ubu-1.home] => (item=apache2)
ok: [ubu-1.home] => (item=mysql)
TASK [Enable Apache rewrite module (required for Drupal).] *********************************************************************
ok: [ubu-1.home]
TASK [Add Apache virtualhost for Drupal.] **************************************************************************************
ok: [ubu-1.home]
TASK [Enable the Drupal site.] *************************************************************************************************
ok: [ubu-1.home]
TASK [Disable the default site.] ***********************************************************************************************
ok: [ubu-1.home]
TASK [Adjust OpCache memory setting.] ******************************************************************************************
ok: [ubu-1.home]
TASK [Create a MySQL database for Drupal.] *************************************************************************************
ok: [ubu-1.home]
TASK [Create a MySQL user for Drupal.] *****************************************************************************************
[WARNING]: Option column_case_sensitive is not provided. The default is now false, so the column's name will be uppercased. The
default will be changed to true in community.mysql 4.0.0.
ok: [ubu-1.home]
TASK [Download Composer installer.] ********************************************************************************************
ok: [ubu-1.home]
TASK [Run Composer installer.] *************************************************************************************************
ok: [ubu-1.home]
TASK [Move Composer into globally-accessible location.] ************************************************************************
ok: [ubu-1.home]
TASK [Ensure Drupal directory exists.] *****************************************************************************************
ok: [ubu-1.home]
TASK [Check if Drupal project already exists.] *********************************************************************************
ok: [ubu-1.home]
TASK [Create Drupal project.] **************************************************************************************************
skipping: [ubu-1.home]
TASK [Add drush to the Drupal site with Composer.] *****************************************************************************
skipping: [ubu-1.home]
TASK [Install Drupal.] *********************************************************************************************************
fatal: [ubu-1.home]: FAILED! => {"changed": false, "cmd": "vendor/bin/drush si -y '--site-name=Drupal Test' --account-name=admin --account-pass=admin ***@***.***/drupal' --root=/var/www/drupal/web", "msg": "[Errno 2] No such file or directory: b'vendor/bin/drush'", "rc": 2, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
PLAY RECAP *********************************************************************************************************************
ubu-1.home : ok=19 changed=0 unreachable=0 failed=1 skipped=2 rescued=0 ignored=0
—
Reply to this email directly, view it on GitHub
<#583>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAISQE3YCH7GC3UUKGDIXDTY724DRAVCNFSM6AAAAABG7CX3VOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3TAMBSGM2DSMQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
***************** ************* *********** ******* ***** *** **
"Transparency builds institutional legitimacy - and
opacity destroys it."
-- Noah Bookbinder (Citizens for Responsibility and Ethics in
Washington)
"Quis custodiet ipsos custodes?"
(Who can watch the watchmen?)
-- from the Satires of Juvenal
"I do not fear computers, I fear the lack of them."
-- Isaac Asimov (Author)
"I was raised on a diet of Indiana Jones and Captain America and loved them
both. It's pretty clear how I feel about Nazis."
-- /u//ThePopDaddy - 2023-07-09
** *** ***** ******* *********** ************* *****************
|
The yaml is copied directly from Jeff's code here after it wasn't working with my manually typed code. Attempting to change to your code throws the same error
|
Does the 'drush' executable exist in the '{{ drupal_core_path }}/
vendor/bin/' directory?
…On Mon, Apr 29, 2024, 21:28 Taubin ***@***.***> wrote:
The yaml is copied directly from Jeff's code here
<https://github.com/geerlingguy/ansible-for-devops/blob/8058f712c375039dd62c67b8c2518795718b262f/drupal/provisioning/playbook.yml#L152C1-L162C28>
after it wasn't working with my manually typed code.
Attempting to change to your code throws the same error
- name: Install Drupal.
ansible.builtin.command:
argv:
- vendor/bin/drush si -y --site-name="{{ drupal_site_name }}"
- --account-name=admin
- --account-pass=admin
- --db-url=mysql://{{ domain ***@***.***/{{ domain }}
- --root={{ drupal_core_path }}/web
chdir: '{{ drupal_core_path }}'
creates: '{{ drupal_core_path }}/web/sites/default/settings.php'
notify: restart apache
become_user: www-data
TASK [Install Drupal.] *********************************************************************************************************
fatal: [ubu-1.home]: FAILED! => {"changed": false, "cmd": "'vendor/bin/drush si -y --site-name=\"Drupal Test\"' --account-name=admin --account-pass=admin ***@***.***/drupal' --root=/var/www/drupal/web", "msg": "[Errno 2] No such file or directory: b'vendor/bin/drush si -y --site-name=\"Drupal Test\"'", "rc": 2, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
—
Reply to this email directly, view it on GitHub
<#583 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAISQEYRHCK32RGQVBOWWYLY736VVAVCNFSM6AAAAABG7CX3VOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBUGIZTIMRYG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
No it does not
It doesn't get created by the playbook |
@Taubin
this causes the problem, i just removed this line. |
Indeed, see #577 :) |
Thank you very much guys, feel free to close this, or leave it open if that helps the process. I appreciate the help. |
I'm attempting to follow the book and perform the installation of Drupal on an Ubuntu VM.
I created a new ubuntu 20.04 VM and performed updates on the host (sudo apt update && sudo apt upgrade -y).
I then ran the following playbook against the host (ubu-1.home)
My vars file
My ansible.cfg is as follows
And relevant hosts.ini portion
I am using WSL2 on Windows 11 to run the playbook against the host.
I receive the following output which does not complete at TASK [Install Drupal]
The text was updated successfully, but these errors were encountered: