I was trying to copy a test file from a Linux control server to a Windows 7 client. my playbook is
- name: Test Copy from Linux to Windows
hosts: Windows
gather_facts: false
tasks:
- name: Copy
copy: src=/tmp/tmp.txt dest=C:\Ansible
And getting this error
failed: [10.8.0.4] => {"failed": true, "md5sum": "c9566265d534d0e3c666ea52daf96cc8", "parsed": false}
invalid output was: The argument 'C:\Users\me.HOMEPC\AppData\Local\Temp\ansible-tmp-1422383762.86-109261083693479\\copy.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.
FATAL: all hosts have already failed -- aborting
Any thoughts? How I can make this work?
There's a small bug in that fork version. Use https://gist.github.com/dmitrydigi/dc4843fca7e69bcca147 with the fix. If you use the mentioned version, then template will always report changed=true.
Looks like the copy module doesn't support for file copy function in Windows and atm, a win_copy module is in the dev phase.
However I have found this VERY useful module which is copy.ps1
https://gist.github.com/tkinz27/fd92ba9af0e0309614ee
And then things got working :-)
Important: You gotta upgrade your Windows (7) Powershell to Version 4.0
Related
I'm trying to deployement an Openstack infrastracture multi node with kolla-ansible on Ubuntu 20.04.4.
ansible 4.10.0
ansible-core 2.11.11
kolla-ansible 13.0.1
when I execute command:
kolla-ansible -i /etc/kolla/multinode pull
or
kolla-ansible -i /etc/kolla/multinode deploy
I'm getting error:
fatal: [controller]: FAILED! => {"msg": "template error while templating string: No filter named 'select_services_enabled_and_mapped_to_host'.. String: {{ lookup('vars', (kolla_role_name | default(project_name)) + '_services') | select_services_enabled_and_mapped_to_host }}"}
fatal: [compute01]: FAILED! => {"msg": "template error while templating string: No filter named 'select_services_enabled_and_mapped_to_host'.. String: {{ lookup('vars', (kolla_role_name | default(project_name)) + '_services') | select_services_enabled_and_mapped_to_host }}"}
I have 1 deployment Node, 1 controller, 1 compute Node
Doesn't seems like a pull-issue based in the error-message. Seems like another configuration-problem with your Neutron. The default-multi-node config requires 3 controller. I don't exactly know your multi-node config for kolla-ansible, but when you only want 1 controller and 1 compute you can do something different:
Use the all-in-one-file for your setup. Should be in path kolla-ansible/ansible/inventory/all-in-one. Modify this file by replacing the localhost in the [compute]-section with the name of the host, where the compute should be created and remove the ansible_connection=local. This always worked for me, when I created a test-deployment with 1 controller and X compute-nodes.
Only in case you want the controller not on the host, where you execute the kolla-ansible, then replace all other localhost by the name of your controller-node and of course remove the ansible_connection=local everywhere.
Only the be sure: Don't forget to write the name of the host with it's ip-address in the /etc/hosts-file on the node, where you execute the kolla-ansible run.
Firstly, what's the result of kolla-ansible prechecks -i multinode_or_all-in-one command?
Dive into this method select_services_enabled_and_mapped_to_host of kolla-ansible project, you will find some clues. The method's return dependent by service_enabled and service_mapped_to_host
So, there are two step to clear your problem:
1, check the service enabled setting in /etc/kolla/globals.yml and kolla-ansible/ansible/group_vars/all.yml.
You can use this file(globals.yml) to override any variable throughout Kolla. Additional options can be found in the 'kolla-ansible/ansible/group_vars/all.yml' file.
2, check the host inventory in multinode or all-in-one file whether consistent with the really information or not.
Or everything is OK, I think you should redeploy it refer to kolla-ansible quickstar.
I have a task in my ansible playbook, that downloads a java archive from a github url.
The task is here:
- name: Download Jar Plugin
get_url:
url: https://GitHub-URL/plugins-1.0.5.jar
dest: /app/plugins/
There's no mention of checksum, yet it gives this error:
fatal: [host]: FAILED! => {"changed": false, "msg": "attempted to take checksum of directory: /app/plugins/plugins-1.0.5.jar"}
anyone has any idea about this? Is there any workaround to make it download this java archive?
First of all GitHub is not the right location to keep binaries. Github does not allow us to store a single file greater than 100 MB in most cases. You you should have binaries kept in either a physical server or any cloud storage and pull it from there.
Now, if you are really inclined to follow this bad practise I suggest you to create an equivalent unix curl first to do that. If you have an existing curl command to do that share that with us or simply use ansible shell module as a starting point. You can also try increasing timeouts as default is 10 secs only. Here's a snippet where timeout is set to 200 seconds.
- name: Download Jar Plugin
get_url:
url: https://GitHub-URL/plugins-1.0.5.jar
dest: /app/plugins/
timeout: 200
Try adding checksum argument as below:
- name: Download Jar Plugin
get_url:
url: https://GitHub-URL/plugins-1.0.5.jar
dest: /app/plugins/
timeout: 200
checksum: <yourchecksum>
Hope this helps as per your error.
This question already has answers here:
Why does Ansible show "ERROR! no action detected in task" error?
(6 answers)
Closed 5 years ago.
I've an issue with a really basic module which doesn't seem do work like it is supposed to work, I guess?
I actually copied the part out of the documentation.
My playbook looks like this:
---
- hosts: all
tasks:
- name: Create Snapshot
vmware_guest_snapshot:
hostname: vSphereIP
username: vSphereUsername
password: vSpherePassword
name: vmname
state: present
snapshot_name: aSnapshotName
description: aSnapshotDescription
I run this playbook from ansible tower and it throws "ERROR! no action detected in task". It seems like a syntax error for me but I literaly copied it over from the documentation and other modules are working with the same syntax.
So does anyone knows what I'm doing wrong?
The vmware_guest_snapshot module is available since version 2.3 of Ansible (which is not yet released).
If you are running any older version, the module name will not be recognised and Ansible will report the error no action detected in task.
Currently you need to be running Ansible from source (the devel branch) to run the vmware_guest_snapshot module.
I need to create C:\MSI folder to put there msi files. Here is my task:
tasks:
- name: Copy *.msi files from ./MSI to C:\MSI
file: path=C:\MSI state=directory
But I got the error:
TASK [Copy *.msi files from ./MSI to C:\MSI] ***********************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: + ~~~~~~~~~~~~~~~
fatal: [agentsmith]: FAILED! => {"changed": false, "failed": true, "msg": "The term '/usr/bin/python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."}
and in verbose mode I see that File module for some reason puts /usr/bin/python to the Powershell script:
TASK [Copy *.msi files from ./MSI to C:\MSI] ***********************************
task path: /home/qaexpert/ansible-lab/tcagent.yml:8
<agentsmith> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO agentsmith
<agentsmith> EXEC Set-StrictMode -Version Latest
(New-Item -Type Directory -Path $env:temp -Name "ansible-tmp-1477410445.62-187863101456896").FullName | Write-Host -Separator '';
<agentsmith> PUT "/tmp/tmpqOJYen" TO "C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1477410445.62-187863101456896\file.ps1"
<agentsmith> EXEC Set-StrictMode -Version Latest
Try
{
/usr/bin/python 'C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1477410445.62-187863101456896\file.ps1'
}
Catch
...
Ansible looks for /usr/bin/python because the file module needs Python installed on the target system. It is not possible to use normal Ansible modules for Windows target.
Look at the Ansible Windows documentation for details. On Windows hosts only modules listed in the “windows” subcategory of the Ansible module index are available.
To replace the regular file module use the win_file module.
I have a simple .pp / puppet file, and I'm getting "Parameter provider failed: Invalid package provider 'pip' at sis.pp:24"
Here's the line 24:
20 package {"numpy":
21 ensure => installed,
22 provider => pip,
23 require => Package["python-setuptools", "python-pip", "python-dev", "build-essential"]
24 }
I checked for syntax errors, there are none.
My guess is that puppet can't find pip, I uninstalled and installed pip again. With apt-get,
here's what i get when i type "whereis pip"
pip: /usr/local/bin/pip /usr/share/man/man1/pip.1.gz
I searched around and found that puppet has a pip module, installed it too.
But still clueless about what the problem is.
When I type "puppet apply sis.pp --debug --verbose"
I get this:
debug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does not exist
debug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not exist
debug: Puppet::Type::Package::ProviderYum: file yum does not exist
debug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not exist
debug: Puppet::Type::Package::ProviderAix: file /usr/bin/lslpp does not exist
debug: Puppet::Type::Package::ProviderPorts: file /usr/sbin/pkg_info does not exist
debug: Puppet::Type::Package::ProviderNim: file /usr/sbin/nimclient does not exist
debug: Puppet::Type::Package::ProviderRpm: file rpm does not exist
debug: Puppet::Type::Package::ProviderSun: file /usr/sbin/pkgrm does not exist
debug: Puppet::Type::Package::ProviderPortupgrade: file /usr/sbin/pkg_info does not exist
debug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swremove does not exist
debug: Puppet::Type::Package::ProviderZypper: file /usr/bin/zypper does not exist
debug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/pkg_delete does not exist
debug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-nox does not exist
debug: Puppet::Type::Package::ProviderPkg: file /usr/bin/pkg does not exist
debug: Puppet::Type::Package::ProviderPortage: file /usr/bin/eix does not exist
debug: Puppet::Type::Package::ProviderAptrpm: file rpm does not exist
debug: Puppet::Type::Package::ProviderOpenbsd: file pkg_delete does not exist
debug: Puppet::Type::Package::ProviderUrpmi: file urpmq does not exist
Parameter provider failed: Invalid package provider 'pip' at /path/sis.pp:54
Observe the puppet interpreter is pointing to multiple places in the sis.pp file where it couldn't process provider => "pip"
need help. I'm now going to try and find the terminal output code lines in puppet source to see what the problem is. If somebody knows the solution already, help would be appreciated.
I'm on ubuntu.
It appears your installation can't find the pip provider, rather than it not being able to find the pip executable.
I'm guessing the provider you mentioned is this one:
https://github.com/rcrowley/puppet-pip
Couple of things that might not be clear:
The plugin needs to be available on the puppet clients
Just installing the Gem won't do it for you, hence the manual env setting in the README
Probably the easiest approach is to include the puppet-pip provider in your puppet repo as a separate module, and then enable pluginsync, i.e.
[main]
pluginsync = true
More details here http://docs.puppetlabs.com/guides/plugins_in_modules.html
It looks like pip provider is not available in puppet pre 2.7 without downloading an external provider. Are you using 2.7 or higher?