[ansible-project] Help me please. How can I get the output of the command?

2018-05-14 Thread Josu Vilda
Hi guys, I am launching this playbook but it does not give an error and it does not do what it is supposed to do. How can I debug the error? - name: Customize Domain vmware_vm_shell: hostname: '{{ VCENTER }}' username: '{{ DOMAIN_VCENTER }}\user' password: '*

Re: [ansible-project] Help me please. How can I get the output of the command?

2018-05-14 Thread Karl Auer
It would help if you would describe what it is supposed to do... On Mon, May 14, 2018 at 9:38 PM, Josu Vilda wrote: > Hi guys, > I am launching this playbook but it does not give an error and it does not > do what it is supposed to do. > How can I debug the error? > > - name: Customize Domai

Re: [ansible-project] Help me please. How can I get the output of the command?

2018-05-14 Thread Josu Vilda
This module, should launch the following command which join the vmware in domain. Launch in host vmware 'c:\windows\system32\wbem\wmic.exe ComputerSystem where name={{ NOMBRE }} call joindomainorworkgroup fjoinoptions=3 name={{ DOMINIO }}' *Josu Rodriguez Vilda* Consultant Skype:jrvilda P Befo

[ansible-project] Re: Whats the right way to protect a backup script in windows?

2018-05-14 Thread pixel fairy
this seems to work. seems the easiest way to "clear" existing permissions to start over by disabling the inherited permissions. a normal user cant list and gets access denied if they try to open a specific file that they know the path to. an admin can do anything. am i missing anything? is there

Re: [ansible-project] Help me please. How can I get the output of the command?

2018-05-14 Thread Josu Vilda
The problem is that I do not know where to see the error that the command gives. El lunes, 14 de mayo de 2018, 13:49:17 (UTC+2), Josu Vilda escribió: > > This module, should launch the following command which join the vmware in > domain. > > Launch in host vmware 'c:\windows\system32\wbem\wmic

Re: [ansible-project] Help me please. How can I get the output of the command?

