[ansible-project] Re: Copy files from windows machine to linux machine using ansible

2016-04-25 Thread Mick st john
I used flat=yes and the issue is now resolved. Thank you! On Tuesday, April 26, 2016 at 9:43:06 AM UTC+5:30, Mick st john wrote: > > I did some changes and it worked. But, the whole directory is getting > created on the linux machine which has the desired file. > > > On Tuesday, April 26, 2016

[ansible-project] Re: Copy files from windows machine to linux machine using ansible

2016-04-25 Thread Mick st john
I did some changes and it worked. But, the whole directory is getting created on the linux machine which has the desired file. On Tuesday, April 26, 2016 at 9:34:12 AM UTC+5:30, Mick st john wrote: > > I tried the following playbook: > > --- > - hosts: windows > tasks: > - name: copy fi

[ansible-project] Re: Copy files from windows machine to linux machine using ansible

2016-04-25 Thread Mick st john
I tried the following playbook: --- - hosts: windows tasks: - name: copy file fetch: src=\path\to\file\on\windows\machine dest=/destination/directory But, somehow it failed. Am I doing it the wrong way? On Monday, April 25, 2016 at 8:24:58 PM UTC+5:30, J Hawkesworth wrote: > > Fe

[ansible-project] Re: How to i get list of all hosts in playbook_on_task_start ?

2016-04-25 Thread Ritesh Shetty
play.hosts works ! On Monday, April 25, 2016 at 1:17:16 PM UTC-7, Ritesh Shetty wrote: > > I used to have this code in ansible 1.x > > def playbook_on_task_start(self, name, is_conditional): > > play = getattr(self, 'play', None) > task = getattr(self, 'task', None) > > if

Re: [ansible-project] Ansible command to get the ethtool information

2016-04-25 Thread Mahendra
Hello Kai, Thanks for the update.. yes it works as root.. And I have used "-s" option .. ansible root# ansible all -m shell -a "/sbin/ethtool eth4" -s SSH password: SUDO password[defaults to SSH password]: xxx.example.com | success | rc=0 >> Settings for eth4: Current message level: 0x

[ansible-project] SVN Module Error

2016-04-25 Thread molnar
Hello, I'm trying to use the svn core module to checkout/update a svn project. My understanding is that this module will checkout or update the svn project depending on whether it exists in the dest folder. Also what is standard practice for handling svn passwords? I don't believe it would be

Re: [ansible-project] user.state

2016-04-25 Thread Brian Coca
so the var you are looking for does not exist in the first place, where are you setting them? ​in any case the following should skip those errors:​ when: ​item|basename in ​hostvars[inventory_hostname] and ​ hostvars[inventory_hostname][item|basename]['user']['state'] == "present" -- Br

Re: [ansible-project] user.state

2016-04-25 Thread Jameson
On Mon, Apr 25, 2016 at 4:32 PM Brian Coca wrote: > don't use {{ }} in when, its already implied, you'll get weird results, > also if present is not a var, it should be quoted, again, double > interpolation does not work. > > when: hostvars[inventory_hostname][item|basename]['user']['state'] ==

Re: [ansible-project] user.state

2016-04-25 Thread Brian Coca
don't use {{ }} in when, its already implied, you'll get weird results, also if present is not a var, it should be quoted, again, double interpolation does not work. when: hostvars[inventory_hostname][item|basename]['user']['state'] == "present" -- Brian Coca -- You received this mess

[ansible-project] How to i get list of all hosts in playbook_on_task_start ?

2016-04-25 Thread Ritesh Shetty
I used to have this code in ansible 1.x def playbook_on_task_start(self, name, is_conditional): play = getattr(self, 'play', None) task = getattr(self, 'task', None) if play is not None and task is not None: for host in play._play_hosts: print

Re: [ansible-project] Ansible Not Using `ansible_become_pass` Variable

2016-04-25 Thread Chad Sheets
Thank you very much Brian, moving encrypted.yml into "host_vars/{{inventory_hostname}}/" fixed my issue. ansible_become_pass is now imported and available for all my plays. I'm sure what I was doing before was bad form, but it's strange that it works fine in Ansible 1.9.4 but not now. What I m

Re: [ansible-project] user.state

2016-04-25 Thread Jameson
On Mon, Apr 25, 2016 at 3:39 PM Brian Coca wrote: > not really, you probably want this: > > when: hostvars[inventory_hostname][item]['user']['state'] == 'present' > > > in yours you are conflating 'present' which is a string with variables and > then trying to 'double interpolate' neither of whic

Re: [ansible-project] Ansible Not Using `ansible_become_pass` Variable

