[ansible-project] Re: vmotion condition

2020-05-15 Thread Mani
Can we invoke any script to capture the memory and datastore utilization?

On Thursday, 30 April 2020 00:26:53 UTC+5:30, Mani wrote:
>
> I am trying to perform vmotion of multiple VMs between 2 ESXi hosts using 
> the vmare_vmotion module. We need to set a cap for memory utilization of 
> the destination host to <= 70% and the storage utilization to <= 90%. 
>
> Required result: VMs have to be migrated until the memory and storage 
> utilization has reached. The loop should stop VM migration once the memory 
> & storage threshold has reached.
>
> - name: Perform storage vMotion and host vMotion of virtual machine
>   vmware_vmotion:
> hostname: "{{ running_host }}"
> username: "{{ esxi_user }}"
> password: "{{ esxi_pass }}"
> validate_certs: no
> vm_name: "{{ item.guest_name }}"
> destination_host: "{{ destination_host }}"
> destination_datastore: "{{ item.name }}"
>   delegate_to: localhost
>   with_nested:
> - "{{vm_info.virtual_machines}}"
> - "{{ansible_datastore}}"
>
> Any inputs is highly appreciated.
>

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a618aa95-c716-4b3a-a8fe-c16c3ac2d3a6%40googlegroups.com.


[ansible-project] Re: winrm http port 5985

2020-05-15 Thread Jordan Borean
If only 5986 is working then it sounds like message encryption is being 
disabled for NTLM or is just unavailable (older libraries are installed). 
If you already have HTTPS working then you should just continue to use 
that. It provides more security benefits especially compared to NTLM over 
port 5985.

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1f14526c-6b3d-4821-b4d2-39388adca783%40googlegroups.com.


[ansible-project] Re: kerberos

2020-05-15 Thread Jordan Borean
Kerberos is highly dependent on DNS from working. With Kerberos the client 
builds an SPN in the format 'HTTP/, in your case that will 
be 'HTTP/10.50.1.231'. Active directory only creates automatic SPNs using 
the DNS name of a host, i.e. 'HTTP/hostname.domain.com' so that's the SPN 
that needs to be specified by the Ansible client for Kerberos auth to work.

TLDR you can do on of the following in order of preference

   - Connect to Ansible using the FQDN of the host and not the IP. This 
   will construct the proper SPN
   - Continue connecting using the IP but set 
   'ansible_winrm_kerberos_hostname_override: '
   - Create the SPN in AD for 'HTTP/' for the host you are 
   connecting to

The first option is really the only sane way going forward as you don't 
need to maintain 2 sets of data for the Windows host. If you have Kerberos 
set up correctly in your org then DNS should work just fine and you don't 
have to worry about IP addresses at all.

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5d3223f4-729b-42d6-b221-f3bfb8baeae8%40googlegroups.com.


Re: [ansible-project] Is there a better way to search through a list using when and regex_search

2020-05-15 Thread Vladimir Botka
On Fri, 15 May 2020 08:25:40 -0700 (PDT)
Scott Fella  wrote:

> ... The changes works well, except when there is a host that has failed

FWIW. See how to create a group of reachable hosts first.
https://github.com/vbotka/ansible-lib/blob/master/tasks/al_hosts_reachable.yml

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200515231137.19f108ad%40gmail.com.


pgpuz8HfEbffa.pgp
Description: OpenPGP digital signature


[ansible-project] Re: kerberos

2020-05-15 Thread Tony Wong
ok I got kerberos working now. but only via port 5986

why is that?

On Friday, May 15, 2020 at 12:58:37 PM UTC-7, Tony Wong wrote:
>
> trying to get kerberos to work . I got all the libraries and krb5.conf 
> file setup. I got a ticket from klist but when i do win_ping
>
> I get errors
>
>
> ansible windows -i hosts -m win_ping
> 10.50.1.231 | UNREACHABLE! => {
> "changed": false,
> "msg": "kerberos: authGSSClientStep() failed: (('Unspecified GSS 
> failure.  Minor code may provide more information', 851968), ('Server not 
> found in Kerberos database', -1765328377))",
> "unreachable": true
> }
> 10.200.1.31 | UNREACHABLE! => {
> "changed": false,
> "msg": "kerberos: authGSSClientStep() failed: (('Unspecified GSS 
> failure.  Minor code may provide more information', 851968), ('Server not 
> found in Kerberos database', -1765328377))",
> "unreachable": true
> }
>
>
>
>
>
>
>
> my group_vars file
>
>
>
> ansible_user: 's...@domain.com'
> ansible_port: 5985
> ansible_connection: 'winrm'
> ansible_winrm_server_cert_validation: 'ignore'
> ansible_winrm_transport: 'kerberos'
> ansible_become: false
>
>
>
> any idea
>

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/256a1cfc-efc4-4d58-b55c-26314ab286ec%40googlegroups.com.


