mardi 26 mai 2015

Kitchen-EC2 SSH prompting password for an instance inside VPC

I am trying to spin up an ec2 instance inside a VPC on a private subnet. Every time I run kitchen test, I am able to spin up the instance with the right security groups and in the right subnet range. When test-kitchen is trying to SSH on to the instance, it is asking for password. However, when I manually try to ssh (ssh <private_ip> -i <path_to_ssh_key> -l ubuntu) on to the machine I succeed without being prompted for a password.

The following is my .kitchen.yml file

---
driver:
  name: ec2
  aws_ssh_key_id: id-spanning
  security_group_ids: ['sg-9....5']
  region: us-east-1
  availability_zone: us-east-1a
  require_chef_omnibus: true
  subnet_id: subnet-5...0
  associate_public_ip: false
  instance_type: m3.medium
  interface: private

transport:
  ssh_key: ~/.ssh/id-spanning.pem
  connection_timeout: 10
  connection_retries: 5
  username: ubuntu

provisioner:
  name: chef_solo

platforms:
  - name: Ubuntu-14.04
    driver:
      image_id: ami-8821cae0

suites:
  - name: default
     run_list:
   attributes:

I have the aws credentials in place on the environment variables. The following is my output.

kitchen test
-----> Starting Kitchen (v1.4.0)
-----> Cleaning up any prior instances of <default-Ubuntu-1404>
-----> Destroying <default-Ubuntu-1404>...
   EC2 instance <i-16f468c6> destroyed.
   Finished destroying <default-Ubuntu-1404> (0m1.90s).
-----> Testing <default-Ubuntu-1404>
-----> Creating <default-Ubuntu-1404>...
   Creating <>...
If you are not using an account that qualifies under the AWS
free-tier, you may be charged to run these suites. The charge
should be minimal, but neither Test Kitchen nor its maintainers
are responsible for your incurred costs.

   Instance <i-8fad345f> requested.
   EC2 instance <i-8fad345f> created.
   Waited 0/300s for instance <i-8fad345f> to become ready.
   Waited 5/300s for instance <i-8fad345f> to become ready.
   Waited 10/300s for instance <i-8fad345f> to become ready.
   Waited 15/300s for instance <i-8fad345f> to become ready.
   Waited 20/300s for instance <i-8fad345f> to become ready.
   Waited 25/300s for instance <i-8fad345f> to become ready.
   EC2 instance <i-8fad345f> ready.
   Password: 

I tried several times and haven't had any luck on bypassing the password to allow test-kitchen to ssh on to the instance. The following is my kitchen diagnose output.

---
timestamp: 2015-05-26 15:34:29 UTC
kitchen_version: 1.4.0
instances:
  default-Ubuntu-1404:
    platform:
      os_type: unix
      shell_type: bourne
    state_file:
      hostname: ''
      server_id: i-1.....6
    driver:
      associate_public_ip: false
      availability_zone: us-east-1a
      aws_access_key_id: 
      aws_secret_access_key: 
      aws_session_token: 
      aws_ssh_key_id: id-spanning
      block_device_mappings: 
      ebs_optimized: false
      flavor_id: 
      iam_profile_name: 
      image_id: ami-8821cae0
      instance_type: m3.medium
      interface: private
      kitchen_root: "/Users/jonnas2/Desktop/apache101"
      log_level: :info
      name: ec2
      price: 
      private_ip_address: 
      region: us-east-1
      retryable_sleep: 5
      retryable_tries: 60
      security_group_ids:
      - sg-9....5
      shared_credentials_profile: 
      subnet_id: subnet-5....0
      tags:
        created-by: test-kitchen
      test_base_path: "/Users/jonnas2/Desktop/apache101/test/integration"
      user_data: 
      username: 
    provisioner:
      attributes: {}
      chef_metadata_url: 
      chef_omnibus_install_options: 
      chef_omnibus_root: "/opt/chef"
      chef_omnibus_url: http://ift.tt/1yj6n3U
      chef_solo_path: "/opt/chef/bin/chef-solo"
      clients_path: 
      cookbook_files_glob: README.*,metadata {json,rb},attributes/**/*,definitions/**/*,files/**/*,libraries/**/*,providers/**/*,recipes/**/*,resources/**/*,templates/**/*
      data_bags_path: 
      data_path: 
      encrypted_data_bag_secret_key_path: 
      environments_path: 
      http_proxy: 
      https_proxy: 
      kitchen_root: "/Users/jonnas2/Desktop/apache101"
      log_file: 
      log_level: :info
      name: chef_solo
      nodes_path: 
      require_chef_omnibus: true
      roles_path: 
      root_path: "/tmp/kitchen"
      run_list: []
      solo_rb: {}
        sudo: true
      sudo_command: sudo -E
      test_base_path: "/Users/jonnas2/Desktop/apache101/test/integration"
    transport:
      compression: zlib
      compression_level: 6
      connection_retries: 5
      connection_retry_sleep: 1
      connection_timeout: 10
      keepalive: true
      keepalive_interval: 60
      kitchen_root: "/Users/jonnas2/Desktop/apache101"
      log_level: :info
      max_wait_until_ready: 600
      name: ssh
      port: 22
      ssh_key: "/Users/jonnas2/.ssh/id-spanning.pem"
      test_base_path: "/Users/jonnas2/Desktop/apache101/test/integration"
      username: ubuntu
    verifier:
      busser_bin: "/tmp/verifier/bin/busser"
      http_proxy: 
      https_proxy: 
      kitchen_root: "/Users/jonnas2/Desktop/apache101"
      log_level: :info
      name: busser
      root_path: "/tmp/verifier"
      ruby_bindir: "/opt/chef/embedded/bin"
      sudo: true
      sudo_command: sudo -E
      suite_name: default
      test_base_path: "/Users/jonnas2/Desktop/apache101/test/integration"
      version: busser

versions used: test-kitchen 1.4.0 kitchen-ec2 0.9.0

Any help would be greatly appreciated. Thanks.




Aucun commentaire:

Enregistrer un commentaire