geerlingguy / drupal-vm

A VM for Drupal development
https://www.drupalvm.com/
MIT License
1.37k stars 645 forks source link

ansible_ssh_user is undefined #622

Closed sbubaron closed 8 years ago

sbubaron commented 8 years ago

I am working on upgrading to v2.51

Received the below error, I found this related issue https://github.com/geerlingguy/drupal-vm/issues/602 but I am already / have been on 14.04. Ansible --version is reporting 2.02 inside the vm. Ansible is not installed locally on my mac. Vagrant has been upgraded to 1.8.1

vagrant@asasbu:~$ ansible --version
ansible 2.0.2.0
  config file = 
  configured module search path = Default w/o overrides
vagrant@asasbu:~$ 
==> asasbu.localvm: TASK [geerlingguy.nodejs : Add NodeSource repositories for Node.js.] ***********
==> asasbu.localvm: ok: [localhost] => (item=deb https://deb.nodesource.com/node_0.12 trusty main)
==> asasbu.localvm: ok: [localhost] => (item=deb-src https://deb.nodesource.com/node_0.12 trusty main)
==> asasbu.localvm: 
==> asasbu.localvm: TASK [geerlingguy.nodejs : Ensure Node.js and npm are installed.] **************
==> asasbu.localvm: ok: [localhost]
==> asasbu.localvm: 
==> asasbu.localvm: TASK [geerlingguy.nodejs : Define nodejs_install_npm_user] *********************
==> asasbu.localvm: fatal: [localhost]: FAILED! => {"failed": true, "msg": "'ansible_ssh_user' is undefined"}
==> asasbu.localvm: 
==> asasbu.localvm: NO MORE HOSTS LEFT *************************************************************
==> asasbu.localvm:     to retry, use: --limit @/vagrant//drupalvm-251/provisioning/playbook.retry
==> asasbu.localvm: 
==> asasbu.localvm: PLAY RECAP *********************************************************************
==> asasbu.localvm: localhost                  : ok=132  changed=2    unreachable=0    failed=1   
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

config.yml:


---
# `vagrant_box` can also be set to geerlingguy/centos6, geerlingguy/centos7,
# geerlingguy/ubuntu1204, parallels/ubuntu-14.04, etc.
vagrant_box: geerlingguy/ubuntu1404
vagrant_user: vagrant
vagrant_synced_folder_default_type: nfs

# If you need to run multiple instances of Drupal VM, set a unique hostname,
# machine name, and IP address for each instance.
vagrant_hostname: asasbu.localvm.stonybrook.edu
vagrant_machine_name: asasbu.localvm
vagrant_ip: 192.168.88.90

# Allow Drupal VM to be accessed via a public network interface on your host.
# Vagrant boxes are insecure by default, so be careful. You've been warned!
# See: https://docs.vagrantup.com/v2/networking/public_network.html
vagrant_public_ip: ""

# A list of synced folders, with the keys 'local_path', 'destination', and
# a 'type' of [nfs|rsync|smb] (leave empty for slow native shares). See
# http://docs.drupalvm.com/en/latest/extras/syncing-folders/ for more info.
vagrant_synced_folders:
  # The first synced folder will be used for the default Drupal installation, if
  # build_makefile: is 'true'.
  - local_path: /Users/rich/git/asasbu
    destination: /var/www/asasbu
    type: nfs
    create: true

 ### - local_path: ~/git/unity
 ###   destination: /var/www/unity
 ###   type: ""
 ###   create: true

# Memory and CPU to use for this VM.
vagrant_memory: 1024
vagrant_cpus: 2

# The web server software to use. Can be either 'apache' or 'nginx'.
drupalvm_webserver: apache

# Set this to false if you are using a different site deployment strategy and
# would like to configure 'vagrant_synced_folders' and 'apache_vhosts' manually.
build_makefile: false
##drush_makefile_path: /vagrant/drupal.make.yml

# Set this to false if you don't need to install drupal (using the drupal_*
# settings below), but instead copy down a database (e.g. using drush sql-sync).
install_site: false

# Settings for building a Drupal site from a makefile (if 'build_makefile:'
# is 'true').

drupal_major_version: 7
drupal_core_path: "/var/www/asasbu/docroot"
#drupal_cert_path: "/var/www/asasbu/.cert/asasbu.crt"
#drupal_cert_key_path: "/var/www/asasbu/.cert/asasbu.key"
drupal_domain: asasbu.localvm.stonybrook.edu
##drupal_site_name: "Drupal"
##drupal_install_profile: standard
##drupal_enable_modules: [ 'devel' ]
##drupal_account_name: admin
##drupal_account_pass: admin
drupal_mysql_user: drupaluser
drupal_mysql_password: drupal
drupal_mysql_database: default_asasbu

# Additional arguments or options to pass to `drush site-install`.
drupal_site_install_extra_args: []

# Cron jobs are added to the root user's crontab. Keys include name (required),
# minute, hour, day, weekday, month, job (required), and state.
drupalvm_cron_jobs: []
  # - {
  #   name: "Drupal Cron",
  #   minute: "*/30",
  #   job: "drush -r {{ drupal_core_path }} core-cron"
  # }

# Drupal VM automatically creates a drush alias file in your ~/.drush folder if
# this variable is 'true'.
configure_local_drush_aliases: false

# Apache VirtualHosts. Add one for each site you are running inside the VM. For
# multisite deployments, you can point multiple servernames at one documentroot.
# View the geerlingguy.apache Ansible Role README for more options.

apache_vhosts:

  - servername: "adminer.asasbu.localvm.stonybrook.edu"
    documentroot: "/opt/adminer"

  - servername: "xhprof.asasbu.localvm.stonybrook.edu"
    documentroot: "/usr/share/php/xhprof_html"

  - servername: "pimpmylog.asasbu.localvm.stonybrook.edu"
    documentroot: "/usr/share/php/pimpmylog"

  - servername: "bursar.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "campuscard.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "childcare.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "ehs.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "explore.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "energy.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "pci.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "policy.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "propertycontrol.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "sustainability.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "wolfmart.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "template.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "tester.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"

  - servername: "{{ vagrant_ip }}"
    serveralias: "dashboard.{{ vagrant_hostname }}"
    documentroot: "{{ dashboard_install_dir }}"

apache_remove_default_vhost: true
apache_mods_enabled:
  - expires.load
  - ssl.load
  - rewrite.load
  - headers.load
  - include.load
  - proxy.load
  - proxy_fcgi.load

# Nginx hosts. Each site will get a server entry using the configuration defined
# here. Set the 'is_php' property for document roots that contain PHP apps like
# Drupal.
## nginx_hosts:
##  - server_name: "{{ drupal_domain }}"
##    root: "{{ drupal_core_path }}"
##    is_php: true

##  - server_name: "adminer.drupalvm.dev"
##    root: "/opt/adminer"
##    is_php: true

##  - server_name: "xhprof.drupalvm.dev"
##    root: "/usr/share/php/xhprof_html"
##    is_php: true

##  - server_name: "pimpmylog.drupalvm.dev"
##    root: "/usr/share/php/pimpmylog"
##    is_php: true

##nginx_remove_default_vhost: true
##nginx_ppa_use: true

# MySQL Databases and users. If build_makefile: is true, first database will
# be used for the makefile-built site.
mysql_databases:
  - name: "bursar_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "campuscard_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "childcare_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "ehs_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "explore_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "energy_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "pci_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "policy_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "propertycontrol_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "sustainability_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "wolfmart_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "default_asasbu"
    encoding: utf8
    collation: utf8_general_ci

mysql_users:
  - name: "drupaluser"
    host: "%"
    password: "drupal"
    priv: "*.*:ALL"

# Comment out any extra utilities you don't want to install. If you don't want
# to install *any* extras, make set this value to an empty set, e.g. `[]`.
installed_extras:
  - adminer
  # - blackfire
  - drupalconsole
  - mailhog
  - memcached
  # - newrelic
  - nodejs
  - pimpmylog
  # - redis
  # - ruby
  # - selenium
  # - solr
  - varnish
  - xdebug
  - xhprof

# Add any extra apt or yum packages you would like installed.
extra_packages:
  - unzip
  - libapache2-mod-php5

# `nodejs` must be in installed_extras for this to work.
nodejs_version: "0.12"
nodejs_npm_global_packages:
  - name: gulp
nodejs_install_npm_user: "{{ drupalvm_user }}"

# `ruby` must be in installed_extras for this to work.
ruby_install_gems_user: "{{ drupalvm_user }}"
ruby_install_gems: []

# You can configure almost anything else on the server in the rest of this file.
extra_security_enabled: false

drush_version: 8.0.5
drush_keep_updated: false
drush_composer_cli_options: "--prefer-dist --no-interaction"

firewall_allowed_tcp_ports:
  - "22"
  - "25"
  - "80"
  - "81"
  - "443"
  - "4444"
  - "8025"
  - "8080"
  - "8443"
  - "8983"
firewall_log_dropped_packets: false

# PHP Configuration. Currently-supported versions: 5.5, 5.6, 7.0 (experimental).
php_version: "5.6"
php_memory_limit: "192M"
php_display_errors: "On"
php_display_startup_errors: "On"
php_realpath_cache_size: "1024K"
php_sendmail_path: "/usr/sbin/ssmtp -t"
php_opcache_enabled_in_ini: true
php_opcache_memory_consumption: "192"
php_opcache_max_accelerated_files: 4096
php_max_input_vars: "4000"

# Drupal VM defaults to using PHP-FPM with either Apache or Nginx. If you wish
# to instead use Apache + mod_php with an Ubuntu base box, make sure you add
# libapache2-mod-php5 to `extra_packages` elsewhere in this config file.
php_enable_php_fpm: false
php_fpm_listen: "127.0.0.1:9000"

composer_path: /usr/bin/composer
composer_home_path: "/home/{{ drupalvm_user }}/.composer"
composer_home_owner: "{{ drupalvm_user }}"
composer_home_group: "{{ drupalvm_user }}"
# composer_global_packages:
#   - { name: phpunit/phpunit, release: '@stable' }

# Run specified scripts before or after VM is provisioned. Path is relative to
# the `provisioning/playbook.yml` file.
pre_provision_scripts: []
post_provision_scripts: []
  # - "../examples/scripts/configure-solr.sh"

# MySQL Configuration.
mysql_root_password: root
mysql_slow_query_log_enabled: true
mysql_slow_query_time: 2
mysql_wait_timeout: 300
adminer_install_filename: index.php

# Varnish Configuration.
varnish_listen_port: "81"
varnish_default_vcl_template_path: templates/drupalvm.vcl.j2
varnish_default_backend_host: "127.0.0.1"
varnish_default_backend_port: "80"

# Pimp my Log settings.
pimpmylog_install_dir: /usr/share/php/pimpmylog
pimpmylog_grant_all_privs: true

# XDebug configuration. XDebug is disabled by default for better performance.
php_xdebug_default_enable: 0
php_xdebug_coverage_enable: 0
php_xdebug_cli_enable: 1
php_xdebug_remote_enable: 1
php_xdebug_remote_connect_back: 1
# Use PHPSTORM for PHPStorm, sublime.xdebug for Sublime Text.
php_xdebug_idekey: PHPSTORM
php_xdebug_max_nesting_level: 256

# Solr Configuration (if enabled above).
solr_version: "4.10.4"
solr_xms: "64M"
solr_xmx: "128M"

# Selenium configuration.
selenium_version: 2.46.0

# Other configuration.
dashboard_install_dir: /var/www/dashboard
known_hosts_path: ~/.ssh/known_hosts

Thanks everyone!

oxyc commented 8 years ago

That's odd. That task should only run if nodejs_install_npm_user isn't defined. And you clearly have it defined.

Have you updated all the Drupal VM files, more specifically do you have provisioning/vars/main.yml?

oxyc commented 8 years ago

For debugging purposes, try setting nodejs_install_npm_user: vagrant and see if that works.

sbubaron commented 8 years ago

Just stepped out, will check when I get back, but yes I downloaded entire package. I'll also try your user suggestion.

FYI Slight modification to vagrantfile to keep the root of my Drupal project cleaner. Vagrantfile lives in project root, but all config lives in a drupalvm folder dir variable adjusted accordingly.

Thanks for the speedy response yet again!

Rich On May 13, 2016 10:31 PM, "Oskar Schöldström" notifications@github.com wrote:

For debugging purposes, try setting nodejs_install_npm_user: vagrant and see if that works.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/geerlingguy/drupal-vm/issues/622#issuecomment-219198100

oxyc commented 8 years ago

I don't see how a modified Vagrantfile could break the provisioning in this particular location. If something was wrong it should have failed earlier already.

In version 3.0 Drupal VM will most likely support your scenario better btw :) There's a PR which allows you to have Drupal VM in a subdirectory while storing your config files outside of it #378.

sbubaron commented 8 years ago

switched to "vagrant" still getting error: config.yml snippet of what was changed, full file above

# `nodejs` must be in installed_extras for this to work.
nodejs_version: "0.12"
#nodejs_install_npm_user: "{{ drupalvm_user }}"
nodejs_install_npm_user: vagrant
nodejs_npm_global_packages:
  - name: gulp```

==> asasbu.localvm: TASK [geerlingguy.nodejs : include] **** ==> asasbu.localvm: skipping: [localhost] ==> asasbu.localvm: ==> asasbu.localvm: TASK [geerlingguy.nodejs : include] **** ==> asasbu.localvm: included: /etc/ansible/roles/geerlingguy.nodejs/tasks/setup-Debian.yml for localhost ==> asasbu.localvm: ==> asasbu.localvm: TASK [geerlingguy.nodejs : Add Nodesource apt key.] **** ==> asasbu.localvm: changed: [localhost] ==> asasbu.localvm: ==> asasbu.localvm: TASK [geerlingguy.nodejs : Add NodeSource repositories for Node.js.] * ==> asasbu.localvm: changed: [localhost] => (item=deb https://deb.nodesource.com/node_0.12 trusty main) ==> asasbu.localvm: changed: [localhost] => (item=deb-src https://deb.nodesource.com/node_0.12 trusty main) ==> asasbu.localvm: ==> asasbu.localvm: TASK [geerlingguy.nodejs : Ensure Node.js and npm are installed.] ** ==> asasbu.localvm: changed: [localhost] ==> asasbu.localvm: ==> asasbu.localvm: TASK [geerlingguy.nodejs : Define nodejs_install_npm_user] *** ==> asasbu.localvm: fatal: [localhost]: FAILED! => {"failed": true, "msg": "'ansible_ssh_user' is undefined"} ==> asasbu.localvm: ==> asasbu.localvm: NO MORE HOSTS LEFT * ==> asasbu.localvm: ==> asasbu.localvm: RUNNING HANDLER [geerlingguy.firewall : restart firewall] ** ==> asasbu.localvm: ==> asasbu.localvm: RUNNING HANDLER [geerlingguy.apache : restart apache] ** ==> asasbu.localvm: ==> asasbu.localvm: RUNNING HANDLER [geerlingguy.mysql : restart mysql] **** ==> asasbu.localvm: ==> asasbu.localvm: RUNNING HANDLER [geerlingguy.php : restart webserver] ** ==> asasbu.localvm: ==> asasbu.localvm: RUNNING HANDLER [geerlingguy.php : restart php-fpm] **** ==> asasbu.localvm: to retry, use: --limit @/vagrant//drupalvm-251/provisioning/playbook.retry ==> asasbu.localvm: ==> asasbu.localvm: PLAY RECAP ***** ==> asasbu.localvm: localhost : ok=144 changed=66 unreachable=0 failed=1
The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong.


provisioning\vars\main.yml exists

_devtool_docroots:

drupalvm_user: "{{ ansible_ssh_user | default(ansible_env.SUDO_USER, true) | default(ansible_env.USER, true) | default(ansible_user_id) }}"

sbubaron commented 8 years ago

ah jeez, I was doing something silly, config file I was editing was actually being saved in wrong place. Sorry for wasting your time.

the vm has now booted. will try windows on Monday.

thanks for your help!

oxyc commented 8 years ago

No worries, glad you got it working!