[ansible-project] Re: winrm http port 5985

2020-05-15 Thread Tony Wong
it only works with https over 5986

if I change it to ntlm

ansible_user: 'administrator'
ansible_password: 'xxx'
ansible_port: 5986
ansible_connection: 'winrm'
ansible_winrm_server_cert_validation: 'ignore'
ansible_winrm_transport: 'ntlm'


then it works

its not a firewall issue either since I can telnet to port 5985 on the 
windows machine

On Friday, May 15, 2020 at 12:58:49 PM UTC-7, Jordan Borean wrote:
>
> You need to figure out why it's failing, we have a page for dealing with 
> rejected credentials 
> https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html#http-401-credentials-rejected
> *.*
>

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c9b900c5-888a-4b55-a11b-e875084a60ff%40googlegroups.com.


Re: [ansible-project] facing the problem in mapping network drive

2020-05-15 Thread Jordan Borean
So the drive mapping is present but Windows is unable to map the drive on 
logon. You can use the win_credential [1] to store a credential that 
Windows will use for mapped drives. There's even an example of this in the 
win_mapped_drive [2] docs. If you are running the net use command through 
Ansible and expecting to see that mapped drive available then you are out 
of luck. Mapped drives are only for use with interactive logons and not for 
use in Ansible, Ansible can only manage the mappings but not use them.

[1] 
https://docs.ansible.com/ansible/latest/modules/win_credential_module.html
[2] 
https://docs.ansible.com/ansible/latest/modules/win_mapped_drive_module.html

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d013a3e5-d5d0-4aa9-b809-7850cee84167%40googlegroups.com.


[ansible-project] Re: winrm http port 5985

2020-05-15 Thread Jordan Borean
You need to figure out why it's failing, we have a page for dealing with 
rejected credentials 
https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html#http-401-credentials-rejected
*.*

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1f2e646d-d56f-41cc-a323-0f3a5850908b%40googlegroups.com.


[ansible-project] kerberos

2020-05-15 Thread Tony Wong
trying to get kerberos to work . I got all the libraries and krb5.conf file 
setup. I got a ticket from klist but when i do win_ping

I get errors


ansible windows -i hosts -m win_ping
10.50.1.231 | UNREACHABLE! => {
"changed": false,
"msg": "kerberos: authGSSClientStep() failed: (('Unspecified GSS 
failure.  Minor code may provide more information', 851968), ('Server not 
found in Kerberos database', -1765328377))",
"unreachable": true
}
10.200.1.31 | UNREACHABLE! => {
"changed": false,
"msg": "kerberos: authGSSClientStep() failed: (('Unspecified GSS 
failure.  Minor code may provide more information', 851968), ('Server not 
found in Kerberos database', -1765328377))",
"unreachable": true
}







my group_vars file



ansible_user: 's...@domain.com'
ansible_port: 5985
ansible_connection: 'winrm'
ansible_winrm_server_cert_validation: 'ignore'
ansible_winrm_transport: 'kerberos'
ansible_become: false



any idea

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d23e8a31-b075-4687-9fdb-45c21cf2c73f%40googlegroups.com.


[ansible-project] Unable to run java code with classpath on a remote server

2020-05-15 Thread Shifa Shaikh
In order to run java code I need to first set the classpath of dependent 
libraries by running a script setWLSEnv.sh as below:

$ . /app/wlserv*/server/bin/setWLSEnv.sh
$ java weblogic.version


The output gives me the version of the product which I need. 
I wrote the below playbook but it does not run the java code. 

---
  - hosts: dest_nodes


tasks:
  - name: Get weblogic version
shell: "/app/wlserv*/server/bin/setWLSEnv.sh;java weblogic.version"
register: wlsversion


  - debug:
  msg: "{{ wlsversion }}"


However, I get this error:

