Giter Site home page Giter Site logo

ansible-connection-nsenter's Introduction

ansible-connection-nsenter

It's implements ansible connector that enable you to connect to a systemd-nspawn container.

Description

If connecting with nsenter, you need root privilege.

Quick Start

tl;dr

  1. Create your container.
  2. Add nsenter.py to your connectoin plugin's directory.
  3. Specify your container on your Ansible Inventory.
  4. Add nsenter connection settings and become settings to your Ansible playbook.
  5. Run ansible-playbook command with K option.

You must create systemd-nspawn container under /var/lib/machines on Fedora 22. And then, you must start container with # machinectl start <container_name>.

If you finish steps below, you can see this directory structure.

$ tree
.
├── connection_plugins
│   └── nsenter.py
├── hosts
└── playbook.yml
  1. Create connection_plugin directory under Ansible directory.

    $ cd /path/to/ansible/working/dir/
    $ mkdir connection_plugins
    $ curl https://raw.githubusercontent.com/jptomo/ansible-nsenter/master/nsenter.py -o connection_plugins/nsenter.py
  2. Specify your container on your Ansible Inventory.

    Like this

    $ cat > hosts
    <container_name>
  3. Add Ansible playbook.

    Like this

    $ cat > playbook.yml
    ---
    - hosts: all
      connection: nsenter
      become: yes
      tasks:
      - command: uname -a
        register: foo
      - debug: msg="{{foo}}"

    You must specify connection: nsenter and become: yes.

  4. Run ansible-playbook command with K option.

    The nsenter connection plusgin needs sudo permission, and if you run command below, you shoud specify your current user's password.

    $ ansible-playbook -i hosts playbook.yml -K

ansible-connection-nsenter's People

Contributors

tomoh1r avatar

Watchers

 avatar

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.