2016-04-25 Thread Brian Coca
Also, you should not need to import these files, the first should already be loaded automatically (ansible aways matches hostname inside host_vars). A way to have both autoloaded is: host_vars/{{inventory_hostname}}/clear.yml host_vars/{{inventory_hostname}}/encyrpted.yml as it will match the di

Re: [ansible-project] Ansible Not Using `ansible_become_pass` Variable

2016-04-25 Thread Johannes Kastl
On 25.04.16 19:21 Chad Sheets wrote: > > My playbook was structured as follows: > I'm a little bit confused by your playbook. To me as an unexperienced user it looks like two playbooks put into the same file. Also you are mixing tasks with roles, I have no idea if this is expected to work. What

Re: [ansible-project] user.state

2016-04-25 Thread Brian Coca
not really, you probably want this: when: hostvars[inventory_hostname][item]['user']['state'] == 'present' in yours you are conflating 'present' which is a string with variables and then trying to 'double interpolate' neither of which will work. ​ -- Brian Coca -- You received this mes

[ansible-project] Weird idempotency issue with 2.0.2.0 on ec2_vpc module

2016-04-25 Thread Joseph Djomeda
Hello Guys, I just upgraded and quickly got caught up with a weird issue with the ec2_vpc. It's a existing playbook and worked fine. The weird part is that the playbook works fine the first type but give this error the subsequent times: "An exception occurred during task execution. To see the fu

[ansible-project] user.state

2016-04-25 Thread Jameson
Is it currently possible to have a conditional like: when: "{{ item }}.user.state == present" Thanks. -- Jameson -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email

[ansible-project] win_ping Name or service not known

2016-04-25 Thread skinnedknuckles
Centos 7 Ansible 2.1 Windows 7 on remote node My inventory file (/etc/ansible/hosts) contains... [windows] 123.123.123.123.mycompany.com My /etc/ansible/group_vars/windows.yml file contains... ansible_user: username ansible_password: password ansible_port: 5985 ansible_connection: winrm ansible_

[ansible-project] app namespacing in ansible

2016-04-25 Thread V Kurien
Hi Hopefully this is not too much of a FAQ. I was looking for a pattern for app instance deployment in ansible: 1. A user wants to deploy an instance of an app that runs across multiple VMs - a Hadoop cluster is a canonical example. 2. The user specifies the hardware shape of the VMs e

Re: [ansible-project] Ansible Not Using `ansible_become_pass` Variable

2016-04-25 Thread Chad Sheets
Using Ansibles exact command on the remote machine doesn't prompt for a password at the terminal due to the flags passed to sudo. I am able to escalate using sudo on the remote machine when ssh'ed in as ansibles user. I've actually made some progress since I submitted the post. I guess there wa

Re: [ansible-project] Ansible Not Using `ansible_become_pass` Variable

2016-04-25 Thread Chad Sheets
Using Ansibles exact command on the remote machine doesn't prompt for a password at the terminal due to the flags passed to sudo. I am able to escalate using sudo on the remote machine when ssh'ed in as ansibles user. I've actually made some progress since I submitted the post. I guess there wa

[ansible-project] Do not run ansible-upstart

2016-04-25 Thread Fernando Cagale
Hello I'm doing a test with ansible using the "upstart", but is not run "upstart exec path". Below example api.yml. Does anyone have any idea why you're not running? He did not start my Node.js API. {{app_path}} = /var/app/cart {{app_bin}} = index.js {{http_host}} = 127.0.0.1 {{http_port}} =

Re: [ansible-project] block in file with loop

2016-04-25 Thread Johannes Kastl
On 25.04.16 11:24 bala krishna wrote: > I was trying to create service configuration file using above playbook but > it's been failing. Can someone guide me on this Care to tell us the exact error? "failing" can mean lots of things. Does "ansible-playbook --syntax-check yourplaybook.yml" bring

Re: [ansible-project] Ansible Not Using `ansible_become_pass` Variable

2016-04-25 Thread Johannes Kastl
On 25.04.16 04:12 Chad Sheets wrote: > I can confirm ssh'ing into Remote-Computer and running only `sudo -H -S -n > -u root /bin/sh -c` returns the "sudo: a password is required" message. What happens when you enter your password at the prompt you get when manually calling the command? Does it w

[ansible-project] Re: Copy files from windows machine to linux machine using ansible

2016-04-25 Thread 'J Hawkesworth' via Ansible Project
Fetch can also fetch from windows machines back to your ansible controller machine. If you are fetching from > 1 windows box don't forget to fetch to a directory, or use something like {{ inventory_hostname_short }} when generating the file name. Hope this helps, Jon On Monday, April 25, 20

[ansible-project] Re: read a file .CSV from ansible

