Giter VIP home page Giter VIP logo

ansible-role-boot's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-boot's Issues

Ansible: lxc_container module not working?

Edit: Closing because James identified the problem. The issue was that the pylxc Pip package was conflicting with lxc-python2 because they both contain a module named lxc, and they're in the same namespace. The solution was to uninstall the pylxc Pip package (not even sure what it is).

Hi James,

I'm trying to apply this Ansible role.

Here is my environment. Notice the lxc and lxc-python2 libraries are installed:

(ansible-venv) david@david-ThinkPad-X260:~/virtualenvs/eeyore$ ansible-playbook --version
ansible-playbook 2.2.0 (devel 26118a51f8) last updated 2016/08/30 16:35:26 (GMT -400)
  lib/ansible/modules/core: (detached HEAD 5310bab12f) last updated 2016/08/30 16:35:28 (GMT -400)
  lib/ansible/modules/extras: (detached HEAD 2ef4a34eee) last updated 2016/08/30 16:35:30 (GMT -400)
  config file = 
  configured module search path = Default w/o overrides

(ansible-venv) david@david-ThinkPad-X260:~/virtualenvs/eeyore$ pip list
ansible (2.2.0, /home/david/.virtualenvs/ansible-venv/src/ansible/lib)
cffi (1.7.0)
cryptography (1.5)
enum34 (1.1.6)
idna (2.1)
ipaddress (1.0.16)
Jinja2 (2.8)
lxc-python2 (0.1)
MarkupSafe (0.23)
paramiko (2.0.2)
passlib (1.6.5)
pexpect (4.2.0)
pip (8.1.2)
pkg-resources (0.0.0)
ptyprocess (0.5.1)
pyasn1 (0.1.9)
pycparser (2.14)
pycrypto (2.6.1)
pylxc (0.0.3)
PyYAML (3.12)
setuptools (26.1.1)
six (1.10.0)
wheel (0.29.0)

However, during the task Start containers, I get this error:

TASK [novafloss.boot : Start container] ****************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'module' object has no attribute 'Container'
failed: [localhost] (item=postgresql.lxc) => {
    "failed": true, 
    "item": "postgresql.lxc", 
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_EA8xzI/ansible_module_lxc_container.py\", line 1759, in <module>\n    main()\n  File \"/tmp/ansible_EA8xzI/ansible_module_lxc_container.py\", line 1752, in main\n    lxc_manage = LxcContainerManagement(module=module)\n  File \"/tmp/ansible_EA8xzI/ansible_module_lxc_container.py\", line 608, in __init__\n    self.container = self.get_container_bind()\n  File \"/tmp/ansible_EA8xzI/ansible_module_lxc_container.py\", line 613, in get_container_bind\n    return lxc.Container(name=self.container_name)\nAttributeError: 'module' object has no attribute 'Container'\n", 
    "module_stdout": ""
}

MSG:

MODULE FAILURE

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'module' object has no attribute 'Container'
failed: [localhost] (item=rabbitmq.lxc) => {
    "failed": true, 
    "item": "rabbitmq.lxc", 
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_r8xVI0/ansible_module_lxc_container.py\", line 1759, in <module>\n    main()\n  File \"/tmp/ansible_r8xVI0/ansible_module_lxc_container.py\", line 1752, in main\n    lxc_manage = LxcContainerManagement(module=module)\n  File \"/tmp/ansible_r8xVI0/ansible_module_lxc_container.py\", line 608, in __init__\n    self.container = self.get_container_bind()\n  File \"/tmp/ansible_r8xVI0/ansible_module_lxc_container.py\", line 613, in get_container_bind\n    return lxc.Container(name=self.container_name)\nAttributeError: 'module' object has no attribute 'Container'\n", 
    "module_stdout": ""
}

MSG:

MODULE FAILURE

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'module' object has no attribute 'Container'
failed: [localhost] (item=eeyore.lxc) => {
    "failed": true, 
    "item": "eeyore.lxc", 
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_5bVpOf/ansible_module_lxc_container.py\", line 1759, in <module>\n    main()\n  File \"/tmp/ansible_5bVpOf/ansible_module_lxc_container.py\", line 1752, in main\n    lxc_manage = LxcContainerManagement(module=module)\n  File \"/tmp/ansible_5bVpOf/ansible_module_lxc_container.py\", line 608, in __init__\n    self.container = self.get_container_bind()\n  File \"/tmp/ansible_5bVpOf/ansible_module_lxc_container.py\", line 613, in get_container_bind\n    return lxc.Container(name=self.container_name)\nAttributeError: 'module' object has no attribute 'Container'\n", 
    "module_stdout": ""
}

MSG:

MODULE FAILURE

    to retry, use: --limit @local.retry

PLAY RECAP *********************************************************************
localhost                  : ok=6    changed=0    unreachable=0    failed=1   

If I go to line 608 of the lxc_container module file, I see this:

self.container = self.get_container_bind()

And the function definition for get_container_bind() is:

def get_container_bind(self):
   return lxc.Container(name=self.container_name)

This is the problem: lxc module has no such attribute Container. You can see it in a shell:

(ansible-venv) david@david-ThinkPad-X260:~/virtualenvs/eeyore/ansible$ python
Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxc
>>> my_container = lxc.Container("my_cool_name")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Container'

Any thoughts on why this might be? It was working in the same exact venv with the same exact setup yesterday. Nothing has changed on my end. Thanks @jpic.

Override the LANG environment variable while container creation

Hey there,

thanks for this awesome work and role first :)

When you don't set correctly your LANG variable on your host, the container creation will dump a msg of error of type:

# this dump is with LANG=en_US.utf8
Generating locales (this might take a while)...
  en_US.utf8...character map file `utf8' not found: No such file or directory
 done
Generation complete.

If you correctly set the LANG variable to a correct locale + encoding (like en_US.UTF-8), the container creation will be ok, and dump a successful message:

Generating locales (this might take a while)...
  en_US.UTF-8... done
  en_US.UTF-8... done
Generation complete.

I'm under jessie, with the default /usr/share/lxc/template/lxc-debian file.

novafloss.boot could try to check if the LANG is correct, if not, then fallback to en_US.UTF-8 as default ?

Error while booting include file

Impossible to boot a container since I updated the requirements:

TASK [novafloss.boot : include] ************************************************
fatal: [localhost]: FAILED! => {"failed": true, "reason": "no action detected in task. This often indicates a misspelled module name, or incorrect module path.\n\nThe error appears to have been in '/home/arkadefr/Projects/django-novaauth/ansible/roles/novafloss.boot/tasks/lxd.yml': line 8, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Start lxd container\n  ^ here\n\n\nThe error appears to have been in '/home/arkadefr/Projects/django-novaauth/ansible/roles/novafloss.boot/tasks/lxd.yml': line 8, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Start lxd container\n  ^ here\n"}

Cannot filter by tags

I am trying to skip the tags 'lxd' with --skip-tags "lxd" on my machine where I want to use LXC. It does not seem to take into account the skip. Any ideas?

Parameterize lxd alias

I do not have access to push a new branch so here is my modification:

commit 4bd187e6a47cb8287bdbf2e546704d74f3744f4b
Author: Aron Szekely <[email protected]>
Date:   Fri Jul 1 14:03:37 2016 -0400

    Parameterize lxd alias hostvar

diff --git a/tasks/lxd.yml b/tasks/lxd.yml
index f869130..54657ff 100644
--- a/tasks/lxd.yml
+++ b/tasks/lxd.yml
@@ -14,7 +14,7 @@
       mode: pull
       server: https://images.linuxcontainers.org
       protocol: lxd
-      alias: "ubuntu/xenial/amd64"
+      alias: '{{ hostvars[item].get("lxd_alias", "ubuntu/xenial/amd64") }}'
     profiles: ['default']
     wait_for_ipv4_addresses: true
   when: item.split('.')[-1] == 'lxd'

How can I get r/w access to this repo?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.