2018-05-14 Thread Josu Vilda
TASK [debug var=value, verbosity=3] * task path: /etc/ansible/playbooks/vCenter/Despliegue.yml:169 ok: [localhost] => { "value": { "ansible_job_id": "971027648920.50828", "changed": true,

[ansible-project] Re: "requests_ntlm is not installed", when it appears to be in place

2018-05-14 Thread Ab Generette
Ok, Here's what I got, so, I'll see what I can find on the module mentioned: MacBook-Pro:playbooks anthony$ python -c "from requests_ntlm import HttpNtlmAuth" Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.7/site-packages/requests_ntlm/__init__.py", line 1,

[ansible-project] Re: "requests_ntlm is not installed", when it appears to be in place

2018-05-14 Thread Ab Generette
'Looks like the system sees it as already being installed: MacBook-Pro:playbooks anthony$ pip2.7 install pycrypto Requirement already satisfied (use --upgrade to upgrade): pycrypto in /Library/Python/2.7/site-packages Cleaning up... On Monday, May 14, 2018 at 10:22:05 AM UTC-4, Ab Generette wr

[ansible-project] Ansible not recognizing correct pexpect module?

2018-05-14 Thread ZillaYT
$ ansible --version ansible 2.4.0.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/home/scscm_builder/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python2.7/site-packages/ansible-2.4.0.0-py2.7.

[ansible-project] Re: Ansible not recognizing correct pexpect module?

2018-05-14 Thread ZillaYT
I meant to say "I'm trying to use the "expect" module in ansible..." On Monday, May 14, 2018 at 11:35:43 AM UTC-4, ZillaYT wrote: > > $ ansible --version > ansible 2.4.0.0 > config file = /etc/ansible/ansible.cfg > configured module search path = > [u'/home/scscm_builder/.ansible/plugins/modu

Re: [ansible-project] Re: Ansible not recognizing correct pexpect module?

2018-05-14 Thread Brian Coca
It requires it on the machine and python the module executes on, use -vvv to verify you are matching both, by default the implicit localhost should ensure that they are the same as you expect, but if you added localhost to your inventory you might be using a different python http://docs.ansible.com

Re: [ansible-project] Re: Ansible not recognizing correct pexpect module?

2018-05-14 Thread ZillaYT
Thanks Brian. I should've indicated that I'm running this on localhost $ ansible-playbook -i "localhost," test-expect.yml I added the ansible_python_interpreter: python2.7 in my playbook and it worked for now. For some reason, this "{{ ansible_playbook_python }}" didn't work for me, but I'll

Re: [ansible-project] Re: Ansible not recognizing correct pexpect module?

2018-05-14 Thread Brian Coca
The -i 'localhost,' is probably what is causing the issue as you are defining localhost, see the docs i linked in previous message for a full explanation. -- -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubs

[ansible-project] How to handle multi-line prompts with expect module?

2018-05-14 Thread ZillaYT
Per https://groups.google.com/forum/#!topic/ansible-project/AXEPsAqxmNE I'm using the expect module, and have it working when the prompt is single line. How do I make it work when the prompt is multi-line? I'm not talking about multi-prompts. Let me explain. ansible v2.4.0.0 I'm trying to aut

Re: [ansible-project] How to handle multi-line prompts with expect module?

2018-05-14 Thread Kai Stian Olstad
On 14.05.2018 19:02, ZillaYT wrote: Per https://groups.google.com/forum/#!topic/ansible-project/AXEPsAqxmNE I'm using the expect module, and have it working when the prompt is single line. How do I make it work when the prompt is multi-line? I'm not talking about multi-prompts. Let me explain

Re: [ansible-project] How to handle multi-line prompts with expect module?

2018-05-14 Thread ZillaYT
This helped some, but brought up the next issue. The keytool command has multiple multi-lined prompts, with "[Unknown]" as the second line, so if I do this tasks: - name: Test expect expect: timeout: 5 echo: yes command: keytool -genkey -alias tomcat -keyalg RSA -sigalg

Re: [ansible-project] How to handle multi-line prompts with expect module?

2018-05-14 Thread ZillaYT
Thanks Kai. Your comment "Expect is just looking a a stream of bytes" gave me the idea to just look for a "string of bytes" that's present in each prompt. The following now works. - name: Test expect expect: timeout: 5 echo: yes command: keytool -genkey -alias tomcat -key

[ansible-project] Best way to run Python scripts against Managed Cygwin nodes

2018-05-14 Thread Ab Generette
I have a CentOS7 control server from which I am trying to manage a few Server2012/Cygwin nodes. Those latter nodes have Cygwin setup such that its sshd component is installed and running (I'm able to successfully ssh to the targets). My ~/.ansible.cfg is the active one and this file contains

[ansible-project] Re: "requests_ntlm is not installed", when it appears to be in place

2018-05-14 Thread Jordan Borean
Pycrypto is not the same as cryptography, the package is literally called cryptography and should be installed. Thanks Jordan -- 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,

[ansible-project] Re: "requests_ntlm is not installed", when it appears to be in place

2018-05-14 Thread Ab Generette
I'm still getting the same error: (ansible) MacBook-Pro:playbooks anthony$ ansible wrk04 -e @~/.ansible/secure.yml -m win_ping --ask-vault-pass Vault password: wrk04 | UNREACHABLE! => { "changed": false, "msg": "ntlm: requested auth method is ntlm, but requests_ntlm is not installed",

[ansible-project] Re: "requests_ntlm is not installed", when it appears to be in place

2018-05-14 Thread Jordan Borean
Are you still getting the import error when trying to manually import cryptography, you need to solve that first before using Ansible. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails f

[ansible-project] Re: Best way to run Python scripts against Managed Cygwin nodes

2018-05-14 Thread Jordan Borean
I'm a bit confused, do you need to use Cygwin to run this script, everything would be so much simpler if you ignored Cygwin and used something like PowerShell or pure Python? For your current playbook there are a few issues I see; - Windows modules, like win_template, do not support the mode

[ansible-project] Re: "requests_ntlm is not installed", when it appears to be in place

2018-05-14 Thread Ab Generette
No, I'm no longer seeing the error on attempt to manually import cryptography. On Monday, May 14, 2018 at 3:44:41 PM UTC-4, Jordan Borean wrote: > > Are you still getting the import error when trying to manually import > cryptography, you need to solve that first before using Ansible. > -- You

Re: [ansible-project] How to handle multi-line prompts with expect module?

2018-05-14 Thread Kai Stian Olstad
On 14.05.2018 20:31, ZillaYT wrote: This helped some, but brought up the next issue. The keytool command has multiple multi-lined prompts, with "[Unknown]" as the second line, so if I do this tasks: - name: Test expect expect: timeout: 5 echo: yes command: keytool -g

[ansible-project] Re: "requests_ntlm is not installed", when it appears to be in place

2018-05-14 Thread Jordan Borean
What about import requests_ntlm? If that works but Ansible doesn't it sounds like Ansible is using a different Python interpreter to the one you tested on. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and s

[ansible-project] Re: Best way to run Python scripts against Managed Cygwin nodes

2018-05-14 Thread Ab Generette
Thanks, Jordan. Ok, I believe I see what you mean. I only went down this convoluted path involving the script and all, because of other problems that I ran into. Changing that playbook to: --- - hosts: "{{ targets }}" user: "{{ admin }}" gather_facts: yes vars: python_exec: /cygdri

[ansible-project] Re: "requests_ntlm is not installed", when it appears to be in place

2018-05-14 Thread Ab Generette
Does this shed any light(?): (ansible) MacBook-Pro:playbooks anthony$ ansible wrk04 -e @~/.ansible/secure.yml -m win_ping --ask-vault-pass Vault password: wrk04 | UNREACHABLE! => { "changed": false, "msg": "ntlm: requested auth method is ntlm, but requests_ntlm is not installed", "un

[ansible-project] Re: "requests_ntlm is not installed", when it appears to be in place

2018-05-14 Thread Jordan Borean
Looks like the python on your PATH is at /Users/anthony/ansible/bin/python but the Ansible command is on /Library/Python/2.7 which is different. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receivin

[ansible-project] Re: Best way to run Python scripts against Managed Cygwin nodes

2018-05-14 Thread Jordan Borean
Hmm, looks like your host vars isn't matching which what I expect, it is actually connecting over SSH and not WinRM when your original post said you defined ansible_connection: winrm. Is there a reason why you are using SSH/Cygwin on Windows, we don't support it currently as a valid configurati

[ansible-project] Standard Ansible Loop Script not working

2018-05-14 Thread Carlton Patterson
Hello community, I have written the following ansible script --- # Playbook file: loopplay.yml - name: loopplay hosts: centos2 tags: - loopplay tasks: - name: looptask user: name: "{{ item }}" state: present

Re: [ansible-project] Standard Ansible Loop Script not working

2018-05-14 Thread Brian Coca
don't offset from list item: # Playbook file: loopplay.yml - name: loopplay hosts: centos2 tags: - loopplay tasks: - name: looptask user: name: "{{ item }}" state: present groups: "wheel" loop:

[ansible-project] File copy/Create folder on Windows server based upon json output from Powershell

2018-05-14 Thread java_cat33
Firstly - sorry for the noob question. I've written a Powershell script that is run from a play that returns in json the name of a zip file. Output from Powershell { "Name": "latest-ansible v0.1.zip" } ***playbook*** --- - hosts: all vars: filename: none tasks: - name: I

[ansible-project] Re: Help me please. How can I get the output of the command?

2018-05-14 Thread Josh Smift
Why are you setting "verbosity: 3"? According to http://docs.ansible.com/ansible/latest/modules/debug_module.html, that means "if you set to 3 it will only run debug when -vvv or above". That's causing Ansible to skip the task, thus the message you're seeing ("Verbosity threshold not met"). Re

[ansible-project] Re: File copy/Create folder on Windows server based upon json output from Powershell

2018-05-14 Thread Jordan Borean
The issue you are seeing is that you are using the stdout_lines return value which is the stdout of the script that was run but split into a list on each newline. You want to use the stdout return value from the script which would be the full stdout of your json. The task's would look something

[ansible-project] Re: File copy/Create folder on Windows server based upon json output from Powershell

2018-05-14 Thread java_cat33
Thanks Jordan! That code worked a treat - really appreciate your assistance and detailed explanations below. On Tuesday, May 15, 2018 at 12:58:42 PM UTC+12, java_cat33 wrote: > > Firstly - sorry for the noob question. > > I've written a Powershell script that is run from a play that returns in >

[ansible-project] Re: File copy/Create folder on Windows server based upon json output from Powershell

2018-05-14 Thread java_cat33
Jordan do you know how to strip the ".zip" off the file name? I've been looking at http://jinja.pocoo.org/docs/2.10/templates/#truncate but haven't cracked it yet. On Tuesday, May 15, 2018 at 2:17:32 PM UTC+12, java_cat33 wrote: > > Thanks Jordan! That code worked a treat - really appreciate you

[ansible-project] Re: File copy/Create folder on Windows server based upon json output from Powershell

2018-05-14 Thread Jordan Borean
Hey There are a few ways to do this, they usually revolve around using filters to "filter" the value into something else. Ansible has a few filters available outside of the standard Jinja2 functions which can be found here https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.htm

[ansible-project] Re: File copy/Create folder on Windows server based upon json output from Powershell

2018-05-14 Thread java_cat33
Nice - thanks Jordan. That's easier than what I've just done win_file: path: C:\inetpub\{{ script_filename.Name | regex_replace('.zip$','') }} Thanks again! On Tuesday, May 15, 2018 at 3:56:20 PM UTC+12, Jordan Borean wrote: > > Hey > > There are a few ways to do this, they usually re

[ansible-project] Re: win_disk_facts - get size and size remaining

2018-05-14 Thread Jeremie Levy
I found how to loop over the data, but i still didn't figure out how to select inside specific data - name: test 1 debug: msg: "{{ item.key }}" with_dict: "{{ ansible_disks }}" Got: ok: [hostname] => (item=None) => {

[ansible-project] Need help in updating /etc/grub.conf file to disable THP in linux server using Ansible

2018-05-14 Thread Padmesh Singh
I need help in updating /etc/grub.conf file to disable THP in Linux servers. I used below Ansible lineinfile module but it updates the kernel line everytime when I run it, I need which runs and updates every line of kernel in /etc/fstab file. Please suggest. name: disable THP (RedHat) lineinf

Re: [ansible-project] Need help in updating /etc/grub.conf file to disable THP in linux server using Ansible

2018-05-14 Thread Richard Hector
On 15/05/18 18:23, Padmesh Singh wrote: > I need help in updating /etc/grub.conf file to disable THP in Linux servers. > I used below Ansible lineinfile module but it updates the kernel line > everytime when I run it, I need which runs and updates every line of kernel > in /etc/fstab file. Pleas