2016-04-25 Thread 'J Hawkesworth' via Ansible Project
How about the csv lookup plugin? http://docs.ansible.com/ansible/playbooks_lookups.html#the-csv-file-lookup You can write content to a file by registering a variable and then using the content argument with the copy module. Hope this helps, Jon On Monday, April 25, 2016 at 3:22:17 PM UTC+1, m

[ansible-project] Re: Inventory: ERROR! non-essential-servers.py:2: Expected key=value host variable assignment, got: ldap3

2016-04-25 Thread 'J Hawkesworth' via Ansible Project
Actually... I'd been meaning to create dynamic inventory script myself, so I had a go based on your code above (many thanks). You might need a #! at the top of the script (looking at some of the other examples) #!/usr/bin/env python # -*- coding: utf-8 -*- Only other thing I had to do was rem

[ansible-project] read a file .CSV from ansible

2016-04-25 Thread mondher khas
hello , i need to read some value from a .CSV file with ; separator for example : param1;value1 param2;value2 i want to write them in a file using ansible like this : param1=value1 param2=value2 thank

[ansible-project] Re: Ansible can't connect using the public DNS provided by AWS, but it can connect with the IP addr.

2016-04-25 Thread Arbab Nazar
Are you able to ssh to the desired host? Although it's not relevant but still can try, I have a problem with it in the past: Edit ansible.cfg [ssh_connection]control_path = %(directory)s/%%h-%%r But first thing is to check the ssh connection to the remote host. On Monday, April 25, 2016 at

[ansible-project] Copy files from windows machine to linux machine using ansible

2016-04-25 Thread Mick st john
I trying to copy files from a remote windows machine to my local machine(linux machine) using ansible. As fetch module works for linux to linux file transfer, is there anything similar that could enable me to fetch files from windows machine to linux machine? -- You received this message becau

Re: [ansible-project] Ansible.runner not found

2016-04-25 Thread Brian Coca
The API has changed a lot in >=2.x, runner was broken apart into many classes. Check API docs http://docs.ansible.com/ansible/developing_api.html. -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from thi

Re: [ansible-project] Utilizing timestamps within filenames

2016-04-25 Thread Matt Martz
Also, just as an FYI, this can be achieved without calling the date command: --- - hosts: all tasks: - set_fact: datestamp: "{{ ansible_date_time.date }}" timestamp: "{{ '%s.%s%s'|format(ansible_date_time.date, ansible_date_time.hour, ansible_date_time.minute) }}" - debu

[ansible-project] Ansible.runner not found

2016-04-25 Thread Chechu Santander
hey guys, I'm trying to create an ansible script with python to launch some playbooks, but when I try to import ansible.runner, I got the library missing Traceback (most recent call last): File "./test_ansible.py", line 2, in import ansible.runner ImportError: No module named runner ans

Re: [ansible-project] Utilizing timestamps within filenames

2016-04-25 Thread Joe Louthan
That's it! Thank you! To avoid being "that guy", here is the working playbook: --- - hosts: dbserver remote_user: jlouthan tasks: - name: Get current timestamp local_action: command bash -c 'date +%Y-%m-%d.%H%M' # Consider switch this to a shell module with date command

[ansible-project] Re: Inventory: ERROR! non-essential-servers.py:2: Expected key=value host variable assignment, got: ldap3

2016-04-25 Thread 'J Hawkesworth' via Ansible Project
Looks to me like its not running your script, just trying to parse it as a static inventory file. Did you set your non-essential-servers.py script to be executable? Looking here: http://docs.ansible.com/ansible/intro_dynamic_inventory.html#using-inventory-directories-and-multiple-inventory-sou

[ansible-project] Re: Ansible still able to connect to windows host even after the certificates has expired

2016-04-25 Thread 'J Hawkesworth' via Ansible Project
Hi, You can create / install a new certificate and then use winrm to use the new certificate using a command like this: winrm set winrm/config/listener?Address=IP:8.8.8.8+Transport=HTTPS @{Hostname="mydomain.com";CertificateThumbprint=" CB7434F35E3EA11D49D209F41BB16E96B472D30E";Port="5986"} Yo

[ansible-project] Ansible can't connect using the public DNS provided by AWS, but it can connect with the IP addr.