fatal: [10.0.0.91]: FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"cmd": "/app/wlserv*/server/bin/setWLSEnv.sh;java weblogic.version",
"delta": "0:00:00.271434",
"end": "2020-05-15 16:31:44.209506",
"invocation": {
"module_args": {
"_raw_params": "/app/wlserv*/server/bin/setWLSEnv.sh;java 
weblogic.version",
"_uses_shell": true,
"argv": null,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"stdin": null,
"stdin_add_newline": true,
"strip_empty_ends": true,
"warn": true
}
},
"msg": "non-zero return code",
"rc": 1,
"start": "2020-05-15 16:31:43.938072",
"stderr": "Error: Could not find or load main class weblogic.version",
"stderr_lines": [
"Error: Could not find or load main class weblogic.version"
],
"stdout": 
"CLASSPATH=/usr/java/jdk1.8.0_192-amd64/lib/tools.jar:/app/wlserver/modules/features/wlst.wls.classpath.jar:\n\nPATH=/app/wlserver/server/bin:/app/wlserver/../oracle_common/modules/thirdparty/org.apache.ant/1.9.8.0.0/apache-ant-1.9.8/bin:/usr/java/jdk1.8.0_192-amd64/jre/bin:/usr/java/jdk1.8.0_192-amd64/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/app/wlserver/../oracle_common/modules/org.apache.maven_3.2.5/bin\n\nYour
 
environment has been set.",
"stdout_lines": [

"CLASSPATH=/usr/java/jdk1.8.0_192-amd64/lib/tools.jar:/app/wlserver/modules/features/wlst.wls.classpath.jar:"
,
"",

"PATH=/app/wlserver/server/bin:/app/wlserver/../oracle_common/modules/thirdparty/org.apache.ant/1.9.8.0.0/apache-ant-1.9.8/bin:/usr/java/jdk1.8.0_192-amd64/jre/bin:/usr/java/jdk1.8.0_192-amd64/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/app/wlserver/../oracle_common/modules/org.apache.maven_3.2.5/bin"
,
"",
"Your environment has been set."
]
}


>From the output, I see that the classpath did get set but java 
weblogic.version command failed on the remote host.

Can you please suggest how can I get the Weblogic version registered to 
wlsversion variable ?

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f9e6d0f2-75a4-48ee-b086-ffb11a4e3336%40googlegroups.com.


[ansible-project] winrm http port 5985

2020-05-15 Thread Tony Wong
can winrm communicate via http 5985?

