Giter Site home page Giter Site logo

kitchen-ansible's Introduction

kitchen-ansible

Gem Version Gem Downloads Build Status

A Test Kitchen Provisioner for Ansible.

The provisioner works by passing the Ansible repository based on attributes in .kitchen.yml & calling ansible-playbook.

It installs Ansible on the server and runs ansible-playbook using host localhost.

It has been tested against the Ubuntu 12.04/14.04/16.04, Centos 6/7 and Debian 6/7/8 boxes running in vagrant/virtualbox.

Requirements

  • Test Kitchen.
  • a driver box without a Chef installation so Ansible can be installed.

Installation & Setup

  1. install the latest Ruby on your workstation (for windows see https://rubyinstaller.org/downloads/)

  2. If using Ruby version less than 2.3 first install earlier version of test-kitchen

gem install test-kitchen -v 1.16.0
  1. Install the kitchen-ansible gem in your system, along with kitchen-vagrant or kitchen-docker or any other suitable driver or the exec driver to run from your workstation:
gem install kitchen-ansible
gem install kitchen-vagrant

Resources

Example .kitchen.yml file

Based on the Tomcat Standalone example:

---
driver:
  name: vagrant

provisioner:
  name: ansible_playbook
  roles_path: roles
  hosts: tomcat-servers
  require_ansible_repo: true
  ansible_verbose: true
  ansible_version: latest
  require_chef_for_busser: false
  additional_ssh_private_keys:
  - /mykey/id_rsa

platforms:
  - name: nocm_centos-6.5
    driver_plugin: vagrant
    driver_config:
      box: nocm_centos-6.5
      box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
      network:
      - ['forwarded_port', {guest: 8080, host: 8080}]
      - ['private_network', {ip: '192.168.33.11'}]

See example https://github.com/neillturner/ansible_repo

Windows Support

Windows is supported by creating a linux server to run Ansible with software required to support winrm. Then the winrm connection is used to configure the windows server.

In .kitchen.yml set:

  ansible_connection: winrm
  require_windows_support: true
  require_chef_for_busser: false

See the Ansible Windows repo example.

Test Kitchen Exec Driver

By using the test-kitchen exec driver ansible can be driven from your workstation. This provides similar functionality to kitchen-ansiblepush. Remote servers, as specified in the ansible inventory, can be built with ansible automatically installed and run from your workstation.

See example https://github.com/neillturner/ansible_exec_repo

Ansible AWX

Kitchen ansible supports installing and using the open source version of Ansible Tower Ansible AWX on a Centos 7. In future it will support the tower-cli for testing.

See example https://github.com/neillturner/ansible_awx_repo

Using Roles from Ansible Galaxy

Roles can be used from the Ansible Galaxy using two methods:

  1. Specify a requirements.yml file in your Ansible repository. For more details see here.

  2. Use librarian-ansible by creating an Ansiblefile in the top level of the repository and kitchen-ansible will automatically call librarian-ansible during convergence. For a description of setting up an Ansiblefile see here.

Tips

To use a single ~/.kitchen/config.yml file with multiple reposities by setting the WORKSPACE environment variable:

role_path: <%= ENV['WORKSPACE'] %>/roles

You can easily skip previous instructions and jump directly to the broken statement you just fixed by passing an environment variable. Add the following to your .kitchen.yml:

provisioner:
  name: ansible_playbook
  ansible_extra_flags: <%= ENV['ANSIBLE_EXTRA_FLAGS'] %>

Then run:

$ ANSIBLE_EXTRA_FLAGS='--start-at-task="myrole | name of last working instruction"' kitchen converge

You save a lot of time not running working instructions.

Ruby install to run Serverspec verify

By default test-kitchen installs Chef to get a Ruby version suitable to run Serverspec in the verify step. kitchen-verifier-serverspec installs its own ruby version so chef or ruby is not required to verify with serverspec :

require_chef_for_busser: false

And set the verifier section:

verifier:
  name: serverspec
  sudo_path: true

suites:
  - name: ansible
    driver_config:
      hostname: '54.229.34.169'
    verifier:
      patterns:
      - roles/tomcat/spec/tomcat_spec.rb
      bundler_path: '/usr/local/bin'
      rspec_path: '/usr/local/bin'
      env_vars:
        TARGET_HOST: 54.229.104.40
        LOGIN_USER: centos
        SUDO: true
        SSH_KEY: spec/test.pem

Please see the Provisioner Options for a complete listing.

Test-Kitchen Ansiblespec

By using kitchen-verifier-serverspec and the Runner ansiblespec_runner tests can be run against multiple servers with multiple roles in the ansiblespec format.

Serverspec uses ssh to communicate with the server to be tested and reads the Ansible playbook and inventory files to determine the hosts to test and the roles for each host.

See example https://github.com/neillturner/ansible_ansiblespec_repo

Example usage to create Tomcat servers:

test-kitchen, Ansible and ansiblespec

See ansible-sample-tdd.

Usage

Directory

In the Ansible repository specify:

  • spec files with the roles.
  • spec_helper in the spec folder (with code as below).
.
+-- roles
¦   +-- mariadb
¦   ¦   +-- spec
¦   ¦   ¦   +-- mariadb_spec.rb
¦   ¦   +-- tasks
¦   ¦   ¦   +-- main.yml
¦   ¦   +-- templates
¦   ¦       +-- mariadb.repo
¦   +-- nginx
¦       +-- handlers
¦       ¦   +-- main.yml
¦       +-- spec
¦       ¦   +-- nginx_spec.rb
¦       +-- tasks
¦       ¦   +-- main.yml
¦       +-- templates
¦       ¦   +-- nginx.repo
¦       +-- vars
¦           +-- main.yml
+-- spec
    +-- spec_helper.rb
    +-- my_private_key.pem

spec_helper

require 'rubygems'
require 'bundler/setup'

require 'serverspec'
require 'pathname'
require 'net/ssh'

RSpec.configure do |config|
  set :host,  ENV['TARGET_HOST']
  # ssh options at http://net-ssh.github.io/ssh/v1/chapter-2.html
  # ssh via password
  set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :password => ENV['LOGIN_PASSWORD'] if ENV['LOGIN_PASSWORD']
  # ssh via ssh key
  set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :host_key => 'ssh-rsa', :keys => [ ENV['SSH_KEY'] ] if ENV['SSH_KEY']
  set :backend, :ssh
  set :request_pty, true
end

See kitchen-verifier-serverspec.

Alternative Virtualization/Cloud providers for Vagrant

This could be adapted to use alternative virtualization/cloud providers such as Openstack/AWS/VMware Fusion according to whatever is supported by Vagrant.

platforms:
  - name: ubuntu-12.04
    driver_config:
      provider: aws
      box: my_base_box
      # username is based on what is configured in your box/ami
      username: ubuntu
      customize:
        access_key_id: 'AKKJHG659868LHGLH'
        secret_access_key: 'G8t7o+6HLG876JGF/58'
        ami: ami-7865ab765d
        instance_type: t2.micro
        # more customisation can go here, based on what the vagrant provider supports
        #security-groups: []

Notes

  • The default in all of the above is the name of the test suite defined in the suites section of your .kitchen.yml, so if you have more than one suite of tests or change the name, you'll need to adapt the example accordingly.
  • Serverspec test files must be named _spec.rb
  • Since I'm using Vagrant, my box definitions refer to Vagrant boxes, either standard, published boxes available from Atlas or custom-created boxes (perhaps using Packer and bento, in which case you'll need to provide the URL in box_url.

kitchen-ansible's People

Contributors

ahrenstein avatar alexharv074 avatar awiddersheim avatar bborysenko avatar benjamink avatar benlogn avatar dhutty avatar ernoaapa avatar gregsymons avatar ironcore864 avatar jamesla avatar jolexa avatar karouf avatar ktosiek avatar matrixcrawler avatar mheap avatar mhuxtable avatar msabramo avatar neillturner avatar olhado avatar rusnyder avatar soupdiver avatar strangeman avatar svend avatar trinitronx avatar trombik avatar trumant avatar vkill avatar walterdolce avatar yewton avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kitchen-ansible's Issues

Conditional include is failing

Setting a boolean in defaults to False,
A task then conditionally includes another task when the var is True.
kitchen test always tries to include the second task.

in defaults/main.yml
rabbitmq_cluster: false

in tasks/main.yml

  • include: cluster.yml
    when: rabbitmq_cluster

Debug output
ok: [localhost] => {
"rabbitmq_cluster": "False"
}

   TASK: [cisco.rabbitmq | add controllers to /etc/hosts] ************************ 
   fatal: [localhost] => with_items expects a list or a set

This failed task is the first line in the cluster.yml that should not have been included

Ruby already installed on Centos-boxes - symlinking fails

When another version of ruby is already installed on a centos or RHEL box, the symlinking here will fail.

Then the existing ruby-installation should be removed before symlinking, like this:

echo "-----> Delete already existing ruby-version so they do not intefere with ruby193"
sudo('yum')} remove -y ruby rubygems     

