DavidWittman / ansible-redis

Highly-configurable Ansible role to install Redis and Redis Sentinel from source
MIT License
663 stars 288 forks source link

Failing with vagrant 1.4.3 + ansible 1.9 (dev) #50

Closed MarcosMenegazzo closed 9 years ago

MarcosMenegazzo commented 9 years ago

Hello, i'm trying to use your role script to configure a vagrant virtual machine.

My playbook:


---
- hosts: all 
  user: vagrant
  sudo: yes 
  roles:
    - DavidWittman.redis
    - database

Running "vagrant up" i get:

Bringing machine 'payroll' up with 'virtualbox' provider...
[payroll] Importing base box 'precise32'...
[payroll] Matching MAC address for NAT networking...
[payroll] Setting the name of the VM...
[payroll] Clearing any previously set forwarded ports...
[payroll] Clearing any previously set network interfaces...
[payroll] Preparing network interfaces based on configuration...
[payroll] Forwarding ports...
[payroll] -- 22 => 2222 (adapter 1)
[payroll] Booting VM...
[payroll] Waiting for machine to boot. This may take a few minutes...
[payroll] Machine booted and ready!
[payroll] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
prevent things such as shared folders from working properly. If you see
shared folder errors, please make sure the guest additions within the
virtual machine match the version of VirtualBox you have installed on
your host and reload your VM.

Guest Additions Version: 4.2.0
VirtualBox Version: 4.3
[payroll] Configuring and enabling network interfaces...
[payroll] Mounting shared folders...
[payroll] -- /vagrant
[payroll] Running provisioner: ansible...

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [payroll]

TASK: [DavidWittman.redis | install dependencies] ***************************** 
changed: [payroll] => (item=gcc,make,libc6-dev)

TASK: [DavidWittman.redis | install dependencies] ***************************** 
skipping: [payroll]

TASK: [DavidWittman.redis | enable overcommit in sysctl] ********************** 
changed: [payroll]

TASK: [DavidWittman.redis | add redis user] *********************************** 
changed: [payroll]

TASK: [DavidWittman.redis | download redis] *********************************** 
changed: [payroll]

TASK: [DavidWittman.redis | upload redis] ************************************* 
skipping: [payroll]

TASK: [DavidWittman.redis | extract redis tarball] **************************** 
changed: [payroll]

TASK: [DavidWittman.redis | compile redis] ************************************ 
changed: [payroll]

TASK: [DavidWittman.redis | create redis install directory] ******************* 
ok: [payroll]

TASK: [DavidWittman.redis | create /etc/redis] ******************************** 
changed: [payroll]

TASK: [DavidWittman.redis | create /var/run/redis] **************************** 
changed: [payroll]

TASK: [DavidWittman.redis | install redis] ************************************ 
changed: [payroll]

TASK: [DavidWittman.redis | list redis binaries] ****************************** 
ok: [payroll]

TASK: [DavidWittman.redis | add redis binaries to alternatives] *************** 
failed: [payroll] => (item=redis-benchmark) => {"failed": true, "item": "redis-benchmark", "parsed": false}
SUDO-SUCCESS-ukekmrntwbssexuzjesgrgrsnvxovkqg
Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424885715.08-274944950675321/alternatives", line 1723, in <module>
    main()
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424885715.08-274944950675321/alternatives", line 126, in main
    line_name, line_mode, line_path = line.strip().split("\t")
ValueError: need more than 1 value to unpack

failed: [payroll] => (item=redis-check-aof) => {"failed": true, "item": "redis-check-aof", "parsed": false}
SUDO-SUCCESS-herdhrmjwuehyatkopuplogtywaosaph
Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424885715.27-64895011136970/alternatives", line 1723, in <module>
    main()
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424885715.27-64895011136970/alternatives", line 126, in main
    line_name, line_mode, line_path = line.strip().split("\t")
ValueError: need more than 1 value to unpack

failed: [payroll] => (item=redis-check-dump) => {"failed": true, "item": "redis-check-dump", "parsed": false}
SUDO-SUCCESS-fyqfxpjfoeilddbqlthcosdoejjphyhf
Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424885715.45-51532570914849/alternatives", line 1723, in <module>
    main()
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424885715.45-51532570914849/alternatives", line 126, in main
    line_name, line_mode, line_path = line.strip().split("\t")
ValueError: need more than 1 value to unpack

