Giter VIP home page Giter VIP logo

ansible-role-openvzmod's Introduction

Ansible Role: openvzmod

This role contains 2 modules to manage OpenVZ containers:

  • openvz: Manage OpenVZ containers
  • openvz_exec: Execute commands in the OpenVZ container

These modules is still quite immature. There are many missing features. Please file bugs at the GitHub issue tracker.

Ansible Galaxy: https://galaxy.ansible.com/list#/roles/3900

Module Options

openvz options

If this section doesn't show nicely in Ansible Galaxy Page, please refer to equeivalent in the GitHub page.

parameter required default choices comments
applyconfig no
    Parameter passed to vzctl set --applyconfig.
    avnumproc no
      UBC parameter passed to vzctl set --avnumproc.
      capability no
        Parameter passed to vzctl set --capability.
        config no
          Parameter passed to vzctl create --config.
          cpulimit no
            Parameter passed to vzctl set --cpulimit.
            cpumask no
              Parameter passed to vzctl set --cpumask.
              cpus no
                Parameter passed to vzctl set --cpus.
                cpuunits no
                  Parameter passed to vzctl set --cpuunits.
                  ctid yes
                    Container ID or name to manage.
                    dcachesize no
                      UBC parameter passed to vzctl set --dcachesize.
                      description no
                        Parameter passed to vzctl set --description.
                        dgramrcvbuf no
                          UBC parameter passed to vzctl set --dgramrcvbuf.
                          disabled no
                          • yes
                          • no
                          Parameter passed to vzctl set --disabled.
                          diskinodes no
                            Parameter passed to vzctl set --diskinodes.
                            diskspace no
                              Parameter passed to vzctl set --diskspace.
                              features no
                                Parameter passed to vzctl set --features.
                                hostname no
                                  Parameter passed to vzctl set --hostname.
                                  iolimit no
                                    Parameter passed to vzctl set --iolimit.
                                    ioprio no
                                      Parameter passed to vzctl set --ioprio.
                                      iopslimit no
                                        Parameter passed to vzctl set --iopslimit.
                                        ipadd no
                                          Parameter passed to vzctl set --ipadd.
                                          ipaddr no
                                            IP address settings in the idempotent way. Specify addresses in an array or a space delimited string.
                                            ipdel no
                                              Parameter passed to vzctl set --ipdel.
                                              iptables no
                                                Parameter passed to vzctl set --iptables.
                                                kmemsize no
                                                  UBC parameter passed to vzctl set --kmemsize.
                                                  layout no
                                                    Parameter passed to vzctl create --layout.
                                                    lockedpages no
                                                      UBC parameter passed to vzctl set --lockedpages.
                                                      mount_opts no
                                                        Parameter passed to vzctl set --mount_opts.
                                                        name no
                                                          Parameter passed to vzctl set --name.
                                                          nameserver no
                                                            Parameter passed to vzctl set --nameserver.
                                                            netif no
                                                              Network interface settings in the idempotent way. Specify interfaces in an array or a space delimited string.
                                                              netif_add no
                                                                Parameter passed to vzctl set --netif_add.
                                                                netif_del no
                                                                  Parameter passed to vzctl set --netif_del.
                                                                  nodemask no
                                                                    Parameter passed to vzctl set --nodemask.
                                                                    numfile no
                                                                      UBC parameter passed to vzctl set --numfile.
                                                                      numflock no
                                                                        UBC parameter passed to vzctl set --numflock.
                                                                        numiptent no
                                                                          UBC parameter passed to vzctl set --numiptent.
                                                                          numothersock no
                                                                            UBC parameter passed to vzctl set --numothersock.
                                                                            numproc no
                                                                              UBC parameter passed to vzctl set --numproc.
                                                                              numpty no
                                                                                UBC parameter passed to vzctl set --numpty.
                                                                                numsiginfo no
                                                                                  UBC parameter passed to vzctl set --numsiginfo.
                                                                                  numtcpsock no
                                                                                    UBC parameter passed to vzctl set --numtcpsock.
                                                                                    onboot no
                                                                                    • yes
                                                                                    • no
                                                                                    Parameter passed to vzctl set --onboot.
                                                                                    oomguarpages no
                                                                                      UBC parameter passed to vzctl set --oomguarpages.
                                                                                      ostemplate no
                                                                                        Parameter passed to vzctl create --ostemplate.
                                                                                        othersockbuf no
                                                                                          UBC parameter passed to vzctl set --othersockbuf.
                                                                                          physpages no
                                                                                            UBC parameter passed to vzctl set --physpages.
                                                                                            private no
                                                                                              Parameter passed to vzctl create --private.
                                                                                              privvmpages no
                                                                                                UBC parameter passed to vzctl set --privvmpages.
                                                                                                quotatime no
                                                                                                  Parameter passed to vzctl set --quotatime.
                                                                                                  quotaugidlimit no
                                                                                                    Parameter passed to vzctl set --quotaugidlimit.
                                                                                                    ram no
                                                                                                      Parameter passed to vzctl set --ram.
                                                                                                      root no
                                                                                                        Parameter passed to vzctl create --root.
                                                                                                        searchdomain no
                                                                                                          Parameter passed to vzctl set --searchdomain.
                                                                                                          shmpages no
                                                                                                            UBC parameter passed to vzctl set --shmpages.
                                                                                                            state no
                                                                                                            • started
                                                                                                            • stopped
                                                                                                            • present
                                                                                                            • absent
                                                                                                            Container target state.
                                                                                                            swap no
                                                                                                              Parameter passed to vzctl set --swap.
                                                                                                              swappages no
                                                                                                                UBC parameter passed to vzctl set --swappages.
                                                                                                                tcprcvbuf no
                                                                                                                  UBC parameter passed to vzctl set --tcprcvbuf.
                                                                                                                  tcpsndbuf no
                                                                                                                    UBC parameter passed to vzctl set --tcpsndbuf.
                                                                                                                    userpasswd no
                                                                                                                      Parameter passed to vzctl set --userpasswd.
                                                                                                                      vmguarpages no
                                                                                                                        UBC parameter passed to vzctl set --vmguarpages.

                                                                                                                        openvz_exec options

                                                                                                                        If this section doesn't show nicely in Ansible Galaxy Page, please refer to equeivalent in the GitHub page.

                                                                                                                        parameter required default choices comments
                                                                                                                        ctid yes
                                                                                                                          Container ID or name to execute commands.
                                                                                                                          exec yes
                                                                                                                            Shell commands to execute in the container.

                                                                                                                            Requirements

                                                                                                                            None.

                                                                                                                            Role Variables

                                                                                                                            None.

                                                                                                                            Dependencies

                                                                                                                            None.

                                                                                                                            Example Playbook

                                                                                                                            ---
                                                                                                                            - hosts: vzhost
                                                                                                                              sudo: yes
                                                                                                                              roles:
                                                                                                                              - yaegashi.openvzmod
                                                                                                                              tasks:
                                                                                                                              - openvz:
                                                                                                                                  ctid: 1000
                                                                                                                                  state: started
                                                                                                                                  ostemplate: ubuntu-14.04-x86_64-minimal
                                                                                                                                  ram: 1G
                                                                                                                                  swap: 512M
                                                                                                                                  diskspace: 2G
                                                                                                                                  hostname: vzguest
                                                                                                                                  name: vzguest
                                                                                                                                  ipaddr:
                                                                                                                                  - 192.168.0.100
                                                                                                                                  - 192.168.0.101
                                                                                                                                  nameserver: 192.168.0.1
                                                                                                                                  userpasswd: ansible:secret
                                                                                                                                  description: Ubuntu trusty amd64 container
                                                                                                                            ---
                                                                                                                            - hosts: vzhost
                                                                                                                              sudo: yes
                                                                                                                              roles:
                                                                                                                              - yaegashi.openvzmod
                                                                                                                              tasks:
                                                                                                                              - openvz_exec:
                                                                                                                                  ctid: 1000
                                                                                                                                  exec: |
                                                                                                                                    adduser --system --group --uid 999 ansible
                                                                                                                                    adduser ansible sudo
                                                                                                                                    echo ansible:secret | chpasswd

                                                                                                                            TODO

                                                                                                                            Some other ideas for possible OpenVZ container management modules:

                                                                                                                            • openvz_snapshot: Manipulate ploop snapshots
                                                                                                                            • openvz_exec: Add support for executing a local script file
                                                                                                                            • Connection plugin for vzctl exec

                                                                                                                            License

                                                                                                                            GPLv3+

                                                                                                                            Author Information

                                                                                                                            YAEGASHI Takeshi

                                                                                                                            ansible-role-openvzmod's People

                                                                                                                            Contributors

                                                                                                                            yaegashi avatar

                                                                                                                            Stargazers

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

                                                                                                                            Watchers

                                                                                                                             avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

                                                                                                                            ansible-role-openvzmod's Issues

                                                                                                                            NameError: global name 'BOOLEANS' is not defined

                                                                                                                            I'am running ansible 2.5.1 and got such error:

                                                                                                                            The full traceback is:
                                                                                                                            Traceback (most recent call last):
                                                                                                                              File "/tmp/ansible_qmMljH/ansible_module_openvz.py", line 463, in <module>
                                                                                                                                main()  # Run as a module
                                                                                                                              File "/tmp/ansible_qmMljH/ansible_module_openvz.py", line 399, in main
                                                                                                                                onboot=dict(choices=BOOLEANS, type='bool'),
                                                                                                                            NameError: global name 'BOOLEANS' is not defined
                                                                                                                            

                                                                                                                            "msg": "MODULE FAILURE" when any usage of module

                                                                                                                            When running
                                                                                                                            ansible-playbook mta-ds.yml -i production -vvvv
                                                                                                                            Got:

                                                                                                                            TASK [create container] ********************************************************
                                                                                                                            task path: /home/user/ansible-playbooks/mta-ds.yml:58
                                                                                                                            <ds10.acme.org> ESTABLISH SSH CONNECTION FOR USER: root
                                                                                                                            <ds10.acme.org> SSH: EXEC sshpass -d12 ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r ds10.acme.org '/bin/sh -c '"'"'LANG=ru_RU.UTF-8 LC_ALL=ru_RU.UTF-8 LC_MESSAGES=ru_RU.UTF-8 /usr/bin/python && sleep 0'"'"''
                                                                                                                            fatal: [ds10.acme.org]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_name": "openvz"}, "module_stderr": "OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014\r\ndebug1: Reading configuration data /home/user/.ssh/config\r\ndebug1: /home/user/.ssh/config line 4: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 17930\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n", "module_stdout": "", "msg": "MODULE FAILURE"}
                                                                                                                            

                                                                                                                            Formatted module_stderr value:

                                                                                                                            OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
                                                                                                                            debug1: Reading configuration data /home/user/.ssh/config
                                                                                                                            debug1: /home/user/.ssh/config line 4: Applying options for *
                                                                                                                            debug1: Reading configuration data /etc/ssh/ssh_config
                                                                                                                            debug1: /etc/ssh/ssh_config line 19: Applying options for *
                                                                                                                            debug1: auto-mux: Trying existing master
                                                                                                                            debug2: fd 3 setting O_NONBLOCK
                                                                                                                            debug2: mux_client_hello_exchange: master version 4
                                                                                                                            debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
                                                                                                                            debug3: mux_client_request_session: entering
                                                                                                                            debug3: mux_client_request_alive: entering
                                                                                                                            debug3: mux_client_request_alive: done pid = 13601
                                                                                                                            debug3: mux_client_request_session: session request sent
                                                                                                                            debug1: mux_client_request_session: master session id: 2
                                                                                                                            debug3: mux_client_read_packet: read header failed: Broken pipe
                                                                                                                            debug2: Received exit status from master 0
                                                                                                                            

                                                                                                                            Configuration:

                                                                                                                              - name: create container
                                                                                                                                openvz:
                                                                                                                                  ctid: 1000
                                                                                                                                  state: started
                                                                                                                                  ostemplate: centos-6-x86_64-minimal
                                                                                                                                  ram: 8G
                                                                                                                                  swap: 2G
                                                                                                                                  diskspace: 20G
                                                                                                                                  hostname: vs06.acme.org
                                                                                                                                  name: vs06
                                                                                                                                  ipaddr: 10.0.0.1

                                                                                                                            We are write simple workaround for this issue dimarick@19aa518 but our python expirience cannot help to write good fix.

                                                                                                                            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.