Problem then is that facter also gets removed.

require_chef_for_busser overrides require_chef_omnibus

The provisioner doesn't seem to check for the presence of require_chef_omnibus option in the config

Thus setting require_chef_omnibus: false still prompts the provisioner to install the chef omnibus.

Setting require_chef_for_busser: false will disable the installation of the chef omnibus. This should be documented in the README

Add support for Debian

Please add support for Debian 6-8.
You could either use backports or install Ansible directly via pip.

EDIT: You could use pip on all platforms and do not rely on package-availability of the os-maintainer. You'd only have to install pip on the target platform.

Please add OS X support

Using the vmware_fusion provider and OS X vagrant boxes, Ansible does not work.

Transferring files to <default-mavericks>
       Going to invoke ansible-playbook with: sudo -E PATH=/tmp/kitchen/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games PYTHONPATH=/tmp/kitchen/ansible/lib MANPATH=/tmp/kitchen/ansible/docs/man /tmp/kitchen/ansible/bin/ansible-playbook --inventory-file=/tmp/kitchen/inventory -c local -M /tmp/kitchen/modules -vvv       /tmp/kitchen/site.yml
       sudo: /tmp/kitchen/ansible/bin/ansible-playbook: command not found
>>>>>> Converge failed on instance <default-mavericks>.
>>>>>> Please see .kitchen/logs/default-mavericks.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E PATH=/tmp/kitchen/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games PYTHONPATH=/tmp/kitchen/ansible/lib MANPATH=/tmp/kitchen/ansible/docs/man /tmp/kitchen/ansible/bin/ansible-playbook --inventory-file=/tmp/kitchen/inventory -c local -M /tmp/kitchen/modules -vvv       /tmp/kitchen/site.yml]

It seems ansible is not copied over to the system

How to specify a test?

I'm migrating from chef -> ansible and I've whipped up a quick test repo to try this project out.

However, running bundle exec kitchen verify does not appear to pick up any server spec test suites that I write.

I cannot recall having to configure this for chef projects, do I need to do something different to run these with this provisioner?

Ansible fails to install from apt repo if ansible.cfg is present

If you have ansible.cfg ansible installation from apt is failed due to the prompt:

Configuration file '/etc/ansible/ansible.cfg'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.

Converge fails when http_proxy and/or https_proxy is/are specified to the vagrant driver

When http_proxy and/or https_proxy is/are specified in the driver stanza of the .kitchen.yml, I get the following error:

<snip>
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [env http_proxy=http://myproxy.domain.com:8080 https_proxy=http://myproxy.domain.com:8080           if [ ! $(which ansible) ]; then
            if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
               sudo -E rpm -ivh https://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
</snip>

The proxies are valid (I've scrubbed the names for the purposes of this bug report), and work regularly with other kitchen providers (like chef for example).

Full run output:

-----> Starting Kitchen (v1.2.1)
-----> Creating <webtier-nocm-ubuntu-1204>...
       Bringing machine 'default' up with 'virtualbox' provider...
       ==> default: Importing base box 'nocm_ubuntu-12.04'...
       ==> default: Matching MAC address for NAT networking...
       ==> default: Setting the name of the VM: webtier-nocm-ubuntu-1204_default_1411500225542_35968
       ==> default: Clearing any previously set forwarded ports...
       ==> default: Clearing any previously set network interfaces...
       ==> default: Preparing network interfaces based on configuration...
           default: Adapter 1: nat
       ==> default: Forwarding ports...
           default: 22 => 2222 (adapter 1)
       ==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...           default: SSH address: 127.0.0.1:2222
           default: SSH username: vagrant
           default: SSH auth method: private key
           default: Warning: Connection timeout. Retrying...
       ==> default: Machine booted and ready!
       ==> default: Checking for guest additions in VM...
           default: The guest additions on this VM do not match the installed version of
           default: VirtualBox! In most cases this is fine, but in rare cases it can
           default: prevent things such as shared folders from working properly. If you see
           default: shared folder errors, please make sure the guest additions within the
           default: virtual machine match the version of VirtualBox you have installed on
           default: your host and reload your VM.
           default:
           default: Guest Additions Version: 4.2.10
           default: VirtualBox Version: 4.3
       ==> default: Setting hostname...
       ==> default: Machine not provisioning because `--no-provision` is specified.
       Vagrant instance <webtier-nocm-ubuntu-1204> created.
       Finished creating <webtier-nocm-ubuntu-1204> (0m30.50s).
-----> Converging <webtier-nocm-ubuntu-1204>...
       Preparing files for transfer
       Preparing playbook
       Preparing modules
       nothing to do for modules
       Preparing roles
       Preparing ansible.cfg file
       Preparing group_vars
       nothing to do for group_vars
       Preparing host_vars
       nothing to do for host_vars
       Preparing hosts file
       Finished Preparing files for transfer
       Installing ansible, will try to determine platform os
       bash: -c: line 0: syntax error near unexpected token `then'
       bash: -c: line 0: `env http_proxy=http://myproxy.domain.com:8080 https_proxy=http://myproxy.domain.com:8080           if [ ! $(which ansible) ]; then'
>>>>>> Converge failed on instance <webtier-nocm-ubuntu-1204>.
>>>>>> Please see .kitchen/logs/webtier-nocm-ubuntu-1204.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [env http_proxy=http://myproxy.domain.com:8080 https_proxy=http://myproxy.domain.com:8080           if [ ! $(which ansible) ]; then
            if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
               sudo -E rpm -ivh https://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
               sudo -E yum makecache
               sudo -E yum -y install ansible
            else
           #   sudo -E wget ppa:rquillo/ansible
           #   sudo -E dpkg -i ansible
           #   sudo -E apt-get update
           #   sudo -E apt-get -y install ansible
               sudo -E add-apt-repository ppa:rquillo/ansible
           sudo -E apt-get update
               sudo -E apt-get -y install ansible
            fi
          fi
                            # Check whether a command exists - returns 0 if it does, 1 if it does not
        exists() {
          if command -v $1 >/dev/null 2>&1
          then
            return 0
          else
            return 1
          fi
        }

        # do_wget URL FILENAME
        do_wget() {
          echo "trying wget..."
          wget -O "$2" "$1" 2>/tmp/stderr
          # check for bad return status
          test $? -ne 0 && return 1
          # check for 404 or empty file
          grep "ERROR 404" /tmp/stderr 2>&1 >/dev/null
          if test $? -eq 0 || test ! -s "$2"; then
            return 1
          fi
          return 0
        }

        # do_curl URL FILENAME
        do_curl() {
          echo "trying curl..."
          curl -L "$1" > "$2"
          # check for bad return status
          [ $? -ne 0 ] && return 1
          # check for bad output or empty file
          grep "The specified key does not exist." "$2" 2>&1 >/dev/null
          if test $? -eq 0 || test ! -s "$2"; then
            return 1
          fi
          return 0
        }

        # do_fetch URL FILENAME
        do_fetch() {
          echo "trying fetch..."
          fetch -o "$2" "$1" 2>/tmp/stderr
          # check for bad return status
          test $? -ne 0 && return 1
          return 0
        }

        # do_perl URL FILENAME
        do_perl() {
          echo "trying perl..."
          perl -e "use LWP::Simple; getprint($ARGV[0]);" "$1" > "$2"
          # check for bad return status
          test $? -ne 0 && return 1
          # check for bad output or empty file
          # grep "The specified key does not exist." "$2" 2>&1 >/dev/null
          # if test $? -eq 0 || test ! -s "$2"; then
          #   unable_to_retrieve_package
          # fi
          return 0
        }

        # do_python URL FILENAME
        do_python() {
          echo "trying python..."
          python -c "import sys,urllib2 ; sys.stdout.write(urllib2.urlopen(sys.argv[1]).read())" "$1" > "$2"
          # check for bad return status
          test $? -ne 0 && return 1
          # check for bad output or empty file
          #grep "The specified key does not exist." "$2" 2>&1 >/dev/null
          #if test $? -eq 0 || test ! -s "$2"; then
          #  unable_to_retrieve_package
          #fi
          return 0
        }

        # do_download URL FILENAME
        do_download() {
          PATH=/opt/local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
          export PATH

          echo "downloading $1"
          echo "  to file $2"

          # we try all of these until we get success.
          # perl, in particular may be present but LWP::Simple may not be installed

          if exists wget; then
            do_wget $1 $2 && return 0
          fi

          if exists curl; then
            do_curl $1 $2 && return 0
          fi

          if exists fetch; then
            do_fetch $1 $2 && return 0
          fi

          if exists perl; then
            do_perl $1 $2 && return 0
          fi

          if exists python; then
            do_python $1 $2 && return 0
          fi

          echo ">>>>>> wget, curl, fetch, perl or python not found on this instance."
          return 16
        }

          # install chef omnibus so that busser works as this is needed to run tests :(
          # TODO: work out how to install enough ruby
          # and set busser: { :ruby_bindir => '/usr/bin/ruby' } so that we dont need the
          # whole chef client
          if [ ! -d "/opt/chef" ]
          then
            echo "-----> Installing Chef Omnibus to install busser to run tests"
            do_download https://www.getchef.com/chef/install.sh /tmp/install.sh
            sudo -E sh /tmp/install.sh
          fi

]
>>>>>> ----------------------

.kitchen.yml contents:

---
driver:
  name: vagrant
  http_proxy: http://myproxy.domain.com:8080 
  https_proxy: http://myproxy.domain.com:8080 

provisioner:
  name: ansible_playbook
  require_ansible_repo: true
  ansible_verbose: true
  roles_path: roles
  group_vars_path: group_vars
  host_vars_path: host_vars
  hosts: all

platforms:
- name: nocm_ubuntu-12.04
  driver_plugin: vagrant
  driver_config:
    box: nocm_ubuntu-12.04
    box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box

suites:
  - name: webtier
    provisioner:
      hosts: webtier

Can't run rspec tests

Hi,

I've been trying to get the tests working so that I can add a couple of features (vault support, arbitary files rather than a directory) but I've been unable to fix:

  1) Kitchen::Provisioner::AnsiblePlaybook#run_command should give a sane run_command
     Failure/Error: expect(provisioner.run_command).to match(/ansible-playbook/)
     NoMethodError:
       undefined method `suite' for nil:NilClass

I've tried a dozen things to make this work, from trying to mock out an instance that takes in the provisioner we create in the test to copying whole chunks up how test-kitchen tests the base provider, but I've been unable to get it to work properly.

Can you see if tests still work for you? I suspect it's because without a Gemfile I pulled in rspec 3.2 and that's just broken with the current tests.

Running tests from multiple roles on one server?

I'm trying to run test-kitchen + serverspec provisioning with ansible on EC2. I have the basics running ok but not the way I want it.

What I want is to have tests within each role (fine if subfolder are called test/integration), but I want to be able to run all the tests for that role if I use that role in my playbook.

So far, I haven't figured out how to do this and it's beginning to look like the current implementation only lets you run tests from a single folder for each suite you define?

From the test-kitchen documentation, if you're using chef, it looks like you can run tests from multiple cookbooks by defining the run_lists for each suite:

suites:
  - name: suite_name
    run_list:
      - recipe[cookbook_name::default]
      - recipe[another_cookbook_name::recipe_name]

Is there some specific folder structure that I need to do this, or alternatively is there some way I can explicitly specify which tests to run within each suite?

UBUNTU: doesn't support 14.10

It doesn't install ansible

: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/utopic-security/universe/binary-amd64/Packages  Hash Sum mismatch       

E:        Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree       
Reading state information... 1%
Reading state information... Done
       E: Unable to locate package ansible

.kitchen.yml

---
driver:
  name: docker
  use_sudo: false
  ssh:
    pty: true
driver_config:
  hostname: kitchen
  socket: <%= ENV['DOCKER_HOST'] %>
provisioner:
  name: ansible_playbook
  roles_path: ../../
  hosts: localhost
  playbook: site.kitchen.yml
  require_ansible_repo: true
platforms:
  - name: ubuntu-14.10
suites:
- name: chef-client-sh
  extra_vars:
    type: sh

I've already forked your repo, I'll give a go if I can fix that issue.

Breakage with custom log path in ansible.cfg

If I have an ansible.cfg which sets the log path like so:

log_path            = ./logs/ansible.log

Then kitchen converge fails with the following error:

       Transferring files to <default-ubuntu-1404>
       Going to invoke ansible-playbook with: ANSIBLE_ROLES_PATH=/tmp/kitchen/roles sudo -E ansible-playbook --inventory-file=/tmp/kitchen/hosts -c local -M /tmp/kitchen/modules -vvv   --vault-password-file=/tmp/kitchen/vaultpw    /tmp/kitchen/default.yml
       Traceback (most recent call last):
         File "/usr/bin/ansible-playbook", line 44, in <module>
           import ansible.playbook
         File "/usr/lib/pymodules/python2.7/ansible/playbook/__init__.py", line 18, in <module>
           import ansible.inventory
         File "/usr/lib/pymodules/python2.7/ansible/inventory/__init__.py", line 26, in <module>
           from ansible.inventory.ini import InventoryParser
         File "/usr/lib/pymodules/python2.7/ansible/inventory/ini.py", line 21, in <module>
           from ansible.inventory.host import Host
         File "/usr/lib/pymodules/python2.7/ansible/inventory/host.py", line 19, in <module>
           from ansible import utils
         File "/usr/lib/pymodules/python2.7/ansible/utils/__init__.py", line 29, in <module>
           from ansible.utils.display_functions import *
         File "/usr/lib/pymodules/python2.7/ansible/utils/display_functions.py", line 22, in <module>
           from ansible.callbacks import display
         File "/usr/lib/pymodules/python2.7/ansible/callbacks.py", line 42, in <module>
           logging.basicConfig(filename=path, level=logging.DEBUG, format='%(asctime)s %(name)s %(message)s')
         File "/usr/lib/python2.7/logging/__init__.py", line 1532, in basicConfig
           hdlr = FileHandler(filename, mode)

       StreamHandler.__init__(self, self._open())
         File "/usr/lib/python2.7/logging/__init__.py", line 928, in _open
       stream = open(self.baseFilename, self.mode)
       : [Errno 2] No such file or directory: '/home/kitchen/logs/ansible.log'

Not sure why it is looking for the log file in /home/kitchen/logs/ansible.log instead of /tmp/kitchen/logs/ansible.log (the logs directory is part of our ansible repo)

If I remove the log_path line from ansible.cfg, things work as expected.

sudo: ansible-playbook: command not found

Periodically test-kitchen failed since it can't find ansible-playbook. Below is a copy of the debug messages.

   Going to invoke ansible-playbook with: sudo -E ansible-playbook --inventory-file=/tmp/kitchen/hosts -c local -M /tmp/kitchen/modules        /tmp/kitchen/default.yml

D [SSH] [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>true, :compression_level=>6, :keepalive=>true, :keepalive_interval=>60, :timeout=>20, :keys_only=>true, :keys=>["/opt/jenkins/jobs/01.01-ansible-tests/workspace/jenkins/test-kitchen.pem"], :auth_methods=>["publickey"], :user=>"ec2-user"}> (sudo -E ansible-playbook --inventory-file=/tmp/kitchen/hosts -c local -M /tmp/kitchen/modules /tmp/kitchen/default.yml)
sudo: ansible-playbook: command not found
D Cleaning up local sandbox in /tmp/default-amazon-sandbox-20151204-25180-1eiztv
Converge failed on instance .
Please see .kitchen/logs/default-amazon.log for more details
------Exception-------
Class: Kitchen::ActionFailed

Message: SSH exited (1) for command: [sudo -E ansible-playbook --inventory-file=/tmp/kitchen/hosts -c local -M /tmp/kitchen/modules /tmp/kitchen/default.yml]

D Converge failed on instance .
D ------Exception-------
D Class: Kitchen::InstanceFailure
D Message: Converge failed on instance . Please see .kitchen/logs/default-amazon.log for more details
D ---Nested Exception---
D Class: Kitchen::ActionFailed
D Message: SSH exited (1) for command: [sudo -E ansible-playbook --inventory-file=/tmp/kitchen/hosts -c local -M /tmp/kitchen/modules /tmp/kitchen/default.yml]
D ------Backtrace-------
D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/provisioner/base.rb:74:in rescue in call' D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/provisioner/base.rb:77:incall'
D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:366:in block in converge_action' D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:488:incall'
D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:488:in synchronize_or_call' D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:453:inblock in action'
D /home/jenkins/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/benchmark.rb:288:in measure' D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:452:inaction'
D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:362:in converge_action' D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:341:inblock in transition_to'
D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:340:in each' D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:340:intransition_to'
D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:160:in verify' D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:189:inblock in test'
D /home/jenkins/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/benchmark.rb:288:in measure' D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:185:intest'
D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/command.rb:176:in public_send' D /opt/jenkins/home/.rvm/gems/ruby-2.2.1/gems/test-kitchen-1.4.2/lib/kitchen/command.rb:176:inblock (2 levels) in run_action'
D ----------------------
zlib(finalizer): the stream was freed prematurely.

Ansible was installed via pip using cloud-init.

ec2-user@ip-172-21-79-27 ~]$ which ansible-playbook
/usr/bin/ansible-playbook

Looking at /var/log/secure, it looks like the sudo command wasn't run.

Dec 4 20:43:24 ip-172-21-79-27 sudo: ec2-user : TTY=pts/0 ; PWD=/home/ec2-user ; USER=root ; COMMAND=/bin/cp /tmp/kitchen/ansible.cfg /etc/ansible
Dec 4 20:43:24 ip-172-21-79-27 sudo: ec2-user : TTY=pts/0 ; PWD=/home/ec2-user ; USER=root ; COMMAND=/bin/cp -r /tmp/kitchen/group_vars /etc/ansible/.
Dec 4 20:43:24 ip-172-21-79-27 sudo: ec2-user : TTY=pts/0 ; PWD=/home/ec2-user ; USER=root ; COMMAND=/bin/cp -r /tmp/kitchen/host_vars /etc/ansible/.
Dec 4 20:43:24 ip-172-21-79-27 sshd[2413]: pam_unix(sshd:session): session closed for user ec2-user

Do you have any suggestions for how I can isolated what's happening?

Coding Standards

Would you be open to receiving a pull request that updates kitchen-ansible to use rubocop to enforce coding standards?

Master broken

With bug:

undefined local variable or method require_ruby_for_busser' for #<Kitchen::Provisioner::AnsiblePlaybook`

Presumably a result of the configuration refactor happening out of band with the ruby install work. Interestingly rspec tests pass.

Regression in kitchen-ansible 0.0.17: "/opt/chef/embedded/bin/gem: not found"

This is a regression from kitchen-ansible 0.0.16 -> 0.0.17. I can fix by downgrading to 0.0.16 and re-break by upgrading to 0.0.17.

The issue is that Chef-Omnibus & busser are not getting installed, resulting in the following error:

-----> Verifying <default-ubuntu-1204>...
       Preparing files for transfer
D      Creating local sandbox in /var/folders/n7/f_wgynqj7v32_krjxgy_65yw0000gn/T/default-ubuntu-1204-sandbox-20150619-37167-m2mxdh
D      [SSH] reusing existing connection [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>"2222", :compression=>"zlib", :compression_level=>6, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/Users/dtehranian/Documents/code/devops-gate/ansible/roles/dlpx.git-client/.kitchen/kitchen-vagrant/kitchen-dlpx.git-client-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key"], :auth_methods=>["publickey"], :user=>"vagrant"}>
D      [SSH] [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>"2222", :compression=>"zlib", :compression_level=>6, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/Users/dtehranian/Documents/code/devops-gate/ansible/roles/dlpx.git-client/.kitchen/kitchen-vagrant/kitchen-dlpx.git-client-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key"], :auth_methods=>["publickey"], :user=>"vagrant"}> (sh -c '

BUSSER_ROOT="/tmp/verifier"; export BUSSER_ROOT
GEM_HOME="/tmp/verifier/gems"; export GEM_HOME
GEM_PATH="/tmp/verifier/gems"; export GEM_PATH
GEM_CACHE="/tmp/verifier/gems/cache"; export GEM_CACHE
ruby="/opt/chef/embedded/bin/ruby"
gem="/opt/chef/embedded/bin/gem"
version="busser"
gem_install_args="busser --no-rdoc --no-ri"
busser="sudo -E /tmp/verifier/bin/busser"
plugins="busser-serverspec"

$gem list busser -i 2>&1 >/dev/null
if test $? -ne 0; then
  echo "-----> Installing Busser ($version)"
  $gem install $gem_install_args
else
  echo "-----> Busser installation detected ($version)"
fi

if test ! -f "$BUSSER_ROOT/bin/busser"; then
  gem_bindir=`$ruby -rrubygems -e "puts Gem.bindir"`
  $gem_bindir/busser setup
fi

echo "       Installing Busser plugins: $plugins"
$busser plugin install $plugins
')
       sh: 14: /opt/chef/embedded/bin/gem: not found
-----> Installing Busser (busser)
       sh: 17: /opt/chef/embedded/bin/gem: not found
       sh: 1: /opt/chef/embedded/bin/ruby: not found
       sh: 24: /busser: not found
       Installing Busser plugins: busser-serverspec
       sudo: /tmp/verifier/bin/busser: command not found

This seems to be because the shell script that ansible-kitchen runs has changed. I don't see the DEB package which populates /opt/chef being downloaded & installed anymore:

  echo ">>>>>> wget, curl, fetch, perl or python not found on this instance."
  return 16
}

          # Fix for https://github.com/test-kitchen/busser/issues/12
          if [ -h /usr/bin/ruby ]; then
              L=$(readlink -f /usr/bin/ruby)
              sudo -E rm /usr/bin/ruby
              sudo -E ln -s $L /usr/bin/ruby
          fi
            if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
            rhelversion=$(cat /etc/redhat-release | grep 'release 6')
            # For CentOS6/RHEL6 install ruby from SCL
            if [ -n "$rhelversion" ]; then
            if [ ! -d "/opt/rh/ruby193" ]; then
              echo "-----> Installing ruby SCL in CentOS6/RHEL6 to install busser to run tests"
              sudo -E yum install -y centos-release-SCL
              sudo -E yum install -y ruby193
              sudo -E yum install -y ruby193-ruby-devel
              echo "-----> Enabling ruby193"
              source /opt/rh/ruby193/enable
              echo "/opt/rh/ruby193/root/usr/lib64" | sudo tee -a /etc/ld.so.conf
              sudo ldconfig
              sudo ln -s /opt/rh/ruby193/root/usr/bin/ruby /usr/bin/ruby
              sudo ln -s /opt/rh/ruby193/root/usr/bin/gem /usr/bin/gem
            fi
            else
              if [ ! $(which ruby) ]; then
                sudo -E yum makecache
                sudo -E yum -y install ruby ruby-devel
              fi
            fi
            else
              if [ ! $(which ruby) ]; then
                sudo -E apt-get update
                sudo -E apt-get -y install ruby1.9.1 ruby1.9.1-dev
              fi
           fi

)

/cc @rbnrye

Ansible vault

Hi,

Is there a way to set ansible vault password file ?

Thank you

Support custom ansible.cfg

I think there should be a way to load a custom ansible.cfg.
I'm using a custom ansible_managed string and I enable the "do" jinja2 extension, both of which affect tests. It would be great if kitchen-ansible could load defaults from a specific file before adding it's own configuration.

SSH key to pull private repo on git

Hello,

My requirement files is using a private repository. The problem is I don't have the private key on my test instance, and the repository is not trusted (need to add the line in known hosts).

Any idea how could it be done ?
Not sure it's related to kitchen-ansible, but it's (I think) a good feature to have.

Thanks

Add argument for custom inventory file

I want to specify a custom hosts (inventory) file using the .kitchen.yml.
is that possible?

it is the same as specifiying ansible-playbook -i custom_hosts
instead of it taking the default hosts file

ansiable can't be installed on Vagrant host in README

epel/primary_db | 6.5 MB 00:08
Setting up Install Process
No package ansible-1.6.2-1.el6 available.
Package libselinux-python-2.0.94-5.8.el6.x86_64 already installed and latest version
Nothing to do
Transfering files to
sudo: ansible-playbook: command not found

How to test multiple playbooks

I'm new to the world of test-kitchen and so maybe my question goes in a wrong direction.
I've got a repository which includes all the different playbooks describing my infrastructure.
I've created a .kitchen.yml file which looks like

---
driver:
  name: vagrant

provisioner:
  name: ansible_playbook
  playbook: docker_registry.yml
  ansible_verbose: false
  hosts: docker_registry
  ansible_verbosity: 4

platforms:
  - name: ubuntu-12.04
    driver_config:
      box: ubuntu/precise64
  - name: ubuntu-14.04
    driver_config:
       box: ubuntu/trusty64

suites:
  - name: docker-registry

I also created some Serverspec tests at test/integration/docker_registry/docker_spec.rb. I can run my test suite as expected.
I've got another playbook called nginx. How would I add another suite and play the nginx playbook instead docker_registry?

Ansible doesn't install on Centos 7 platform

Tried using kitchen-ansible with Centos 7 platform with both Vagrant and Docker drivers. Ansible fails to install on Centos 7:

      Error: Package: ansible-1.9.4-1.el6.noarch (epel)
           Requires: python-simplejson
       Error: Package: python-crypto2.6-2.6.1-2.el6.x86_64 (epel)
           Requires: libpython2.6.so.1.0()(64bit)
       Error: Package: python-httplib2-0.7.7-1.el6.noarch (epel)
           Requires: python(abi) = 2.6
           Installed: python-2.7.5-18.el7_1.1.x86_64 (@Updates)
               python(abi) = 2.7
               python(abi) = 2.7
           Available: python-2.7.5-16.el7.x86_64 (base)
               python(abi) = 2.7
               python(abi) = 2.7
       Error: Package: python-keyczar-0.71c-1.el6.noarch (epel)
           Requires: python(abi) = 2.6
           Installed: python-2.7.5-18.el7_1.1.x86_64 (@Updates)
               python(abi) = 2.7
               python(abi) = 2.7
           Available: python-2.7.5-16.el7.x86_64 (base)
               python(abi) = 2.7
               python(abi) = 2.7
       Error: Package: ansible-1.9.4-1.el6.noarch (epel)
           Requires: python(abi) = 2.6
           Installed: python-2.7.5-18.el7_1.1.x86_64 (@Updates)
               python(abi) = 2.7
               python(abi) = 2.7
           Available: python-2.7.5-16.el7.x86_64 (base)
               python(abi) = 2.7
               python(abi) = 2.7
       Error: Package: python-crypto2.6-2.6.1-2.el6.x86_64 (epel)
           Requires: python(abi) = 2.6
           Installed: python-2.7.5-18.el7_1.1.x86_64 (@Updates)
               python(abi) = 2.7
               python(abi) = 2.7
           Available: python-2.7.5-16.el7.x86_64 (base)
               python(abi) = 2.7
               python(abi) = 2.7
        You could try using --skip-broken to work around the problem
        You could try running: rpm -Va --nofiles --nodigest

Transferring files to <ansible-roles-centos-7>
Going to invoke ansible-playbook with: ANSIBLE_ROLES_PATH=/tmp/kitchen/roles sudo -E ansible-playbook --inventory-file=/tmp/kitchen/hosts -c local -M /tmp/kitchen/modules -vvv       /tmp/kitchen/default.yml
sudo: ansible-playbook: command not found

Ansible provider will not copy a vault file whose name starts with a dot

If I have the following: .kitchen.yml:

...
  ansible_vault_password_file: .vault_pass.txt
...

I will get the following error message:

       Going to invoke ansible-playbook with: ANSIBLE_ROLES_PATH=/tmp/kitchen/roles sudo -E ansible-playbook --inventory-file=/tmp/kitchen/hosts -c local -M /tmp/kitchen/modules -v   --vault-password-file=/tmp/kitchen/.vault_pass.txt    /tmp/kitchen/app.yaml
       Traceback (most recent call last):
         File "/usr/bin/ansible-playbook", line 324, in <module>
           sys.exit(main(sys.argv[1:]))
         File "/usr/bin/ansible-playbook", line 142, in main
           vault_pass = utils.read_vault_file(options.vault_password_file)
         File "/usr/lib/pymodules/python2.7/ansible/utils/__init__.py", line 176, in read_vault_file
           if is_executable(this_path):
         File "/usr/lib/pymodules/python2.7/ansible/utils/__init__.py", line 291, in is_executable
           return (stat.S_IXUSR & os.stat(path)[stat.ST_MODE]
       OSError: [Errno 2] No such file or directory: '/tmp/kitchen/.vault_pass.txt'
>>>>>> Converge failed on instance <default-ubuntu-1404>.
>>>>>> Please see .kitchen/logs/default-ubuntu-1404.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [ANSIBLE_ROLES_PATH=/tmp/kitchen/roles sudo -E ansible-playbook --inventory-file=/tmp/kitchen/hosts -c local -M /tmp/kitchen/modules -v   --vault-password-file=/tmp/kitchen/.vault_pass.txt    /tmp/kitchen/app.yaml]
>>>>>> ----------------------
zlib(finalizer): the stream was freed prematurely.

If I just remove the dot in the filename, it will work 😕.

I'm running:

  • kitchen-ansible (0.0.31)
  • kitchen-vagrant (0.19.0)
  • test-kitchen (1.4.2)
  • Mac OS X 10.11.1
  • Ruby 2.1.6 (through chefdk)

apt-get update before installing packages?

Currently the opscode-ubuntu-14,04 vagrant boxes we've been using at work appear to ship with out of date apt repository metadata.

The following NEW packages will be installed:
  python3-pycurl python3-software-properties software-properties-common
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 76.0 kB of archives.
After this operation, 542 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main python3-pycurl amd64 7.19.3-0ubuntu3 [47.5 kB]
Err http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main python3-software-properties all 0.92.37.1
  404  Not Found [IP: 91.189.91.24 80]
Err http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main software-properties-common all 0.92.37.1
  404  Not Found [IP: 91.189.91.24 80]
Fetched 47.5 kB in 5s (8,997 B/s)
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/s/software-properties/python3-software-properties_0.92.37.1_all.deb  404  Not Found [IP: 91.189.91.24 80]

E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/s/software-properties/software-properties-common_0.92.37.1_all.deb  404  Not Found [IP: 91.189.91.24 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Then the apt-add-repository command fails, the ansible repo isn't added and I end up with ansible 1.5.4.

Wouldn't it be logical to run an apt-get update before we try to start installing packages? If I do an update first, all the commands appear to succeed.

Load variables file

Is there a way to load variables from a file placed in group_vars? I have my production and testing variables there and would like to have the ones for testing in the same place. Putting everything in extra_vars in the .kitchen.yml gets a bit messy

Error in "kitchen verify": net-ssh requires Ruby version >= 2.0. (Gem::InstallError)

Hi Neill,

Using kitchen-ansible 0.17 & 0.33 (latest), we're seeing this issue all of a sudden:

$ kitchen verify
-----> Starting Kitchen (v1.4.2)
-----> Setting up <default-ubuntu-1404>...
       Finished setting up <default-ubuntu-1404> (0m0.00s).
-----> Verifying <default-ubuntu-1404>...
       Preparing files for transfer
-----> Installing Busser (busser)
Fetching: thor-0.19.0.gem (100%)
Fetching: busser-0.7.1.gem (100%)
       Successfully installed thor-0.19.0
       Successfully installed busser-0.7.1
       2 gems installed
-----> Setting up Busser
       Creating BUSSER_ROOT in /tmp/verifier
       Creating busser binstub
       Installing Busser plugins: busser-serverspec
       Plugin serverspec installed (version 0.5.7)
-----> Running postinstall for serverspec plugin
       Suite path directory /tmp/verifier/suites does not exist, skipping.
       Transferring files to <default-ubuntu-1404>
-----> Running serverspec test suite
-----> Installing Serverspec..
Fetching: rspec-support-3.4.1.gem (100%)
Fetching: rspec-core-3.4.1.gem (100%)
Fetching: diff-lcs-1.2.5.gem (100%)
Fetching: rspec-expectations-3.4.0.gem (100%)
Fetching: rspec-mocks-3.4.0.gem (100%)
Fetching: rspec-3.4.0.gem (100%)
Fetching: rspec-its-1.2.0.gem (100%)
Fetching: multi_json-1.11.2.gem (100%)
Fetching: net-ssh-3.0.1.gem (100%)
       /usr/lib/ruby/1.9.1/rubygems/installer.rb:388:in `ensure_required_ruby_version_met': net-ssh requires Ruby version >= 2.0. (Gem::InstallError)
        from /usr/lib/ruby/1.9.1/rubygems/installer.rb:156:in `install'
        from /usr/lib/ruby/1.9.1/rubygems/dependency_installer.rb:297:in `block in install'
        from /usr/lib/ruby/1.9.1/rubygems/dependency_installer.rb:270:in `each'
        from /usr/lib/ruby/1.9.1/rubygems/dependency_installer.rb:270:in `each_with_index'
        from /usr/lib/ruby/1.9.1/rubygems/dependency_installer.rb:270:in `install'
        from /tmp/verifier/gems/gems/busser-0.7.1/lib/busser/rubygems.rb:44:in `install_gem'
        from /tmp/verifier/gems/gems/busser-0.7.1/lib/busser/helpers.rb:57:in `install_gem'
        from /tmp/verifier/gems/gems/busser-serverspec-0.5.7/lib/busser/runner_plugin/serverspec.rb:60:in `install_serverspec'
        from /tmp/verifier/gems/gems/busser-serverspec-0.5.7/lib/busser/runner_plugin/serverspec.rb:33:in `test'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/command.rb:27:in `run'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:126:in `invoke_command'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `block in invoke_all'
       from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `each'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `map'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `invoke_all'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/group.rb:232:in `dispatch'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:115:in `invoke'
        from /tmp/verifier/gems/gems/busser-0.7.1/lib/busser/command/test.rb:43:in `block in perform'
        from /tmp/verifier/gems/gems/busser-0.7.1/lib/busser/command/test.rb:35:in `each'
        from /tmp/verifier/gems/gems/busser-0.7.1/lib/busser/command/test.rb:35:in `perform'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/command.rb:27:in `run'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:126:in `invoke_command'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `block in invoke_all'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `each'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `map'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `invoke_all'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/group.rb:232:in `dispatch'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:115:in `invoke'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor.rb:40:in `block in register'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/command.rb:27:in `run'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:126:in `invoke_command'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor.rb:359:in `dispatch'
        from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/base.rb:440:in `start'
        from /tmp/verifier/gems/gems/busser-0.7.1/bin/busser:8:in `<top (required)>'
        from /tmp/verifier/gems/bin/busser:23:in `load'
        from /tmp/verifier/gems/bin/busser:23:in `<main>'
>>>>>> Verify failed on instance <default-ubuntu-1404>.
>>>>>> Please see .kitchen/logs/default-ubuntu-1404.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sh -c '

BUSSER_ROOT="/tmp/verifier"; export BUSSER_ROOT
GEM_HOME="/tmp/verifier/gems"; export GEM_HOME
GEM_PATH="/tmp/verifier/gems"; export GEM_PATH
GEM_CACHE="/tmp/verifier/gems/cache"; export GEM_CACHE

sudo -E /tmp/verifier/bin/busser test
']
>>>>>> ----------------------

I'm guessing that this is because Ubuntu ships with Ruby 1.9.x, and the net-ssh-3.0.1.gem that Serverspec tries to install is suddenly trying to pull in a version of net-ssh that need Ruby>=2.0.0.

Any thoughts? Is there some Kitchen flag we can enable to install a newer Ruby in our Ubuntu VMs?

Thanks,
Dan T

/cc @dankimmel

Support for Ansible tags

Hi - thanks for providing this awesome Ansible provisioner!

As an improvement I suggest to support a 'tags' attribute for the provisioner and a suite which could greatly facilitate the configuration of various test suites (since it only requires a single playbook) like so:

provisioner:
  name: ansible_playbook
  ...

suites:
 - name: default
  attributes:
    tags: [apache-httpd, apache-tomcat]

- name: apache-httpd
  attributes:
    tags: [apache-httpd]

- name: apache-tomcat
  attributes:
    tags: [apache-tomcat]

Best, Martin

Support for platforms/operating systems without package managers

Promise for Ansible was that it does not require agent on the target machine. This makes Ansible ideal for operating systems like CoreOS, where there is no package manager and everything has to run on containers. Kitchen-ansible wants to install Ansible locally to the target machine to do provisioning.

Vagrant has implemented their Ansible provisioner so that Ansible doesn't need to be installed to the target machine. Is something similar possible with kitchen-ansible?

Ansible galaxy support fails when git is not on the TestKitchen box

If you are using the Ansible Galaxy support and specify a git/github repo in your requirements.yml file and the box being used to execute the tests does not have git installed, the TestKitchen run will fail.

This makes some sense, but the error message you will get will be pretty cryptic.

May be worth adding a warning log message or something within kitchen-ansible or possibly just install git on the box along with everything else that the gem ends up installing.

Unable to use Multiple playbooks based on documentation

I followed the documentation here:

https://github.com/neillturner/kitchen-ansible#testing-multiple-playbooks

I get the following error:

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #converge action: [unknown file type: rabbitmq]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

suites area looks like this:

suites:
  - name: rabbitmq
    provisioner:
      playbook: rabbitmq
      hosts: localhost

I tried both with rabbitmq.yml and rabbitmq both throw up the same error.

additional_copy_path should work with files as well as folders

Hey,

I'm writing up some tests for a Playbook that includes a couple of other Playbooks. The Ansible provisioner currently only copies across the playbook I'd like to test, not everything else it depends on...

I'd like to use the additional_copy_path param to copy across the additional Playbooks, but it currently only works with directories - from ansible_playbook.rb:

        def prepare_addt_dir
          info('Preparing additional_copy_path')

          additional_dirs.each do |additional_dir|

            tmp_addt_dir = File.join(sandbox_path, File.basename(additional_dir))
            FileUtils.mkdir_p(tmp_addt_dir)

            unless File.directory?(additional_dir)
              info "invalid value #{additional_dir} in additional_copy_path"
              return
            end

            debug("Using additional_copy_path from #{additional_dir}")
            FileUtils.cp_r(Dir.glob("#{additional_dir}/*"), tmp_addt_dir)
          end
        end

I'm happy to raise a PR to get this working with both files and directories, but want to check if there would be any objections or if there's a hard reason for only accepting directories? Or perhaps there's a preferred way of handling this?

Thanks!!

Publish 0.17 or 0.18 to Ruby Gems

@neillturner - I'd love to get it pushed out there so more people can take advantage of the work to remove the Chef omnibus install.

Of course, this is still an option in the meantime:

gem "kitchen-ansible", :git => "https://github.com/neillturner/kitchen-ansible.git", :ref => "c773ba2ba41a4bd3fb7fccdb1d3c84db65a38d92"

Can't use Ansible requirements file that lives in higher-level directory

TL; DR: I think this is a problem in how kitchen-ansible is generating the path to the requirements file within the VM, for passing to ansible galaxy install -r ....

Here's the situation I'm trying to work with: We have an Ansible requirements.ymlfile that lives two directory levels above where we keep our custom roles. Ex:

$ tree -a
.
├── README.md
├── playbook.yml
├── requirements.yml
└── roles
    ├── dlpx.common
    │   ├── .kitchen.yml
    │   ├── files
    │   ├── tasks
    │   ├── test
... <many more> ...

I'm trying to maintain the principles of don't-repeat-yourself (DRY) and re-use that top-level requirements.yml file for our Test Kitchen tests, rather than creating redundant requirements.yml files co-located with each .kitchen.yml file. Unfortunately I cannot figure out how to reference that requirements.yml file from .kitchen.yml successfully. Ex:

  • If I specify requirements_path: requirements.yml, I get the following error because requirements.yml is not in the same working dir as .kitchen.yml:
# .kitchen.yml :
provisioner:
  hosts: test-kitchen
  name: ansible_playbook
  additional_copy_path:
    - "../dlpx.git-client"
    - "../../requirements.yml"
  requirements_path: requirements.yml

====
# Error:
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #converge action: [No such file or directory - requirements.yml]
>>>>>> ----------------------
  • I can get around that by modifying requirements_path to be the relative path to ../../requirements.yml, but then when Test Kitchen goes to run ansible-galaxy install it gets run with -r /tmp/kitchen/../../requirements.yml, where /tmp/kitchen/../../requirements.yml is not the correct path to the requirements.yml file that was copied over:
# .kitchen.yml :
provisioner:
  hosts: test-kitchen
  name: ansible_playbook
  additional_copy_path:
    - "../dlpx.git-client"
    - "../../requirements.yml"
  requirements_path: "../../requirements.yml"

====
# Error:
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E bash -c '[ -d /etc/ansible ] || mkdir /etc/ansible' && sudo -E cp /tmp/kitchen/ansible.cfg /etc/ansible && sudo -E cp -r /tmp/kitchen/group_vars /etc/ansible/. && sudo -E cp -r /tmp/kitchen/host_vars /etc/ansible/. && ansible-galaxy install --force -p /tmp/kitchen/roles -r /tmp/kitchen/../../requirements.yml]
>>>>>> ----------------------

# The files lives at:  /tmp/kitchen/requirements.yml
vagrant@default-ubuntu-1404:~$ ls -l /tmp/kitchen/requirements.yml
-rw-r--r-- 1 vagrant vagrant 895 Jul 10 17:34 /tmp/kitchen/requirements.yml

I think this is a problem in how kitchen-ansible is generating the path to the requirements file within the VM, for passing to ansible galaxy install -r ....

Converge fails with empty ansible vault configuration

If I don't configure any ansible vault parts in my kitchen, a deployment is currently crashing:

       Preparing ansible vault password
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #converge action: [no implicit conversion of nil into String]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

Backtracking this to:

E, [2015-05-11T22:37:35.437402 #2649] ERROR -- Kitchen: /var/lib/gems/2.0.0/gems/kitchen-ansible-0.0.14/lib/kitchen/provisioner/ansible_playbook.rb:372:in `basename'
E, [2015-05-11T22:37:35.437443 #2649] ERROR -- Kitchen: /var/lib/gems/2.0.0/gems/kitchen-ansible-0.0.14/lib/kitchen/provisioner/ansible_playbook.rb:372:in `tmp_ansible_vault_password_file_path'
E, [2015-05-11T22:37:35.437487 #2649] ERROR -- Kitchen: /var/lib/gems/2.0.0/gems/kitchen-ansible-0.0.14/lib/kitchen/provisioner/ansible_playbook.rb:647:in `prepare_ansible_vault_password_file'

Reference:

File.join(sandbox_path, File.basename(ansible_vault_password_file))

Ansible can't find the role

Hello,

I'm using Docker provider and kitchen-ansible on jenkins.
Testing with kitchen test on my local computer works like a charm, but using it in jenkins fails :

       Transferring files to <default-debian-wheezy>
       ERROR: cannot find role in /tmp/kitchen/roles/ansible-vault or /tmp/kitchen/ansible-vault or /tmp/kitchen/roles/ansible-vault
>>>>>> Converge failed on instance <default-debian-wheezy>.
>>>>>> Please see .kitchen/logs/default-debian-wheezy.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E ansible-playbook --inventory-file=/tmp/kitchen/hosts -c local -M /tmp/kitchen/modules -vv      /tmp/kitchen/default.yml]
>>>>>> ----------------------

On the docker instance :

root@71c0a9dbb9ba:/var/lib/jenkins/docker/aufs/mnt/71c0a9dbb9bab0829ef517baf180befe6c6ce4d52b23913ea6d5f5597f806e93/tmp/kitchen# ls
ansible.cfg  default.yml  filter_plugins  group_vars  host_vars  hosts  lookup_plugins  modules  roles
root@71c0a9dbb9ba:/var/lib/jenkins/docker/aufs/mnt/71c0a9dbb9bab0829ef517baf180befe6c6ce4d52b23913ea6d5f5597f806e93/tmp/kitchen# cat ansible.cfg 
[defaults]
roles_path = /tmp/kitchen/roles
root@71c0a9dbb9ba:/var/lib/jenkins/docker/aufs/mnt/71c0a9dbb9bab0829ef517baf180befe6c6ce4d52b23913ea6d5f5597f806e93/tmp/kitchen# cd roles/
root@71c0a9dbb9ba:/var/lib/jenkins/docker/aufs/mnt/71c0a9dbb9bab0829ef517baf180befe6c6ce4d52b23913ea6d5f5597f806e93/tmp/kitchen/roles# ls
workspace

Here is my structure :

jenkins@CI0-EU-WE1-PROD:~/jobs/ansible-vault/workspace$ tree
.
├── ansible.cfg
├── defaults
│   └── main.yml
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── README.md
├── tasks
│   ├── bootstrap.yml
│   └── main.yml
├── templates
│   ├── vault.config.j2
└── test
    └── integration
        └── default
            └── default.yml

My ansible.cfg :

[defaults]
roles_path = ../

My .kitchen.yml :


---
driver:
  name: docker
  use_sudo: false

provisioner:
  hosts: test-kitchen
  name: ansible_playbook
  ansible_verbosity: 2
  ansible_verbose: true

platforms:
  - name: debian-wheezy
    driver_config:
      image: debian:wheezy-backports
      platform: debian

suites:
  - name: default

My test/integration/default/default.yml :

- hosts: all
  roles:
    - ansible-vault

My jenkins jobs is setup with a shell script :

#!/bin/bash
source /usr/local/rvm/scripts/rvm
kitchen test

I guess the problem is the workspace directory, but don't know how to deal with. Have you an idea please ?

On my computer, it works as expected

Thanks

kitchen-sync support

kitchen-sync seems to monkeypatch only the chef_base class for better upload. it would be wonderful if kitchen-ansible would detect kitchen-sync and use the must faster transfer modes of those.

basic ansible copy cannot find file

The following fully qualified path copy command does not work under kitchen-ansible:

- name: copy app war
  copy:
    src=/tmp/rest-api-1.0.0-SNAPSHOT.war
    dest=/home/{{ user }}/devops_{{ deploy_stamp }}.war
    owner={{ user }}
    group={{ group }}
    mode=0644
  tags:
    - deploy

results in

fatal: [localhost] => input file not found at /tmp/rest-api-1.0.0-SNAPSHOT.war or /tmp/rest-api-1.0.0-SNAPSHOT.war       

any thoughts?

cp: failed to access ‘/etc/ansible/.’: Not a directory

I've been trying to test some simple playbooks and i've been getting this error

cp: failed to access ‘/etc/ansible/.’: Not a directory

Here's the .kitchen.yaml

  

---
driver:
  name: vagrant

provisioner:
  name: ansible_playbook
  playbook: nginx.yml
  #ansible_yum_repo: "https://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm"
  ansible_verbose: true
  ansible_verbosity: 3
  hosts: all

platforms:
  - name: centos-7.0

suites:
  - name: default
    run_list:
    attributes:
 
Transferring files to 
I, [2015-02-10T00:05:30.318107 #55487]  INFO -- default-centos-70: cp: failed to access ‘/etc/ansible/.’: Not a directory
E, [2015-02-10T00:05:30.322554 #55487] ERROR -- default-centos-70: Converge failed on instance .
E, [2015-02-10T00:05:30.322680 #55487] ERROR -- default-centos-70: ------Exception-------
E, [2015-02-10T00:05:30.322719 #55487] ERROR -- default-centos-70: Class: Kitchen::ActionFailed
E, [2015-02-10T00:05:30.322744 #55487] ERROR -- default-centos-70: Message: SSH exited (1) for command: [sudo -E cp /tmp/kitchen/ansible.cfg /etc/ansible && sudo -E cp -r /tmp/kitchen/group_vars /etc/ansible/. && sudo -E cp -r /tmp/kitchen/host_vars /etc/ansible/.]
E, [2015-02-10T00:05:30.322766 #55487] ERROR -- default-centos-70: ---Nested Exception---
E, [2015-02-10T00:05:30.322785 #55487] ERROR -- default-centos-70: Class: Kitchen::SSHFailed
E, [2015-02-10T00:05:30.322819 #55487] ERROR -- default-centos-70: Message: SSH exited (1) for command: [sudo -E cp /tmp/kitchen/ansible.cfg /etc/ansible && sudo -E cp -r /tmp/kitchen/group_vars /etc/ansible/. && sudo -E cp -r /tmp/kitchen/host_vars /etc/ansible/.]
E, [2015-02-10T00:05:30.322844 #55487] ERROR -- default-centos-70: ------Backtrace-------
E, [2015-02-10T00:05:30.322864 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/driver/ssh_base.rb:152:in `rescue in run_remote'
E, [2015-02-10T00:05:30.322885 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/driver/ssh_base.rb:148:in `run_remote'
E, [2015-02-10T00:05:30.322927 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/driver/ssh_base.rb:49:in `block in converge'
E, [2015-02-10T00:05:30.322946 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/ssh.rb:70:in `initialize'
E, [2015-02-10T00:05:30.322965 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/driver/ssh_base.rb:45:in `new'
E, [2015-02-10T00:05:30.322985 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/driver/ssh_base.rb:45:in `converge'
E, [2015-02-10T00:05:30.323003 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0/gems/kitchen-vagrant-0.15.0/lib/kitchen/driver/vagrant.rb:75:in `converge'
E, [2015-02-10T00:05:30.323023 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:352:in `public_send'
E, [2015-02-10T00:05:30.323036 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:352:in `block in perform_action'
E, [2015-02-10T00:05:30.323046 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:416:in `call'
E, [2015-02-10T00:05:30.323056 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:416:in `synchronize_or_call'
E, [2015-02-10T00:05:30.323066 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:381:in `block in action'
E, [2015-02-10T00:05:30.323076 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/benchmark.rb:288:in `measure'
E, [2015-02-10T00:05:30.323087 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:380:in `action'
E, [2015-02-10T00:05:30.323097 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:352:in `perform_action'
E, [2015-02-10T00:05:30.323107 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:312:in `converge_action'
E, [2015-02-10T00:05:30.323117 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:292:in `block in transition_to'
E, [2015-02-10T00:05:30.323127 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:291:in `each'
E, [2015-02-10T00:05:30.323137 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:291:in `transition_to'
E, [2015-02-10T00:05:30.323147 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:130:in `converge'
E, [2015-02-10T00:05:30.323157 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/command.rb:176:in `public_send'
E, [2015-02-10T00:05:30.323176 #55487] ERROR -- default-centos-70: /Users/rjones/.rvm/gems/ruby-2.2.0@global/gems/test-kitchen-1.3.1/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'

 

I just have an ansible directory where i keep all my playbooks and host file. I'm assuming that I need to override the location /etc/ansible some how but looking at the kitchen-ansible and test-kitchen docs I haven't been able to figure out how

How to use this with roles?

Hello @neillturner,

First off I'd like to say a big Thank You for creating this provisioner for test-kitchen! I've so far had some good luck getting it working with the tomcat-standalone example playbook. I've got an Ansible TDD example repo here.

First off, let me explain that it's refreshing to see this Test Kitchen Provisioner after coming from a background where I was working at a company with heavy Chef usage, modular re-usable cookbooks, and test-kitchen config & serverspec tests embedded within the cookbooks. Now I'm at a company using Ansible, so I've had to adapt and am re-learning how to do things in Ansible, but have found the testing frameworks in the Ansible community lacking. Understandably so, since Ansible is much younger than Chef. However, I'm struggling with some best-practices TDD paradigms that I'm not finding in Ansible.

Since "Roles" are the re-usable, community-shareable, unit of configuration management code in Ansible... I have a feeling that we should be packaging them up with their own integration tests also similar to how cookbooks are distributed in the Chef community (at least on GitHub if not on Ansible Galaxy... though there may be need for something similar to the chefignore file for uploading them w/o the test directory & test fixtures)

It seems that Playbooks are more akin to the concept of a Wrapper Cookbook or Role Cookbook in Ansible, and they are not the unit of code that is shared via the community site. I do think it's useful to be able to test them (much the same as a wrapper cookbook... it's just a higher-level layer of the integration or acceptance testing coverage onion). However, I am struggling with the recommended settings for the .kitchen.yml config so I can embed tests in an Ansible Role.

I noticed that there is a method commented out: Kitchen::Provisioner::AnsiblePlaybook#calculate_path() that seems to be looking to resolve paths for roles, group_vars, host_vars, modules, and an Ansiblefile based on the test_base_path and suite name. Would I need to create some sort of test-fixture Playbook inside a test suite directory that includes/wraps the role?

Thoughts?

Need to run multiple playbooks

I have a need to run multiple playbooks and before I write any code to potentially submit this I thought I'd check if this is a feature you'd even be ok with. An example is I want to do:

playbooks:

  • base.yml
  • app.yml

In order to get a fully provisioned machine. My playbooks are (unfortunately) not completely standalone and if base isn't run things will fail. Is there any way to do this currently? If not, will you accept a PR that attempts to add this?

Define multiple locations for role locations

Can anyone think of a way to explicitly or implicitly define multiple locations for roles?

Example: In my integration test I want to apply various roles that make up the test environment before the actual role under test is applied. A particular use-case would be to install a PostgreSQL database that our application could immediately talk to if configured correctly during installation.

Of course, these supporting roles should not be together with the actual role under test, but rather in test/integration/roles (or similar). However, if I do that, the role under test which resides in roles will be ignored.

Thanks, Martin

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.