2016-04-25 Thread Santiago Basulto
This issue is strange. If I use the public DNS provided by AWS, Ansible fails to connect (see error report below). But if I use the IP address it can connect and everything works. Just to make sure, I can ssh into it (using either the IP or public DNS) without issues (providing the same usern

[ansible-project] Re: Windows_error_401_Unauthorized. basic auth failed

2016-04-25 Thread 'J Hawkesworth' via Ansible Project
Hello, Make sure you have gone through all the set up steps Installing the extra components you need on the ansible controller: http://docs.ansible.com/ansible/intro_windows.html#installing-on-the-control-machine Modifying your ansible inventory / group_vars with windows-specific settings: ht

[ansible-project] Re: need to detect if a service/daemon is running or not

2016-04-25 Thread Edgars
If firewalld then you are using systemd and then it is as simple as: systemctl is-active firewalld Edgars piektdiena, 2016. gada 22. aprīlis 18:07:51 UTC+2, Jerome Yanga rakstīja: > > I am trying to determine if iptables/firewalld is running or not. If the > service/daemon is not running, I w

Re: [ansible-project] How to stop Ansible from cleaning up temporary files?

2016-04-25 Thread Matt Martz
ANSIBLE_KEEP_REMOTE_FILES=1 ansible-playbook - ... On Monday, April 25, 2016, Howard Guo wrote: > Hello! > > I am debugging an Ansible playbook that throws an obscure error, the > command from "-" output looks totally sane, but the SSH command does > not carry useful information, it only

[ansible-project] Ansible Not Using `ansible_become_pass` Variable

2016-04-25 Thread Chad Sheets
Hi Everyone, I recently installed a new Ansible host (Ubuntu Xenial, upgrading ansible from 1.9.4 to 2.0.0.2 in the process) and I can't get the new host to use the `ansible_become_pass` variable. My plays always start by importing an ansible-vault encrypted file in which `ansible_become_pass`

[ansible-project] Windows_error_401_Unauthorized. basic auth failed

2016-04-25 Thread sadaa . 19990
hi is there anyone can help me ! I'm trying to connect to windows machine . ( windows 10) I get this error "401_Unauthorized. basic auth failed" i use ubuntu 14.04 as controller machine ! ansible version 1.9.1 -- You received this message because you are subscribed to the Google Groups

[ansible-project] 401_Unauthorized. basic auth failed

2016-04-25 Thread sadaa . 19990
Hi ! is there anyone can help me l get this errors when I tried to connect to my machine Windows 10 *401 Unauthorized. basic auth failed* I use Ubuntu 14.04 as controller machine -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscr

[ansible-project] How to stop Ansible from cleaning up temporary files?

2016-04-25 Thread Howard Guo
Hello! I am debugging an Ansible playbook that throws an obscure error, the command from "-" output looks totally sane, but the SSH command does not carry useful information, it only invokes a temporary script locaed in ~/.ansible/tmp. Unfortunately, when Ansible comes back with the error,

[ansible-project] Escaping Json String

2016-04-25 Thread ben
In version 2.0.2.0 (in version 2.0.0.2 it works fine) In a local action I'm generating the following json object https://gist.github.com/thebenwaters/7795d1cdead9280e0c5abcbc23b9ca59 Then registering it to standard out it looks like so: https://gist.github.com/thebenwaters/5299d3d9986985697ae87

[ansible-project] block in file with loop

2016-04-25 Thread bala krishna
Hi, I am trying to write ansible playbook for Nagios client installation and configuration. - name: untar Plugin Zip file to libexec directory command: mount | grep -v "rootLV" | grep ext4 | awk '{print $3}' register: dirlist - name: create Nagios Host ServiceConfig file blockinfil

[ansible-project] Inventory: ERROR! non-essential-servers.py:2: Expected key=value host variable assignment, got: ldap3

2016-04-25 Thread Jared Jenkins
Hello all, I'm new to python and ansible in general. I feel like I can't use this unless I plug into AD. I spent a great deal of time trying to learn python for a dynamic inventory and I'm completely stumped. The json seems to check out with the doc almost exact. I'm running ansible from os x u

Re: [ansible-project] Simple task breaks with version 2.0.2.0

2016-04-25 Thread Jürgen Haas
Also reported this in the issue queue: https://github.com/ansible/ansible/issues/15572 Looks like there is a broader issue. Am Montag, 25. April 2016 08:21:30 UTC+2 schrieb Jürgen Haas: > > Has anyone else had this issue as well? Looks to be that version_compare() > is completely broken. @Brian

[ansible-project] Re: Ansible still able to connect to windows host even after the certificates has expired

2016-04-25 Thread ishan jain
Hi J, Thanks for all the help. Actually it turned out that somebody already executed the script on the new machine with 365 days period before i did it for 3 days, that is why it was able to connect. I did not specify anything like ansible_winrm_server_cert_validation. I am very new to windows

[ansible-project] Re: Ansible still able to connect to windows host even after the certificates has expired

2016-04-25 Thread 'J Hawkesworth' via Ansible Project
Have a read through the bug report above (which I have now closed). Do you have the following set in your windows inventory/ group vars: ansible_winrm_server_cert_validation: ignore as described in; http://docs.ansible.com/ansible/intro_windows.html#inventory If so the certificate is complet