my group[_vars file

ansible_user: 'administrator'
ansible_password: 'xx'
ansible_port: 5985
ansible_connection: 'winrm'
ansible_winrm_server_cert_validation: 'ignore'
ansible_winrm_transport: 'ntlm'



but getting it failed on one win host


10.200.1.31 | UNREACHABLE! => {
"changed": false,
"msg": "ntlm: the specified credentials were rejected by the server",
"unreachable": true
}
10.50.1.231 | SUCCESS => {
"changed": false,
"ping": "pong"
}



-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9d0daa85-53b7-42e7-b5a8-7324abe1b02b%40googlegroups.com.


[ansible-project] EOS Modules for EOS Code <= 4.13.15M

2020-05-15 Thread Kevin C
Hey everyone,

I am ripe as a green banana with ansible. I've installed 2.9 on Ubuntu and 
setup a few playbooks for our heterogeneous environment. I've had success 
with all of our EOS devices running > 4.20 but we have some older models 
out there and I can't seem to get any module to work on them.  They keep 
complaining about json command not being available. I am not sure why this 
matters as my commands don't even include 'show version' and i have 
'gather_facts: false'. This has been driving me nuts the last couple weeks. 
I am wondering if there is a way to configure the modules to work with 
older code or if there are old modules I should be using. Ideally, i'd like 
to run commands and get the outputs  (eos_command) and deploy configs 
(eos_config). Any help would be greatly appreciated.

ansible.module_utils.connection.ConnectionError: show version | 
json\r\n/bin/sh: json: command not found

Kevin

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b8d3c79f-2f1e-49e4-8462-f73f46cf6964%40googlegroups.com.


Re: [ansible-project] There appears to be both 'k=v' shorthand syntax and YAML in this task.

2020-05-15 Thread Gurudatta Nadig
Thank you Michael, For your timely help.Regards
Gurudatta N.R

On Fri, May 15, 2020 at 8:53 PM Michael Mullay  wrote:

> Hi Gurudatta,
>
> As the error suggests, you have to use *either* 'k=v' syntax throughout
> the playbook or yaml throughout the playbook. More recent conventions
> suggest using yaml, so try this.
> - name: "Create multiple directories"
>   file:
>  path: {{item}}
>  state: directory
>   with_items:
>   - '/opt/services/tomcat/webapps/searchhub'
>   - '/tmp/searchhub'
> - name: Copy the war
>   *copy: *
> *src: /home/searchhub.war *
> *dest: /tmp/  *
> *owner: **tomcat *
> *group: tomcat *
> *mode: 0755*
> - name: "Change the ownership of the folder and Extract the war file
> to searchhub"
>   shell: "/usr/bin/unzip -q -o -d
> /opt/services/tomcat/webapps/searchhub /tmp/searchhub.war"
>   become: yes
>
>
>
> On Fri, May 15, 2020 at 3:44 AM Gurudatta Nadig 
> wrote:
>
>> Good day all,
>>
>> I am new to Ansible, I am getting the following error while running a
>> playbook any pointer ?
>>
>> ansible 2.8.4
>>
>>
>> *There appears to be both 'k=v' shorthand syntax and YAML in this task.
>> Only one syntax may be used.This error can be suppressed as a warning using
>> the "invalid_task_a*ttribute_failed" configuration
>>
>>
>> - name: "Create multiple directories"
>>   file: path={{item}} state=directory
>>   with_items:
>>   - '/opt/services/tomcat/webapps/searchhub'
>>   - '/tmp/searchhub'
>> - name: Copy the war
>>   *copy: src=/home/searchhub.war dest=/tmp/  owner=tomcat
>> group=tomcat mode=0755*
>> - name: "Change the ownership of the folder and Extract the war file
>> to searchhub"
>>   shell: "/usr/bin/unzip -q -o -d
>> /opt/services/tomcat/webapps/searchhub /tmp/searchhub.war"
>>   become: yes
>>
>> Regards
>> Gurudatta N.R
>>
>> --
>> 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 to ansible-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAM7YPLuKHz0JRfH_UM_vDyqeZAR8uiMJJxVqfu9yCKffKC3_BA%40mail.gmail.com
>> 
>> .
>>
> --
> 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 to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAH4rTPu6xY9RZK0va3gzOjYYL5OUa9RAkD%3DBts81-q39y-TnPw%40mail.gmail.com
> 
> .
>

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAM7YPLuDgmYG7kFKhjiV39z%2BJYm%2BUFqRMvCNDOd08Wzc32zSgw%40mail.gmail.com.


Re: [ansible-project] Ansible vmware_content_deploy_template

2020-05-15 Thread Dick Visser
The real error is buried somewhere at the end:

Cannot find service 'com.vmware.vcenter.vm_template.library_items

What that in turn means, I don't know...


On Fri, 15 May 2020 at 17:13, David Foley  wrote:
>
> Hi All,
>
> I'm getting the Following Error When trying to Run an Ansible Playbook. even 
> when i have validate_certs Set to False, it's still displaying the issue.
>
> Unverified HTTPS request is being made. Adding certificate verification is 
> strongly advised. See: 
> https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  
> InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py
>
>
> ---
> - hosts: localhost
>   gather_facts: false
>   tasks:
>   - name: Deploy Virtual Machine from template in content library
> vmware_content_deploy_template:
>   hostname: "{{ Host }}"
>   username: "{{ user }}"
>   password: "{{ pass }}"
>   template: WIN10-V3-SDBLD12
>   datastore: "{{ datastore }}"
>   folder: /vm
>   datacenter: Cork
>   host: "{{ ESXi }}"
>   name: Test_Machine
>   validate_certs: False
>   state: present
> delegate_to: localhost
>
>
>
> ansible-playbook t.yaml -v
>
> ansible-playbook 2.9.9
>   config file = /etc/ansible/ansible.cfg
>   configured module search path = [u'/root/.ansible/plugins/modules', 
> u'/usr/share/ansible/plugins/modules']
>   ansible python module location = /usr/lib/python2.7/dist-packages/ansible
>   executable location = /usr/bin/ansible-playbook
>   python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]
> Using /etc/ansible/ansible.cfg as config file
> setting up inventory plugins
> host_list declined parsing /etc/ansible/hosts as it did not pass its 
> verify_file() method
> script declined parsing /etc/ansible/hosts as it did not pass its 
> verify_file() method
> auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() 
> method
> Parsed /etc/ansible/hosts inventory source with ini plugin
> Loading callback plugin default of type stdout, v2.0 from 
> /usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.pyc
>
> PLAYBOOK: t.yaml 
> **Positional
>  arguments: t.yaml
> become_method: sudo
> inventory: (u'/etc/ansible/hosts',)
> forks: 5
> tags: (u'all',)
> verbosity: 5
> connection: smart
> timeout: 10
> 1 plays in t.yaml
>
> PLAY [localhost] 
> **META:
>  ran handlers
>
> TASK [Deploy Virtual Machine from template in content library] 
> task
>  path: /srv/ansible/t.yaml:5
>  ESTABLISH LOCAL CONNECTION FOR USER: root
>  EXEC /bin/sh -c 'echo ~root && sleep 0'
>  EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
> /root/.ansible/tmp `"&& mkdir 
> /root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677 && echo 
> ansible-tmp-1589555313.13-6894-196031450684677="` echo 
> /root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677 `" ) && 
> sleep 0'
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/_text.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/vmware.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/vmware_rest_client.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/basic.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/six/__init__.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/urls.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/common/_collections_compat.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/common/__init__.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/formatters.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/common/validation.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/converters.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/pycompat24.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/__init__.py
> Using module_utils file 
> /usr/lib/python2.7/dist-packages/ansible/module_utils/common/process.py
> Using module_utils file 
> 

Re: [ansible-project] Is there a better way to search through a list using when and regex_search

2020-05-15 Thread Scott Fella
Vlad,

I have used your templates and playbook and ran it against around 170+ 
devices.  The changes works well, except when there is a host that has 
failed in which the files are not generated.  If I exclude the hosts that 
have failed and re-run the playbook, the output gets generated.

Thanks,
-Scott

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cf5574ec-03f4-4ee2-bf8a-b43ae79c7c9a%40googlegroups.com.


Re: [ansible-project] There appears to be both 'k=v' shorthand syntax and YAML in this task.

2020-05-15 Thread Michael Mullay
Hi Gurudatta,

As the error suggests, you have to use *either* 'k=v' syntax throughout the
playbook or yaml throughout the playbook. More recent conventions suggest
using yaml, so try this.
- name: "Create multiple directories"
  file:
 path: {{item}}
 state: directory
  with_items:
  - '/opt/services/tomcat/webapps/searchhub'
  - '/tmp/searchhub'
- name: Copy the war
  *copy: *
*src: /home/searchhub.war *
*dest: /tmp/  *
*owner: **tomcat *
*group: tomcat *
*mode: 0755*
- name: "Change the ownership of the folder and Extract the war file to
searchhub"
  shell: "/usr/bin/unzip -q -o -d
/opt/services/tomcat/webapps/searchhub /tmp/searchhub.war"
  become: yes



On Fri, May 15, 2020 at 3:44 AM Gurudatta Nadig 
wrote:

> Good day all,
>
> I am new to Ansible, I am getting the following error while running a
> playbook any pointer ?
>
> ansible 2.8.4
>
>
> *There appears to be both 'k=v' shorthand syntax and YAML in this task.
> Only one syntax may be used.This error can be suppressed as a warning using
> the "invalid_task_a*ttribute_failed" configuration
>
>
> - name: "Create multiple directories"
>   file: path={{item}} state=directory
>   with_items:
>   - '/opt/services/tomcat/webapps/searchhub'
>   - '/tmp/searchhub'
> - name: Copy the war
>   *copy: src=/home/searchhub.war dest=/tmp/  owner=tomcat
> group=tomcat mode=0755*
> - name: "Change the ownership of the folder and Extract the war file
> to searchhub"
>   shell: "/usr/bin/unzip -q -o -d
> /opt/services/tomcat/webapps/searchhub /tmp/searchhub.war"
>   become: yes
>
> Regards
> Gurudatta N.R
>
> --
> 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 to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAM7YPLuKHz0JRfH_UM_vDyqeZAR8uiMJJxVqfu9yCKffKC3_BA%40mail.gmail.com
> 
> .
>

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAH4rTPu6xY9RZK0va3gzOjYYL5OUa9RAkD%3DBts81-q39y-TnPw%40mail.gmail.com.


[ansible-project] Ansible vmware_content_deploy_template

2020-05-15 Thread David Foley
Hi All,

I'm getting the Following Error When trying to Run an Ansible Playbook. 
even when i have validate_certs Set to False, it's still displaying the 
issue.

Unverified HTTPS request is being made. Adding certificate verification is 
strongly advised. See: 
https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  
InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py


---
- hosts: localhost
  gather_facts: false
  tasks:
  - name: Deploy Virtual Machine from template in content library
vmware_content_deploy_template:
  hostname: "{{ Host }}"
  username: "{{ user }}"
  password: "{{ pass }}"
  template: WIN10-V3-SDBLD12
  datastore: "{{ datastore }}"
  folder: /vm
  datacenter: Cork
  host: "{{ ESXi }}"
  name: Test_Machine
  validate_certs: False
  state: present
delegate_to: localhost



ansible-playbook t.yaml -v

ansible-playbook 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its 
verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its 
verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its 
verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from 
/usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.pyc

PLAYBOOK: t.yaml 
**Positional
 
arguments: t.yaml
become_method: sudo
inventory: (u'/etc/ansible/hosts',)
forks: 5
tags: (u'all',)
verbosity: 5
connection: smart
timeout: 10
1 plays in t.yaml

PLAY [localhost] 
**META:
 
ran handlers

TASK [Deploy Virtual Machine from template in content library] 
task
 
path: /srv/ansible/t.yaml:5
 ESTABLISH LOCAL CONNECTION FOR USER: root
 EXEC /bin/sh -c 'echo ~root && sleep 0'
 EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
/root/.ansible/tmp `"&& mkdir 
/root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677 && echo 
ansible-tmp-1589555313.13-6894-196031450684677="` echo 
/root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677 `" ) && 
sleep 0'
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/_text.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/vmware.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/vmware_rest_client.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/basic.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/six/__init__.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/urls.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/_collections_compat.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/__init__.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/formatters.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/validation.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/converters.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/pycompat24.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/__init__.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/process.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/parsing/convert_bool.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/_utils.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/parameters.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/parsing/__init__.py
Using module_utils file 

Re: [ansible-project] Can I specify ansible-password-vault-file in a playbook before running an include_vars ?

2020-05-15 Thread Brian Coca
it is not possible, vault secrets need to be provided at the start of
a run, before playbooks are even read. You CAN use lookups to access
data from other secure sources and those can take secrets at the time
the lookup is invoked.

-- 
--
Brian Coca

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7dWvPgssO5UjK99i%2B-KxuWipfi0dBFsS%2Bu34Odz%2BXzVgA%40mail.gmail.com.


[ansible-project] Can I specify ansible-password-vault-file in a playbook before running an include_vars ?

2020-05-15 Thread Stephen Maher
Hi,

I'm creating some playbooks that require some vaulted data and this is 
sourced dynamically. I am looking for a way to include the ansible password 
vault file before including this data, but without doing this on the 
command line, does anyone have a solution for this as I cannot seem to find 
anything in the code in 2.9 but I'm sure someone must have had this 
requirement before ?


Cheers

Steve Maher

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/29e350d9-9b2a-492c-aa84-98745de6a398%40googlegroups.com.


Re: [ansible-project] fatch module

2020-05-15 Thread rakesh rathore
> Actually, It was related to Ansible so I just want to know if anyone had
> done any project same or write a script or playbook.  Thank you so much
> JEAN I will lookup on your suggestions.
>

[image: Mailtrack]

Sender
notified by
Mailtrack

05/15/20,
05:01:38 PM

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFbCLYnH%3DPRhxPtKmwxVKP4bfuq5knL5LX9FUVhUJH9ogn1Xtg%40mail.gmail.com.


[ansible-project] There appears to be both 'k=v' shorthand syntax and YAML in this task.

2020-05-15 Thread Gurudatta Nadig
Good day all,

I am new to Ansible, I am getting the following error while running a
playbook any pointer ?

ansible 2.8.4


*There appears to be both 'k=v' shorthand syntax and YAML in this task.
Only one syntax may be used.This error can be suppressed as a warning using
the "invalid_task_a*ttribute_failed" configuration


- name: "Create multiple directories"
  file: path={{item}} state=directory
  with_items:
  - '/opt/services/tomcat/webapps/searchhub'
  - '/tmp/searchhub'
- name: Copy the war
  *copy: src=/home/searchhub.war dest=/tmp/  owner=tomcat group=tomcat
mode=0755*
- name: "Change the ownership of the folder and Extract the war file to
searchhub"
  shell: "/usr/bin/unzip -q -o -d
/opt/services/tomcat/webapps/searchhub /tmp/searchhub.war"
  become: yes

Regards
Gurudatta N.R

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAM7YPLuKHz0JRfH_UM_vDyqeZAR8uiMJJxVqfu9yCKffKC3_BA%40mail.gmail.com.


Re: [ansible-project] Is there a better way to search through a list using when and regex_search

2020-05-15 Thread Vladimir Botka
On Thu, 14 May 2020 15:58:08 -0700 (PDT)
Scott Fella  wrote:

> gist: https://gist.github.com/fella5/6842043ccc35f013c9092c6520dfb593

See https://gist.github.com/vbotka/32616e8d896ef22d985bdb707915c9f0

Split the playbook search_snmp_v1.yml to two plays. Collect the data in the
first play. Then "delegate_to" localhost and "run_once" the templates in
the second play. Remove `strategy: free` in the second play. You've
already found out:

[WARNING]: Using run_once with the free strategy is not currently
supported. This task will still be executed for every host in the
inventory list.

Change the templates and test it.

HTH,

-vlado

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200515114947.27abbecb%40gmail.com.


pgpvbUHbUOmDa.pgp
Description: OpenPGP digital signature


Re: [ansible-project] Ansible for netwoking: Fortios BGP module, incremental configurations

2020-05-15 Thread Dick Visser
You could use different vars files for your teams and use them or merge
them when you deploy the device



On Fri, 15 May 2020 at 10:41, Luis Arizaga  wrote:

> Hi,
>
> I'm a network engineer. I want to use Ansible in order to provision some
> routers and firewalls in my company for diferent tasks/projects. I started
> testing with some Fortinet Firewalls we have. I encountered a problem using
> a module to configure BGP. The problem is not related to how to use the
> module but to Ansible's behaviour. Maybe it just that I have to get used to
> Ansible philosophy but I wanted to ask the question. This is the issue:
>
> Everytime I want to push something to the Firewall the precedent
> configuration has to be in the playbook I run otherwise Ansible will erase
> the previous configuration that I pushed and only insert the new one. What
> I wanted to do is to configure devices incrementally to avoid having a huge
> playbook with all the information but several playbooks related to the
> project that every person on the team is doing. That way everybody will be
> creating their playbooks following kind of a template (just changing
> variables actually, that's the aim) and injecting configurations
> progressively. Is there a way to do that?
>
> I'm using ansible 2.9. This is the FortiOs module I'm using:
>
> https://docs.ansible.com/ansible/latest/modules/fortios_router_bgp_module.html#fortios-router-bgp-module
> And here's my playbook:
> https://gist.github.com/luchoArg33/28c41bbc449b43bc670f6f62040e9e6c
>
> Any information, document, page, anything that could help me resolve or
> understand this issue would be great for me. Thanks for your time!!!
>
> Cheers,
> Luis
>
> --
> 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 to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/57d71d6b-20b2-4ef8-b592-f046183ae934%40googlegroups.com
> 
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOWA5ouKz-%3DPpwan6KFqWPAMJz_VVnUucfEa0csAuY2Bw%40mail.gmail.com.


Re: [ansible-project] fatch module

2020-05-15 Thread Jean-Yves LENHOF
I rather would use something like syslog, logstash, filebeat to do this 
type of job instead of ansible...


Regards,

JYL


Le 15/05/2020 à 09:53, rakesh rathore a écrit :

Hi Team,

Can anyone slove this for me please?


Imaginetherearemanyserversrunninginproductionsetupandstoringsomedataata 
particular location on each server. The file name of each server is 
unique and follows a 
specificpattern.thefilenamestartswiththehostnamedateandtimestampendingwith


.TXT. as soon as the file reaches 100 MB a remote server should fetch 
the file and store it locally. The file will keep on getting appended 
on the respective server but a remote server will keep on tracking the 
file size and keep on thinking it on its local directory.


Suppose there are 10 servers which are in production naming from 
host1-10 and the remote server named as rm1. the script on server rm1 
will keep on checking the size of the file being written on each of 
the hosts 1 to 10. As soon as the file size reaches 100 MB the file 
should be synced to RM1 server. The script should make sure that it is 
only downloading the latest data not the data which had if it had 
previously downloaded. File has become 1.5 GB but the server rm1 has 
already downloaded 1.5 GB of data so any new 100Mb that is being 
appended to this file shall be sent over the network to RM1 server not 
the entire 1.6 GB of data.


Its free exam test

I am trying slove this
- hosts: Producton tasks: - fetch: dest: /root/filename.TXT src: 
/home/backup flat: yes




--
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/13b79472-d3ef-38c2-536e-22640eb80e04%40lenhof.eu.org.


[ansible-project] Ansible for netwoking: Fortios BGP module, incremental configurations

2020-05-15 Thread Luis Arizaga
Hi,

I'm a network engineer. I want to use Ansible in order to provision some 
routers and firewalls in my company for diferent tasks/projects. I started 
testing with some Fortinet Firewalls we have. I encountered a problem using 
a module to configure BGP. The problem is not related to how to use the 
module but to Ansible's behaviour. Maybe it just that I have to get used to 
Ansible philosophy but I wanted to ask the question. This is the issue: 

Everytime I want to push something to the Firewall the precedent 
configuration has to be in the playbook I run otherwise Ansible will erase 
the previous configuration that I pushed and only insert the new one. What 
I wanted to do is to configure devices incrementally to avoid having a huge 
playbook with all the information but several playbooks related to the 
project that every person on the team is doing. That way everybody will be 
creating their playbooks following kind of a template (just changing 
variables actually, that's the aim) and injecting configurations 
progressively. Is there a way to do that? 

I'm using ansible 2.9. This is the FortiOs module I'm using:
https://docs.ansible.com/ansible/latest/modules/fortios_router_bgp_module.html#fortios-router-bgp-module
And here's my playbook:
https://gist.github.com/luchoArg33/28c41bbc449b43bc670f6f62040e9e6c

Any information, document, page, anything that could help me resolve or 
understand this issue would be great for me. Thanks for your time!!!

Cheers,
Luis

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/57d71d6b-20b2-4ef8-b592-f046183ae934%40googlegroups.com.


Re: [ansible-project] facing the problem in mapping network drive

2020-05-15 Thread mahesh g o
Thanks Jordan,

I used become in my playbook.

- hosts: [win]
  gather_facts: false
  tasks:
- name: create a mapped drive
  win_mapped_drive:
   state: present
   letter: D
   path: \\10.237.163.116\test

  vars:
# become is required to save and retrieve the credentials in the tasks
  ansible_become: yes
  ansible_become_method: runas
  ansible_become_user: test
  ansible_become_pass: password@123
  ansible_become_flags: logon_type=new_credentials 
logon_flags=netcredentials_only

Playbook is running without any errors.

But i am not seeing the network drive in my windows OS.
net use:
Unavailable  T:\\10.237.163.116\test Microsoft Windows Network

what is that i am missing here. what is the solution to map the network 
drive.


On Friday, 15 May 2020 02:36:13 UTC+5:30, Jordan Borean wrote:
>
> The error you have is nothing to do with mapped drives but that Ansible is 
> unable to authenticate itself over the WinRM connection. YOu need to set 
> ansible_user and ansible_password for Ansible to use as the connection 
> credentials.
>
> Also please note that while you can map a network drive using 
> win_mapped_drive in Ansible, you cannot use that mapped drive in Ansible 
> tasks. That mapping is just for interactive logons. If you want to access 
> files from a network path in Ansible you need to use the UNC path and 
> potentially use become to add outbound creds to your process. We have an 
> example of that here 
> https://docs.ansible.com/ansible/latest/user_guide/become.html#become-flags-for-windows
> .
>

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/18f5b50d-415a-4fc4-8e0b-0c7d383f0dae%40googlegroups.com.


[ansible-project] fatch module

2020-05-15 Thread rakesh rathore
Hi Team,

Can anyone slove this for me please?


Imagine there are many servers running in production setup and storing some
data at a particular location on each server. The file name of each server
is unique and follows a specific pattern. the filename starts with the
hostname date and timestamp ending with

.TXT. as soon as the file reaches 100 MB a remote server should fetch the
file and store it locally. The file will keep on getting appended on the
respective server but a remote server will keep on tracking the file size
and keep on thinking it on its local directory.
Suppose there are 10 servers which are in production naming from host1-10
and the remote server named as rm1. the script on server rm1 will keep on
checking the size of the file being written on each of the hosts 1 to 10.
As soon as the file size reaches 100 MB the file should be synced to RM1
server. The script should make sure that it is only downloading the latest
data not the data which had if it had previously downloaded. File has
become 1.5 GB but the server rm1 has already downloaded 1.5 GB of data so
any new 100Mb that is being appended to this file shall be sent over the
network to RM1 server not the entire 1.6 GB of data.

Its free exam test

I am trying slove this
- hosts: Producton tasks: - fetch: dest: /root/filename.TXT src:
/home/backup flat: yes










Is this work ?

[image: Mailtrack]

Sender
notified by
Mailtrack

05/15/20,
01:22:28 PM

-- 
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 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFbCLYkVEv45RbNRMdBfpE9YSik8EVACNdHTW7%3DJJZWyx%3DPGMQ%40mail.gmail.com.


shell_script.md
Description: Binary data