neillturner / kitchen-ansible

Ansible Provisioner for Test Kitchen
Other
350 stars 134 forks source link

Ansible Provision for Windows is not woking #291

Closed riponbanik closed 6 years ago

riponbanik commented 6 years ago

Config

platforms:

Debug Log - D sudo -E rm -rf /tmp/kitchen/modules /tmp/kitchen/roles /tmp/kitchen/group_vars /tmp/kitchen/host_vars; mkdir -p /tmp/kitchen D [SSH] ec2-user@10.x.2.217<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>10, :keys_only=>true, :keys=>["/c/Workspace/xx/automation/xx/.kitchen/default-amazon-20180810.pem"], :auth_methods=>["publickey"], :verify_host_key=>false}> (sudo -E rm -rf /tmp/kitchen/modules /tmp/kitchen/roles /tmp/kitchen/group_vars /tmp/kitchen/host_vars; mkdir -p /tmp/kitchen) D [SSH] opening connection to ec2-user@10.x.2.217<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>10, :keys_only=>true, :keys=>["/c/Workspace/xx/automation/xx/.kitchen/default-amazon-20180810.pem"], :auth_methods=>["publickey"], :verify_host_key=>false}> Transferring files to D TIMING: scp async upload (Kitchen::Transport::Ssh) D Cleaning up local sandbox in /tmp/default-amazon-20180810-sandbox-20181004-1919-1a1t5sj

------Exception------- Class: Kitchen::ActionFailed Message: 1 actions failed. Converge failed on instance . Please see .kitchen/logs/default-amazon-20180810.log for more details

Please see .kitchen/logs/kitchen.log for more details Also try running kitchen diagnose --all for configuration

neillturner commented 6 years ago

sorry can't tell from this. you need to show the kitchen.yml file run kitchen with -l debug and then look at the logs.

riponbanik commented 6 years ago

@neillturner Thanks I have uploaded kitchen.yml -

https://gist.github.com/riponbanik/323cd14d549197ec361259b71ce1df7d

The logs that I have put is the debug log.

riponbanik commented 6 years ago

Update: I have run it from linux machine as well - but the same issue at the end failing to transfer files but i can already see files under /tmp/kitchen directory

-----> Converging ... Preparing files for transfer D Creating local sandbox in /tmp/default-amazon-20180810-sandbox-20181005-8675-1d69w7e D Creating local sandbox in /tmp/default-amazon-20180810-sandbox-20181005-8675-1d69w7e Preparing playbook D Copying playbook from playbook.yml to /tmp/default-amazon-20180810-sandbox-20181005-8675-1d69w7e/playbook.yml Preparing inventory D Copying inventory file from inventory/hosts to /tmp/default-amazon-20180810-sandbox-20181005-8675-1d69w7e/hosts Preparing modules D Using modules from lib/windows Preparing roles D Using roles from /home/ec2-user/x Preparing ansible.cfg file Found existing ansible.cfg Preparing group_vars D Using group_vars from /home/ec2-user/x/group_vars Preparing additional_copy_path Preparing host_vars nothing to do for host_vars Preparing spec nothing to do for spec Preparing library plugins nothing to do for library plugins Preparing callback plugins nothing to do for callback plugins Preparing filter_plugins nothing to do for filter_plugins Preparing lookup_plugins nothing to do for lookup_plugins Preparing ansible vault password Preparing additional_ssh_private_keys nothing to do for additional_ssh_private_keys Finished Preparing files for transfer

  Transferring files to <default-amazon-20180810>

D TIMING: scp async upload (Kitchen::Transport::Ssh) D Cleaning up local sandbox in /tmp/default-amazon-20180810-sandbox-20181005-8675-1d69w7e

When I removed the roles_path it moved to install ansible but now upload failing - I am running Ubuntu Linux from Windows 10

18-10-05T11:10:57.969053 #2014] INFO -- default-amazon-20180810: Transferring files to D, [2018-10-05T11:10:57.970013 #2014] DEBUG -- default-amazon-20180810: TIMING: scp async upload (Kitchen::Transport::Ssh) D, [2018-10-05T11:10:58.154554 #2014] DEBUG -- default-amazon-20180810: Cleaning up local sandbox in /tmp/default-amazon-20180810-sandbox-20181005-2014-1n67531 E, [2018-10-05T11:10:58.342721 #2014] ERROR -- default-amazon-20180810: Converge failed on instance . E, [2018-10-05T11:10:58.342915 #2014] ERROR -- default-amazon-20180810: ------Exception------- E, [2018-10-05T11:10:58.342946 #2014] ERROR -- default-amazon-20180810: Class: Kitchen::ActionFailed E, [2018-10-05T11:10:58.342961 #2014] ERROR -- default-amazon-20180810: Message: SCP upload failed (open failed (1)) E, [2

My purpose is to test the roles/modules that I create.

riponbanik commented 6 years ago

@neillturner - I have resolved the issue. It seems the scp upload is just unstable. It sometimes fails. Also I needed to install pywinrm. Do you happen to know how to make it automated e.g. adding another shell provisioner before running ansible-playbook - i do not seem to find any reference regarding this.

neillturner commented 6 years ago

look at the custom_pre_play_command and custom_post_install_command parameters where you can add each script to do each stuff -)

To improve perform of uploads see https://rubygems.org/gems/kitchen-sync ormy https://rubygems.org/gems/kitchen-ssh. which support ssh_gzip format