python
  • ansible
  • ansible-playbook
  • lxc
  • devops
  • 2016-03-24 7 views 1 likes 
    1

    私はターゲットホストはlocalhostですが、それはこの後Ansibleでlxc_containerモジュールを使用するには?

    failed: [127.0.0.1] => (item=app01) => {"failed": true, "item": "app01", "parsed": false} 
    BECOME-SUCCESS-rppgggxcewgndkgtnpptrgeglbfykput 
    failed=True msg='The lxc module is not importable. Check the requirements.' 
    The lxc module is not importable. Check the requirements 
    

    を失敗し、上映次のエラーされ、この脚本

    --- 
    - hosts: control 
        become: yes 
        tasks: 
        - name: Stop All Linux Containers 
         lxc_container: name={{ item }} state=started 
         with_items: 
         - app01 
         - app02 
         - lb01 
         - db01 
    

    を実行しようとしています、私は(それを見た

    pip install lxc-python2 
    

    を試してみました別のstackoverflow投稿から)しかし、それはあまりにもエラーを示しています

    lxc.c:27:30: fatal error: lxc/lxccontainer.h: No such file or directory 
    
    #include <lxc/lxccontainer.h> 
    
              ^
    
    compilation terminated. 
    
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 
    
    ---------------------------------------- 
    Cleaning up... 
    Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_dhruv/lxc-python2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZKdf9M-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_dhruv/lxc-python2 
    Storing debug log for failure in /home/dhruv/.pip/pip.log 
    

    答えて

    2

    これは、lxc-devパッケージをインストールしていない場合に発生する可能性があります。 Debianリポジトリにはそれが含まれておらず、あなたはサードパーティからダウンロードする必要があります。ubuntu

    +0

    この質問で同じエラーがあり、lxc-devがこのトリックでした!ありがとう – Deano

    0

    devパッケージ(lxc-dev)、またはpipが対象ホストに存在する必要はありませんlxc_container -Ansibleモジュールの通常動作。ターゲットホストには、python2だけが必要です。管理ホストのLXCコンテナモジュールのドキュメントに記載されているパッケージ(Unsibleを実行するもの)。

    関連する問題