failed: [payroll] => (item=redis-cli) => {"failed": true, "item": "redis-cli", "parsed": false}
SUDO-SUCCESS-htrsqivxvwgfilfataujadaqqxdrhieq
Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424885715.61-128316913027241/alternatives", line 1723, in <module>
    main()
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424885715.61-128316913027241/alternatives", line 126, in main
    line_name, line_mode, line_path = line.strip().split("\t")
ValueError: need more than 1 value to unpack

failed: [payroll] => (item=redis-server) => {"failed": true, "item": "redis-server", "parsed": false}
SUDO-SUCCESS-uvahlwknzeuzpxrpwchvuooglmchmefi
Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424885715.79-139109903766318/alternatives", line 1723, in <module>
    main()
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1424885715.79-139109903766318/alternatives", line 126, in main
    line_name, line_mode, line_path = line.strip().split("\t")
ValueError: need more than 1 value to unpack

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/menegazzo/playbook.retry

payroll                    : ok=12   changed=9    unreachable=0    failed=1   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

Seems to be an issue with ansible, but i have no idea where to start.

Any tips will be welcome.

MarcosMenegazzo commented 9 years ago

I've just checked Ansible 1.6.3 and tried again. It works. I think now is necessary to try newer versions and check where it fails.

MarcosMenegazzo commented 9 years ago

This is happening since Ansible 1.8.0.

hq-bot commented 9 years ago

I'm seeing a similar issue on:

ansible 1.9 (devel 556d4f0025) last updated 2015/01/28 16:59:41 (GMT -700)
Vagrant 1.7.2
OSX 10.10.2

the update-alternatives groups for:

"redis-benchmark", 
"redis-check-aof", 
"redis-check-dump", 
"redis-cli", 
"redis-sentinel", 
"redis-server"

don't appear to exist. getting this error message for each group above:

failed: [my-host] => (item=redis-server) => {"cmd": "/usr/bin/update-alternatives --set redis-server /opt/redis/bin/redis-server", "failed": true, "item": "redis-server", "rc": 2}
stderr: update-alternatives: error: no alternatives for redis-server

msg: update-alternatives: error: no alternatives for redis-server

i think the solution could be something like checking the alternatives system for each group. if it doesn't exist, then do --install instead of --set. though this could just be a symptom of a larger issue.

DavidWittman commented 9 years ago

Thanks for reporting this. I was able to reproduce this on the current HEAD of Ansible. It is likely a regression in the alternatives module; I'll look into a sound solution there.

@MarcosMenegazzo I'm unable to reproduce the issue on versions of Ansible prior to 1.9.x. Could you give me more details about your build environment? Specifically the target guest distribution. I tested on the past two Ubuntu LTS releases and didn't seem to have any problems.

MarcosMenegazzo commented 9 years ago

Hello @DavidWittman, I'm running ansible over Ubuntu 14.04, and my vagrant VM is Ubuntu Precise 32 (12.04 i think). First i tried your script with Ansible HEAD, i got that error you saw. Then i checked tag 1.6.3 and it worked well. And after that, i tried to checked every newer tag of Ansible until i get the error again, and the error reappeared with Ansible 1.8.0.

ilganeli commented 9 years ago

Hi @DavidWittman is there a fix for this in the mean-time? This is a blocker for us. Thanks!

DavidWittman commented 9 years ago

The alternatives module seems to be broken in a bad way. See https://github.com/ansible/ansible-modules-extras/issues/12 for more details.

I'm going to be removing the add redis binaries to alternatives task until it is stable.

DavidWittman commented 9 years ago

@MarcosMenegazzo @ilganeli @hq-bot I "fixed" this issue by removing these tasks for now.

I also opened a pull request upstream to fix the root of the problem in the alternatives module.

Let me know if you're still having any issues.

ghost commented 9 years ago

I'm also seeing this error with Ansible 1.9.0.1.

DavidWittman commented 9 years ago

@ruebrenda Are you using the latest version of this role? I removed the tasks which were causing these issues in this commit, which was a part of the release for version 1.0.3.

ghost commented 9 years ago

@DavidWittman Somehow I ended up here when I was googling for how to resolve this same error on the Ansible alternatives module. I'm not using redis in my project at all... it was your comment on Mar 13 that prompted my "me too". I.e., this PR: https://github.com/ansible/ansible-modules-extras/pull/313

Sorry for the confusion.

ghost commented 9 years ago

@DavidWittman I think I see now. Looks like your merged PR hasn't made it to the release, yet.