Skip to main content

Robotframework library to access all ansible internal modules.

Project description

Introduction

Impansible is a Robot Framework test library for access to all Ansible internal modules. All Ansible modules are available as Robotframework’s keywords. The Impansible library can be used without Robotframework.

Impansible is operating system independent and supports Python 2.7 as well as Python 3.x or newer.

Documentation

See keyword documentation for available keywords and more information about the library in general.

For general information about using test libraries with Robot Framework, see Robot Framework User Guide.

Installation

The recommended installation method is using pip:

pip install --upgrade robotframework-impansible

With recent versions of pip it is possible to install directly from the GitHub repository. To install latest source from the master branch, use this command:

pip install git+https://github.com/AdamPrzybyla/Impansible.git

Alternatively you can download the source distribution from PyPI, extract it, and install it using one of the following depending are you using Python or Jython:

python setup.py install

Usage

The library can be used localy if teh first parametr is set to “local” or remotly if the first parameter is set to hostname. You need to export ssh keys or provide the propper credentials. if you have root access you need to set the ansible_password variable but for sudo access you neeed to set ansible_become_password and ansible_user variables.

The keywors documenatation can be found on this site: keyword Documentation

*** variables ***
${PAC}   mtr
#${ansible_password}  xxxxxxx
${ansible_become_password}  xxxxxxxxx
${ansible_user}  user_user

*** settings ***
library  Impansible
library  Collections
library  OperatingSystem

*** test cases ***
test 1
        ${x}=   Setup  localhost
                log  ${x}
        ${y}=   get from dictionary  ${x}   ansible_facts
        ${h}=   get from dictionary  ${y}   ansible_hostname
        ${z}=   get from dictionary  ${y}   ansible_distribution
                Should be Equal  ${z}  Ubuntu
                Should Contain   ${h}  tester
test 2
        [Timeout]    600
        ${x}=   apt    localhost   package=${PAC}   state=present
        ${x}=   get from dictionary  ${x}   invocation
        ${y}=   get from dictionary  ${x}   module_args
        ${s}=   get from dictionary  ${y}   state
                Should be Equal  ${s}  present
        ${w}=   Run     which ${PAC}
                Should Contain  ${w}  ${PAC}

test 3
        [Timeout]    600
        ${x}=   apt   localhost   package=${PAC}   state=absent
        ${x}=   get from dictionary  ${x}   invocation
        ${y}=   get from dictionary  ${x}   module_args
        ${s}=   get from dictionary  ${y}   state
                Should be Equal  ${s}  absent
        ${w}=   Run     which ${PAC}
                Should not Contain  ${w}  ${PAC}

test 4
        ${x}=   apt    localhost   package=python-openssl   state=present
        ${c}=   get certificate   localhost  host=www.onet.pl   port=443  proxy_host=1.1.2.2
        ${e}=   get from dictionary  ${c}   expired
                Should not be True   ${e}

test 5
        ${x}=  nitz2
                log  ${x}

test 6
        ${w}=   command   localhost   uname -a
        ${w}=   get from dictionary  ${w}   stdout
                Should Contain  ${w}  GNU/Linux

test 7
        ${x}=   python requirements info  localhost
        ${x}=   get from dictionary  ${x}   ansible_facts
        ${x}=   get from dictionary  ${x}   discovered_interpreter_python
                Should Contain  ${x}  python

Support

If the provided documentation is not enough, there are various support forums available:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework-impansible-0.11.tar.gz (264.1 kB view details)

Uploaded Source

File details

Details for the file robotframework-impansible-0.11.tar.gz.

File metadata

  • Download URL: robotframework-impansible-0.11.tar.gz
  • Upload date:
  • Size: 264.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.7.4 pkginfo/1.3.2 requests/2.14.2 setuptools/22.0.5 requests-toolbelt/0.8.0 clint/0.5.1 CPython/2.7.5 Linux/3.10.0-1127.18.2.el7.x86_64

File hashes

Hashes for robotframework-impansible-0.11.tar.gz
Algorithm Hash digest
SHA256 b26f4e42c67d3a9e2117e88783f5bce43383a474eb733b597f87e13f7c19dc94
MD5 a7a57c27df1db0817e400b15c0fdda76
BLAKE2b-256 40a09c292eaf80ecb9afe8bac77a162a695f8d2d0974d4c26043db4366b71110

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page