Skip to content

Provisioning issues with ansible on windows #138

Open

Description

@mcheck

Hey all,

Wondering if any of you have run into a similar error when provisioning a machine.
I'm using Windows 7, cygwin, virtualbox 4.3.14, vagrant 1.6.4 and genesis-wordpress 0.2.55
(Yes, I would rather be using a unix machine, but I don't have that luxury for this project :)

I get through booting the VM, but then it barfs claiming a permissions issue that I cannot reconcile:

<snip>
==> local: Updating /etc/hosts file on active guest machines...
==> local: Updating /etc/hosts file on host machine (password may be required)...
==> local: Running provisioner: hostmanager...
==> local: Running provisioner: shell...
    local: Running: inline script
==> local: stdin: is not a tty
==> local: dpkg-preconfigure: unable to re-open stdin: No such file or directory
==> local: Selecting previously unselected package software-properties-common.
==> local: (Reading database ...
==> local: 66829 files and directories currently installed.)
==> local: Unpacking software-properties-common (from .../software-properties-common_0.82.7.7_all.deb) ...
==> local: Setting up software-properties-common (0.82.7.7) ...
==> local: dpkg-preconfigure: unable to re-open stdin: No such file or directory
==> local: Selecting previously unselected package python-markupsafe.
==> local: (Reading database ...
==> local: 66843 files and directories currently installed.)
==> local: Unpacking python-markupsafe (from .../python-markupsafe_0.15-1_i386.deb) ...
==> local: Selecting previously unselected package python-jinja2.
==> local: Unpacking python-jinja2 (from .../python-jinja2_2.6-1ubuntu0.1_i386.deb) ...
==> local: Selecting previously unselected package sshpass.
==> local: Unpacking sshpass (from .../sshpass_1.05-1_i386.deb) ...
==> local: Selecting previously unselected package python-setuptools.
==> local: Unpacking python-setuptools (from .../python-setuptools_0.6.24-1ubuntu1_all.deb) ...
==> local: Selecting previously unselected package ansible.
==> local: Unpacking ansible (from .../ansible_1.7.1-precise-unstable-ppa_all.deb) ...
==> local: Processing triggers for man-db ...
==> local: Setting up python-markupsafe (0.15-1) ...
==> local: Setting up python-jinja2 (2.6-1ubuntu0.1) ...
==> local: Setting up sshpass (1.05-1) ...
==> local: Setting up python-setuptools (0.6.24-1ubuntu1) ...
==> local: Setting up ansible (1.7.1-precise-unstable-ppa) ...
==> local: Processing triggers for python-support ...
==> local: ERROR: The file localhost is marked as executable, but failed to execute correctly. If this is not supposed to be an executable script, correct this with `chmod -x localhost`.
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.

I assume we're talking about /provisioning/localhost, but as it states, it is not executable outside the vm, but inside, it is. I assume this has to do with using nfs as the sharing filesystem.

I tried forcing the permissions with: mount_options: ["dmode=777", "fmode=666"] but that messes up other files execution.

So, bottom line then, has anyone had experience running/provisioing genesis-wordpress on a windows box that may have had similar issues?

Thanks!

Activity

  1. mcheck commented on Sep 11, 2014

    @mcheck
    Author

    This is still an issue for me, but I got around it for now by not provisioning on the windows box. I provisioned on mac and then packaging a vagrant box. The windows box has no problems running the pre-packaged vagrant box. Long live vagrant!

  2. AntJanus commented on Sep 25, 2014

    @AntJanus
    Contributor

    @mcheck I'm on a Windows machine now so I'm figuring stuff out, hopefully I'll be able to help! :)

  3. mcheck commented on Sep 26, 2014

    @mcheck
    Author

    @AntJanus I never did get it to work to provision on windows.
    I found that it seemed like a 64bit issue so I started down the path of looking at the bios to make sure support for VT-x and such was enabled. I tried moving it to 32bit, but still no luck.

    I ended up provisioning on my mac and creating a vagrant package that I could pick up on the PC. Once I pulled in the customized vagrant package to windows, all worked swimmingly - in 64bit no less.

    So possibly something with ansible and the way permissions are done between virtual vagrant shares. But once provisioned, works well.

    If you come across any hurdles, let me know, I'll try to help where I can.

  4. ericclemmons commented on Sep 26, 2014

    @ericclemmons
    Contributor

    @mcheck I've considered this for Evolution (the next, better iteration of Genesis), but what do you think?

    With each release (v1.0.0, v1.2.3, etc.), save the Vagrant image for end-users.

    This would mean big VM sizes (boo), but would mean that if a user wanted to get up-and-going ASAP, having the VM ready would mean much faster initial project creations.

    Thoughts?

  5. mcheck commented on Sep 26, 2014

    @mcheck
    Author

    @AntJanus @ericclemmons
    I think a vagrant box image is a great idea. When I started using Genesis, the provisioning part was the hardest to get past and configured. I sure learned a lot hacking at it, and I think that's where we came up with changes to apache and varnish, etc. BUT an image would certainly speed things up and, I would guess, increase the number of developers trying it out.

    Perhaps Genesis/Evolution can be hosted on vagrantcloud.com ? Not totally sure, but I think open source projects can have multiple boxes on there. And you would get a cool url pull from in the vagrantfile like evolution/wordpress :)

  6. AntJanus commented on Oct 9, 2014

    @AntJanus
    Contributor

    @mcheck @ericclemmons that totally makes sense. So the issue is, I found out, is the way that VirtualBox syncs files. It completely ignores permissions (when on Windows) which causes Ansible to throw that error. There are several workarounds for it:

    1. copy all of provisioning files straight onto the box (without syncing)
    2. modify permissions to 622 during the provisioning (I got that off another Vagrant project)

    I'm going ahead and creating a box in a linux box I'm running and then pulling it down onto Windows

  7. ericclemmons commented on Oct 9, 2014

    @ericclemmons
    Contributor

    That 622 note is the way to go, IMO. Already, genesis:ssh chmod's the id_rsa to 600, because Git doesn't respect permissions, but it makes sense to enforce this...

  8. TimonVS commented on Oct 27, 2014

    @TimonVS

    Are there any plans on implementing this "fix"? I'd really like to be able to use this generator on Windows until I get my MacBook next year.

  9. EvanK commented on May 1, 2015

    @EvanK
    Contributor

    @AntJanus Do you recall if this 622 permission was necessary for all provisioning files, or just the inventory?

  10. Skynet2029 commented on May 27, 2015

    @Skynet2029

    pls fix this for Win users.

  11. EvanK commented on May 28, 2015

    @EvanK
    Contributor

    There is a totally untested fix for this (since I don't currently have access to a Windows machine), on the 138-provisiong-win-permhack branch.

    Feedback is welcome

  12. EvanK commented on May 28, 2015

    @EvanK
    Contributor

    Update: first commit on that branch actually broke on OSX/POSIX...so I doubt it fixed the issue in Windows. Second commit (b9faec7) has promise though

  13. Skynet2029 commented on May 29, 2015

    @Skynet2029

    Sorry but this patch does not work for me. The same error occurred.

    ==> local: Processing triggers for python-support ...
    ==> local: ERROR: The file localhost is marked as executable, but failed to execute correct
    y. If this is not supposed to be an executable script, correct this with `chmod -x localhos
    `.
    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.
    
    Skynet@T1000 /f/wp-genesis/src/test.dev (138-provisiong-win-permhack)
    

    virtualbox 4.3.12, vagrant 1.6.5

  14. EvanK commented on Jun 1, 2015

    @EvanK
    Contributor

    @TeodorMarinov Can you ssh into the vagrant machine and post what you get from ls -al /vagrant/provisioning/?

  15. Skynet2029 commented on Jun 1, 2015

    @Skynet2029
    vagrant@local:~$ ls -al /vagrant/provisioning/
    total 11
    drwxrwxrwx 1 vagrant vagrant 4096 Jun  1 20:57 .
    drwxrwxrwx 1 vagrant vagrant 4096 Jun  1 20:57 ..
    drwxrwxrwx 1 vagrant vagrant    0 Jun  1 20:57 files
    drwxrwxrwx 1 vagrant vagrant    0 Jun  1 20:57 group_vars
    -rwxrwxrwx 1 vagrant vagrant  101 Jun  1 20:57 local
    -rwxrwxrwx 1 vagrant vagrant   49 Jun  1 20:57 localhost
    -rwxrwxrwx 1 vagrant vagrant  106 Jun  1 20:57 production
    -rwxrwxrwx 1 vagrant vagrant  922 Jun  1 20:57 provision.yml
    -rwxrwxrwx 1 vagrant vagrant  103 Jun  1 20:57 staging
    
  16. EvanK commented on Jun 2, 2015

    @EvanK
    Contributor

    One last try! In 88c69f9 we are actually copying the inventory file to a wholly separate and NOT synced location, resetting its permissions, and then specifying it as the inventory for ansible to use.

    @TeodorMarinov Please try this out, and if it fails, let me know what output you get from ls -al /tmp/ansible-inventory-localhost

  17. AntJanus commented on Jun 3, 2015

    @AntJanus
    Contributor

    @EvanK I battled with that for a while. I wonder how this will turn out. At some point, I gave up and started dual-booting with Linux.

  18. EvanK commented on Jun 3, 2015

    @EvanK
    Contributor

    @AntJanus Yeah, this is frustrating, even for a platform we don't "officially" support.

    Evolution is using native Ansible provisioning, so hopefully won't suffer from this bug. And I'm currently working on a simpler upgrade path to Evolution, at which point we can retire Genesis once and for all.

  19. AntJanus commented on Jun 23, 2016

    @AntJanus
    Contributor

    Hey guys, I know this is a year too late but I figured out what to do. The localhost file is the issue but it's super-easy to remedy by altering it to be an executable Ruby script (host files can be executable!) like so:

    #!/usr/bin/env ruby
    
    require 'json'
    
    module LT
      module Ansible
        def self.staging_inventory
          {
            webservers: {
              hosts: ["127.0.0.1"],
              vars: {
                ansible_connection: "local"
              }
            }
          }
        end
      end
    end
    
    if ARGV.find_index("--list") then
      puts LT::Ansible::staging_inventory.to_json
    end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions