Re: [ansible-project] how to exclude directories when I use ansible fetch

2019-06-13 Thread Dick Visser
Try:

--
 - hosts: 10.33.81.12
   vars:
dir_src: "C:/Websites/citihabitats.com/"
dir_dest: /tmp/fetched/
   tasks:
   - name: fetch nginx access and error log
 fetch:
   src:  "{{ dir_src }}/{{ item}}.config"
   dest: "{{ dir_dest }}/{{ inventory_hostname }}/"
   flat: yes
register: fetch_output
 loop:
   - appsettings.beta
   - Web



On Thu, 13 Jun 2019 at 23:10, federico montaldo  wrote:
>
> HI folks:
>
> I need to extract two files for a windows servers. I made the following 
> playbook:
>
> ---
>  - hosts: 10.33.81.12
>vars:
> dir_src: "C:/Websites/citihabitats.com/"
> dir_dest: /tmp/fetched/
>tasks:
>- name: fetch nginx access and error log
>  fetch:
>src:  "{{ dir_src }}/{{ item}}.config"
>dest: "{{ dir_dest }}"
>  register: fetch_output
>  loop:
>- appsettings.beta
>- Web
>
> It works but I want to know if there is a way to exclude the full path of the 
> windows dir. This is the output there I got ins the dir for the ansible 
> controller.
>
>
> [svc-devops@wnrt2-cg-lmon2 ansible]$ tree /tmp/fetched/10.33.81.12/
> /tmp/fetched/10.33.81.12/
> └── C:
> └── Websites
> └── citihabitats.com
> ├── appsettings.beta.config
> └── Web.config
>
> 3 directories, 2 files
>
> There is a way to only have a destination dir like:
>
> /tmp/fetched/IP/
>
> Thanks in advance
>
> Regards
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/e017138f-7f90-4d3d-ae53-3a4e202478e0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwNvfFn-S9g_ReL0PqpMeyfG%2BC6EgWWF6VZrNwjqq%2B_trw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variable registration is getting skipped in zypper module

2019-06-13 Thread Bobby Hood
Thanks, I thought that might be it. Seems pointless to suppress all the 
output. I used the "command" module instead with all the same parameters 
except --quiet and --xmlout and it's working fine. And since I can't use 
the "changed" parameter with command to see if any packages were updated 
(it always seems to return true), I'm instead checking its stdout for the 
string "Nothing to do".

On Thursday, June 13, 2019 at 5:17:19 PM UTC-6, Sebastian Meyer wrote:
>
> Hi, 
>
> On 13.06.19 23:50, Bobby Hood wrote: 
> >"cmd": [ 
> >"/usr/bin/zypper",   
> >"--quiet",   
>
> the ansible zypper module calls zypper with --quiet, as you can check on 
> the commandline that leads to zypper not writing to stdout, if there's 
> nothing to do: 
>
> # zypper update 
> Loading repository data... 
> Reading installed packages... 
>
> Nothing to do. 
> # 
> # zypper --quiet update 
> # 
>
> As this is hardcoded in the module, there's no easy way around this. It 
> should give you output once there are packages to update: 
>
> # zypper --quiet --non-interactive up 
>
> The following 6 NEW packages are going to be installed: 
>   dbus-1 kbd kmod pinentry pkg-config udev 
>
> The following 56 packages are going to be upgraded: 
>   aaa_base acl bash blog ca-certificates-mozilla cpio file [...] 
>
> The following product is going to be reinstalled: 
>   "openSUSE Leap 42.3" 
>
> 56 packages to upgrade, 6 new. 
> Overall download size: 27.8 MiB. Already cached: 0 B. After the operation, 
> additional 12.4 MiB will be used. 
> Continue? [y/n/...? shows all options] (y): y 
>
> Regards 
> -- 
> Sebastian Meyer 
> Linux Consultant & Trainer 
> Mail: me...@b1-systems.de  
>
> B1 Systems GmbH 
> Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de 
> GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 
>

-- 
This e-mail message (including any attachments) is for the sole use of the 
intended recipient(s) and may contain confidential, privileged, and/or 
proprietary information. If the reader of this message is not the intended 
recipient, you are hereby notified that any dissemination, distribution or 
copying of this message (including any attachments) is strictly prohibited.


If you have received this message in error, please contact the sender by 
reply e-mail message and destroy all copies of the original message 
(including attachments).

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dd383574-662f-4c52-ba85-6ed346057842%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variable registration is getting skipped in zypper module

2019-06-13 Thread Bobby Hood
Thanks, I thought that might be it. I used the command module instead with 
all the same parameters except --quiet and --xmlout and it's working fine. 
Seems pointless that it suppresses all the output.

On Thursday, June 13, 2019 at 5:17:19 PM UTC-6, Sebastian Meyer wrote:
>
> Hi, 
>
> On 13.06.19 23:50, Bobby Hood wrote: 
> >"cmd": [ 
> >"/usr/bin/zypper",   
> >"--quiet",   
>
> the ansible zypper module calls zypper with --quiet, as you can check on 
> the commandline that leads to zypper not writing to stdout, if there's 
> nothing to do: 
>
> # zypper update 
> Loading repository data... 
> Reading installed packages... 
>
> Nothing to do. 
> # 
> # zypper --quiet update 
> # 
>
> As this is hardcoded in the module, there's no easy way around this. It 
> should give you output once there are packages to update: 
>
> # zypper --quiet --non-interactive up 
>
> The following 6 NEW packages are going to be installed: 
>   dbus-1 kbd kmod pinentry pkg-config udev 
>
> The following 56 packages are going to be upgraded: 
>   aaa_base acl bash blog ca-certificates-mozilla cpio file [...] 
>
> The following product is going to be reinstalled: 
>   "openSUSE Leap 42.3" 
>
> 56 packages to upgrade, 6 new. 
> Overall download size: 27.8 MiB. Already cached: 0 B. After the operation, 
> additional 12.4 MiB will be used. 
> Continue? [y/n/...? shows all options] (y): y 
>
> Regards 
> -- 
> Sebastian Meyer 
> Linux Consultant & Trainer 
> Mail: me...@b1-systems.de  
>
> B1 Systems GmbH 
> Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de 
> GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 
>

-- 
This e-mail message (including any attachments) is for the sole use of the 
intended recipient(s) and may contain confidential, privileged, and/or 
proprietary information. If the reader of this message is not the intended 
recipient, you are hereby notified that any dissemination, distribution or 
copying of this message (including any attachments) is strictly prohibited.


If you have received this message in error, please contact the sender by 
reply e-mail message and destroy all copies of the original message 
(including attachments).

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/06d0d78d-03e3-4319-a4ef-32b01e77f7f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variable registration is getting skipped in zypper module

2019-06-13 Thread Sebastian Meyer
Hi,

On 13.06.19 23:50, Bobby Hood wrote:
>"cmd": [ 
>"/usr/bin/zypper",  
>"--quiet",  

the ansible zypper module calls zypper with --quiet, as you can check on
the commandline that leads to zypper not writing to stdout, if there's
nothing to do:

# zypper update
Loading repository data...
Reading installed packages...

Nothing to do.
#
# zypper --quiet update
#

As this is hardcoded in the module, there's no easy way around this. It
should give you output once there are packages to update:

# zypper --quiet --non-interactive up

The following 6 NEW packages are going to be installed:
  dbus-1 kbd kmod pinentry pkg-config udev

The following 56 packages are going to be upgraded:
  aaa_base acl bash blog ca-certificates-mozilla cpio file [...]

The following product is going to be reinstalled:
  "openSUSE Leap 42.3"

56 packages to upgrade, 6 new.
Overall download size: 27.8 MiB. Already cached: 0 B. After the operation,
additional 12.4 MiB will be used.
Continue? [y/n/...? shows all options] (y): y

Regards
-- 
Sebastian Meyer
Linux Consultant & Trainer
Mail: me...@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9b9731f9-f099-7e15-b48a-28ea858eda9f%40b1-systems.de.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible syntax to use "if-else" and "set"

2019-06-13 Thread Brian Coca
vars:
   group: ' {{ c ==1|ternary('gr1', c==2|ternary('grp3', 'grp4')) }}'

--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7d-c6YCu75VOpYUw0xke3FkXGTtfHsUHYwaXuPZ_QSqrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variable registration is getting skipped in zypper module

2019-06-13 Thread Bobby Hood
Still having some trouble with this. I changed the registered variables to 
apt_result and zypper_result:

- name: (SuSE) Update all packages to latest versions 
  when: ansible_os_family == "Suse" 
  zypper: 
name: '*' 
state: latest 
type: package 
update_cache: yes 
  register: zypper_result 
- name: (Debian) Update all packages to latest versions 
  when: ansible_os_family == "Debian" 
  apt: 
name: '*' 
state: latest 
update_cache: yes 
force_apt_get: yes 
autoremove: yes 
  register: apt_result


But the zypper module returns completely different parameters than the apt 
module. Shouldn't it contain stdout and stderr too? I've tried removing all 
the apt stuff to eliminate any conflicts but the results didn't change. 
This is the zypper_result variable dump. It runs zypper update just fine on 
the host but I'm not getting the return values I want. At minimum I need 
the stdout and stderr output.

ok: [raamah] => { 
   "zypper_result": { 
   "changed": false,  
   "cmd": [ 
   "/usr/bin/zypper",  
   "--quiet",  
   "--non-interactive",  
   "--xmlout",  
   "update",  
   "--type",  
   "package",  
   "--auto-agree-with-licenses",  
   "--no-recommends" 
   ],  
   "failed": false,  
   "name": [ 
   "*" 
   ],  
   "rc": 0,  
   "state": "latest",  
   "update_cache": true 
   } 
}

The apt dump again:

ok: [webtest01] => { 
   "apt_result": { 
   "changed": false,  
   "failed": false,  
   "msg": "Reading package lists...\nBuilding dependency 
tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 
0 newly installed, 0 to remove and 0 not upgraded.\n", 
   
   "stderr": "",  
   "stderr_lines": [],  
   "stdout": "Reading package lists...\nBuilding dependency 
tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 
0 newly installed, 0 to remove and 0 not upgraded.\n", 

   "stdout_lines": [ 
   "Reading package lists...",  
   "Building dependency tree...",  
   "Reading state information...",  
   "Calculating upgrade...",  
   "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." 
   ] 
   } 
}

On Thursday, June 13, 2019 at 10:45:08 AM UTC-6, Bobby Hood wrote:

> Ah I see, thank you.
>
> On Thursday, June 13, 2019 at 10:38:16 AM UTC-6, Matt Martz wrote:
>>
>> You are registering to the same variable in both tasks.  Ansible will 
>> register regardless of the task being skipped or not.
>>
>> If the suse/zypper task executes, I assume that the apt task should skip, 
>> as such, the zypper task registered with real data first, and then the apt 
>> task overwrites the result with a skipped info.
>>
>> You should be using different register variable names for each task, to 
>> avoid this issue.
>>
>> On Thu, Jun 13, 2019 at 11:23 AM Bobby Hood  wrote:
>>
>>> I'm using the zypper and apt modules to update remote hosts. I don't 
>>> know if I'm missing something or it's a bug, but registering a variable in 
>>> the zypper module is getting skipped. It works fine in the apt module.
>>>
>>> - name: (SuSE) Update all packages to latest versions
>>>   when: ansible_os_family == "Suse"
>>>   *zy*pper:
>>> name: '*'
>>> state: latest
>>> type: package
>>> update_cache: yes
>>>   register: update_result
>>> - name: (Debian) Update all packages to latest versions
>>>   when: ansible_os_family == "Debian"
>>>   apt:
>>> name: '*'
>>> state: latest
>>> update_cache: yes
>>> force_apt_get: yes
>>> autoremove: yes
>>>   register: update_result
>>>
>>>
>>>
>>> This is the variable dump when using zypper. It's always *"changed": 
>>> false* and *"skipped": true* even if changes are made.
>>>
>>> ok: [raamah] => { 
>>>"update_result": { 
>>>"changed": false,  
>>>"skip_reason": "Conditional result was False",  
>>>"skipped": true 
>>>} 
>>> }
>>>
>>>
>>> However, the apt module always returns values for "msg", "stderr", and 
>>> "stdout" as seen below. Am I using the zypper module incorrectly or 
>>> something?
>>>
>>> ok: [webtest01] => { 
>>>"update_result": { 
>>>"changed": false,  
>>>"failed": false,  
>>>"msg": "Reading package lists...\nBuilding dependency 
>>> tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 
>>> 0 newly installed, 0 to remove and 0 not upgraded.\n", 
>>>
>>>"stderr": "",  
>>>"stderr_lines": [],  
>>>"stdout": "Reading package lists...\nBuilding dependency 
>>> tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 
>>> 0 newly installed, 0 to remove a

[ansible-project] how to exclude directories when I use ansible fetch

2019-06-13 Thread federico montaldo
HI folks:

I need to extract two files for a windows servers. I made the following 
playbook:

---
 - hosts: 10.33.81.12
   vars: 
dir_src: "C:/Websites/citihabitats.com/"
dir_dest: /tmp/fetched/
   tasks:
   - name: fetch nginx access and error log
 fetch:
   src:  "{{ dir_src }}/{{ item}}.config"
   dest: "{{ dir_dest }}"
 register: fetch_output
 loop:
   - appsettings.beta
   - Web

It works but I want to know if there is a way to exclude the full path of 
the windows dir. This is the output there I got ins the dir for the ansible 
controller.


[svc-devops@wnrt2-cg-lmon2 ansible]$ tree /tmp/fetched/10.33.81.12/
/tmp/fetched/10.33.81.12/
└── C:
└── Websites
└── citihabitats.com
├── appsettings.beta.config
└── Web.config

3 directories, 2 files

There is a way to only have a destination dir like:

/tmp/fetched/IP/

Thanks in advance

Regards

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e017138f-7f90-4d3d-ae53-3a4e202478e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: CSV file formatting using ansible

2019-06-13 Thread 'J Hawkesworth' via Ansible Project
Unless you have a very old F5, you'd probably be better off gathering facts 
from the f5 - the console output looks really hard to parse.  
https://docs.ansible.com/ansible/latest/modules/bigip_device_facts_module.html


On Thursday, June 13, 2019 at 5:58:31 PM UTC+1, Kethan R wrote:
>
> I already used it, but still im getting output in this format which i 
> cannot filter it ...
>
> [image: lb.PNG]
>
>   tasks:
> - name: print date
>   set_fact: temp="{{lookup('pipe','date \"+%Y-%m-%d-%H-%M\"')}}"
> - name: creates file
>   file: 
> path: "/tmp/loadbalancer_{{ temp }}.csv"
> state: touch
> - name: creates file
>   file: 
> path: "/tmp/loadbalancer_{{ temp }}.txt"
> state: touch
> - name: print date
>   set_fact: files="loadbalancer_{{ temp }}.csv"
> - name: Run Health Checks on LoadBalancer servers
>   bigip_command:
> commands:
>   - show sys version
>   - show sys service | grep tmm
>   - show ltm
>   - show sys memory
> provider:
>   server: .
>   password: "{{ x }}"
>   user: "{{ x }}"
>   validate_certs: no
>   register: version
>   delegate_to: localhost
> - name: Updating variable
>   copy: content="{{ version.stdout_lines | to_nice_yaml }}" 
> dest="/tmp/loadbalancer_{{ temp }}.txt"
> - name: Parse the CSV file
>   shell: 
> cmd: |
>   cp -f "/tmp/loadbalancer_{{ temp }}.txt" /tmp/temp.txt
>   cat /tmp/temp.txt| tr -s '[:blank:]' ' ' > "/tmp/loadbalancer_{{ 
> temp }}.csv" 
>
> On Thursday, June 13, 2019 at 11:31:46 AM UTC-5, J Hawkesworth wrote:
>>
>>
>> Assuming you have the data from your load balancer stored in a registered 
>> variable you could run copy to write the file to disk on the controller, 
>> and then a shell task to use 'tr' command to convert the whitespace, tabs 
>> and : to a comma, and then you would have .csv file you could process.  
>> Something like the following (which I have NOT tested):
>>
>>
>>  - name: copy loadbalancer output to disk
>>copy:
>> content: "{{ output_from_load_balancer }}"
>> dest: /tmp/load-balancer-raw
>>delegate_to: localhost
>>
>>
>>  - name: make raw loadbalancer into csv
>>shell: cat /tmp/load-balancer-raw | tr [:blank:] , | tr \: , > /tmp/
>> load-balancer-raw
>>delegate_to: localhost
>>
>>
>>
>> Also worth investigating are the lookups that ansible has.  See 
>> https://docs.ansible.com/ansible/latest/plugins/lookup.html You might 
>> want to use 
>> https://docs.ansible.com/ansible/latest/plugins/lookup/csvfile.html to 
>> load the csv for further processing.
>>
>> Also worth exploring to see if you can get more structured data out of 
>> your load balancer, preferably json or yaml, both of which are much easier 
>> to then use within ansible.
>>
>> Hope this helps,
>>
>> Jon
>>
>>
>> On Thursday, June 13, 2019 at 4:19:49 PM UTC+1, Kethan R wrote:
>>>
>>> Recently i wrote a playbook to pull the data from Loadbalancer server. 
>>> Output is saving in 1st row of each column.
>>> output has : data separated with spaces, Tabs and :
>>> I want to apply delimit option only on tabs spaces and : which i am not 
>>> able to. Kindly suggest if you have any solution.
>>>
>>>
>>> EX:
>>> xxx::Node: IP.ip.ip.ip (ip.ip.ip.ip) 
>>> -- 
>>> Status 
>>> Availability : available 
>>> State : enabled 
>>> Reason : Node address is available
>>> Monitor : /Common/icmp (default node monitor)
>>> Monitor Status : up 
>>> Session Status : enabled 
>>> Traffic  ServerSide General 
>>> Bits In 0   - 
>>> Bits Out 0   - 
>>> Packets In 0   - 
>>> Packets Out 0   - 
>>> Current Connections 0   - 
>>> Maximum Connections 0   - 
>>> Total Connections 0   - 
>>> Total Requests -   0 
>>> Current Sessions -   0 
>>>
>>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ae1018ac-46ec-4f35-b357-65f4c5ceabd1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Containerized Ansible SSH-ing to Windows DockerHost

2019-06-13 Thread Taylor Jackwood
win_ping it is, I'll stop messing with ping itself then.

So my question surrounding win_ping still stands, I'm getting a 
StackOverflowError back after the process hangs for an extended period. Any 
more insights from anyone before I head over to the github and post it as a 
possible bug/issue?


On Thursday, June 13, 2019 at 1:03:43 PM UTC-4, Matthew Davis wrote:
>
> Definitely a bit of a Rube Goldberg setup there, but no reason it 
> shouldn't work. The big problem is that you need to be using the Windows 
> modules to manage the Windows host (eg, win_ping, not ping).
>
> On Wednesday, June 12, 2019 at 11:39:16 AM UTC-7, Taylor Jackwood wrote:
>>
>> Afternoon!
>>
>> I am attempting to set up an Ansible Docker container for managing both 
>> other containers running in Docker, as well as my host machine (Running 
>> Windows 10).
>>
>> Using Ansible 2.8, I'm attempting to get the SSH connection to my host 
>> machine to work, as using WinRM isn't ideal for my scenario. I have set up 
>> OpenSSH Server on my machine, and done all of the steps to allow SSH 
>> tunneling from my container to my host machine. I can even go so far as to 
>> "docker exec -it ansible bash" into my container, then run an "ssh 
>> dockerhost" command, and it successfully uses my SSH keys to authenticate 
>> and SSH back into my host machine.
>>
>> My problem comes when I attempt to use Ansible from inside the container 
>> to ping my host machine. Whenever I try to run "ansible dockerhost -m 
>> ping", I'm met with this error:
>>
>>
>> ==
>>
>> ==
>>
>> *dockerhost | FAILED! => {*
>> *"changed": false,*
>> *"module_stderr": "Exception calling \"Create\" with \"1\" 
>> argument(s): \"At line:4 char:21*
>> *+ def _ansiballz_main():*
>> *+ ~*
>> *An expression was expected after '('.*
>> *At line:13 char:27*
>> *+ except (AttributeError, OSError):*
>> *+   ~*
>> *Missing argument in parameter list.*
>> *At line:15 char:7*
>> *+ if scriptdir is not None:*
>> *+   ~*
>> *Missing '(' after 'if' in if statement.*
>> *At line:22 char:7*
>> *+ if sys.version_info < (3,):*
>> *+*
>> * ~*
>> *Missing '(' after 'if' in if statement.*
>> *At line:22 char:30*
>> *+ if sys.version_info < (3,):*
>> *+*
>> * ~*
>> *Missing expression after ','.*
>> *At line:22 char:25*
>> *+ if sys.version_info < (3,):*
>> *+*
>> *  ~*
>> *The '<' operator is reserved for future use.*
>> *At line:24 char:32*
>> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
>> *+~*
>> *Missing expression after ','.*
>> *At line:24 char:33*
>> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
>> *+ ~*
>> *Unexpected token 'imp.PY_SOURCE' in expression or statement.*
>> *At line:24 char:32*
>> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
>> *+*
>> *~*
>> *Missing closing ')' in expression.*
>> *At line:24 char:46*
>> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
>> *+*
>> *  ~*
>> *Unexpected token ')' in expression or statement.*
>> *Not all parse errors were reported.  Correct the reported errors and 
>> try *
>> *again.\"*
>> *At line:6 char:1*
>> *+ $exec_wrapper = [ScriptBlock]::Create($split_parts[0])*
>> *+ ~~*
>> *+ CategoryInfo  : NotSpecified: (:) [], 
>> MethodInvocationException*
>> *+ FullyQualifiedErrorId : ParseException*
>>  
>> *The expression after '&' in a pipeline element produced an object that 
>> was not *
>> *valid. It must result in a command name, a script block, or a 
>> CommandInfo *
>> *object.*
>> *At line:7 char:2*
>> *+ &$exec_wrapper*
>> *+  ~*
>> *+ CategoryInfo  : InvalidOperation: (:) [], RuntimeException*
>> *+ FullyQualifiedErrorId : BadExpression*
>> * ",*
>> *"module_stdout": "",*
>> *"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",*
>> *"rc": 1*
>> *}*
>>
>>
>> ==
>>
>> ==
>>
>> I've also attempted this same ping test using the win_ping module, but 
>> get a different failed result. The command hangs for an extended period of 
>> time, then eventually returns with this error:
>>
>>
>> ==
>>
>> ==

[ansible-project] umount: /tmp: target is busy - payload files?

2019-06-13 Thread 'Georg Großmann' via Ansible Project
Hi!

I am using a playbook `from github created by Reiner Nippes to setup a 
nextcloud server. I changed quite some things to be able to run it on 
OpenSuse Tumbleweed. 

Before running the playbook, /etc/fstab looks like the following:
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /   btrfs  
defaults  0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /.snapshots btrfs  
subvol=/@/.snapshots  0  0
UUID=9d812efe-44e4-4594-affe-37299672ad9e  swapswap   
defaults  0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /varbtrfs  
subvol=/@/var 0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /usr/local  btrfs  
subvol=/@/usr/local   0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /srvbtrfs  
subvol=/@/srv 0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /root   btrfs  
subvol=/@/root0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /optbtrfs  
subvol=/@/opt 0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /home   btrfs  
subvol=/@/home0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /boot/grub2/x86_64-efi  btrfs  
subvol=/@/boot/grub2/x86_64-efi  0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /boot/grub2/i386-pc btrfs  
subvol=/@/boot/grub2/i386-pc  0  0
UUID=7388-F693 /boot/efi   vfat   
defaults  0  0


In the playbook there is a task to mount /tmp as tmpfs:

- name: mount tmp fs
  mount:
src: "tmpfs"
path: "{{ item }}"
fstype: tmpfs
opts: "defaults,noatime,nosuid,nodev,noexec,mode=1777"
passno: "0"
state: mounted
  with_items:
- /tmp
- /var/tmp

The first time I run the playbook, I get this error:
failed: [nextcloud] (item=/tmp) => {"ansible_loop_var": "item", "changed": 
false, "item": "/tmp", "msg": "Error mounting /tmp: umount: /tmp: target is 
busy.

and the file /etc/fstab has a new entry afterwards:
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /   btrfs  
defaults  0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /.snapshots btrfs  
subvol=/@/.snapshots  0  0
UUID=9d812efe-44e4-4594-affe-37299672ad9e  swapswap   
defaults  0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /varbtrfs  
subvol=/@/var 0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /usr/local  btrfs  
subvol=/@/usr/local   0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /srvbtrfs  
subvol=/@/srv 0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /root   btrfs  
subvol=/@/root0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /optbtrfs  
subvol=/@/opt 0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /home   btrfs  
subvol=/@/home0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /boot/grub2/x86_64-efi  btrfs  
subvol=/@/boot/grub2/x86_64-efi  0  0
UUID=a34c85bd-79d2-4145-8772-04be970fe413  /boot/grub2/i386-pc btrfs  
subvol=/@/boot/grub2/i386-pc  0  0
UUID=7388-F693 /boot/efi   vfat   
defaults  0  0
tmpfs /tmp tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777 0 0

When I run the playbook a second time, I don't get the error anymore and 
all is fine.

I executed "watch -n 1 ls -l /tmp/" to perodically check if ansible is 
writing anything to /tmp, and yes, it is! 
There are some temporary files which appear and disapear during the 
execution. I already added the following two lines to my ansible.cfg file:
local_tmp = /tmp2
remote_tmp = /tmp2

Unfortunately, there are still these "payload" files appearing in /tmp. 
1. Where do they come from? What do they contain and how can I change the 
directory for these files?
I guess these payload files are the reason why the mount module fails in 
the first place. 
2. Am I doing something wrong? 
3. Is a workaround possible? 
4. Has it something to do with the BTRFS filesystem? On Ubuntu this mount 
task is working... 
5. Why is it trying to umount at all? I want it to mount /tmp
I have also made a desktop capture of this behavior: 
https://drive.google.com/open?id=1Ta2-x4wUgoz1Ig3jabooHwVJV4l-SyQ1

Thanks a lot for your help!

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9b9901ce-21a7-41f7-b233-7b43036c5fb0%40googlegroups.com.
For more options, visit 

Re: [ansible-project] Re: WINDOWS MODULE TO DOWNLOAD PATCHES

2019-06-13 Thread Vandana Thakur
Win_updates modules , as i can see doesnot provides download only option .
If the changes you said are at windows client or server level , cant do
that as there are many targets servers .

Any way via ansible .. is it possible?

On Thu, 13 Jun 2019 at 22:15, 'J Hawkesworth' via Ansible Project <
ansible-project@googlegroups.com> wrote:

>
> I think if you configure your servers to use your WSUS server as its
> source of windows updates, you can use the win_updates module:
>
> https://docs.ansible.com/ansible/latest/modules/win_updates_module.html
>
> I haven't configured the windows update source myself but I believe this
> is possible via Group Policy (and is probably therefore also configurable
> by making changes to the registry).
>
> Hope this helps,
>
> Jon
> On Thursday, June 13, 2019 at 12:14:28 PM UTC+1, new_ansible wrote:
>>
>> Hello All ,
>>
>> I really need help to know that is there any  module in ansible to
>> download only the windows patches from WSUS server ?
>>
>> thanks
>>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/54ed61a3-8e23-4606-a117-c50f1c355154%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALJDb0k4_vT0vGPNLD54TV0tWanFRhAa1rzGyMyAURN8DUUUjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Containerized Ansible SSH-ing to Windows DockerHost

2019-06-13 Thread Matthew Davis
Definitely a bit of a Rube Goldberg setup there, but no reason it shouldn't 
work. The big problem is that you need to be using the Windows modules to 
manage the Windows host (eg, win_ping, not ping).

On Wednesday, June 12, 2019 at 11:39:16 AM UTC-7, Taylor Jackwood wrote:
>
> Afternoon!
>
> I am attempting to set up an Ansible Docker container for managing both 
> other containers running in Docker, as well as my host machine (Running 
> Windows 10).
>
> Using Ansible 2.8, I'm attempting to get the SSH connection to my host 
> machine to work, as using WinRM isn't ideal for my scenario. I have set up 
> OpenSSH Server on my machine, and done all of the steps to allow SSH 
> tunneling from my container to my host machine. I can even go so far as to 
> "docker exec -it ansible bash" into my container, then run an "ssh 
> dockerhost" command, and it successfully uses my SSH keys to authenticate 
> and SSH back into my host machine.
>
> My problem comes when I attempt to use Ansible from inside the container 
> to ping my host machine. Whenever I try to run "ansible dockerhost -m 
> ping", I'm met with this error:
>
>
> ==
>
> ==
>
> *dockerhost | FAILED! => {*
> *"changed": false,*
> *"module_stderr": "Exception calling \"Create\" with \"1\" 
> argument(s): \"At line:4 char:21*
> *+ def _ansiballz_main():*
> *+ ~*
> *An expression was expected after '('.*
> *At line:13 char:27*
> *+ except (AttributeError, OSError):*
> *+   ~*
> *Missing argument in parameter list.*
> *At line:15 char:7*
> *+ if scriptdir is not None:*
> *+   ~*
> *Missing '(' after 'if' in if statement.*
> *At line:22 char:7*
> *+ if sys.version_info < (3,):*
> *+*
> * ~*
> *Missing '(' after 'if' in if statement.*
> *At line:22 char:30*
> *+ if sys.version_info < (3,):*
> *+*
> * ~*
> *Missing expression after ','.*
> *At line:22 char:25*
> *+ if sys.version_info < (3,):*
> *+*
> *  ~*
> *The '<' operator is reserved for future use.*
> *At line:24 char:32*
> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
> *+~*
> *Missing expression after ','.*
> *At line:24 char:33*
> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
> *+ ~*
> *Unexpected token 'imp.PY_SOURCE' in expression or statement.*
> *At line:24 char:32*
> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
> *+*
> *~*
> *Missing closing ')' in expression.*
> *At line:24 char:46*
> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
> *+*
> *  ~*
> *Unexpected token ')' in expression or statement.*
> *Not all parse errors were reported.  Correct the reported errors and try *
> *again.\"*
> *At line:6 char:1*
> *+ $exec_wrapper = [ScriptBlock]::Create($split_parts[0])*
> *+ ~~*
> *+ CategoryInfo  : NotSpecified: (:) [], 
> MethodInvocationException*
> *+ FullyQualifiedErrorId : ParseException*
>  
> *The expression after '&' in a pipeline element produced an object that 
> was not *
> *valid. It must result in a command name, a script block, or a 
> CommandInfo *
> *object.*
> *At line:7 char:2*
> *+ &$exec_wrapper*
> *+  ~*
> *+ CategoryInfo  : InvalidOperation: (:) [], RuntimeException*
> *+ FullyQualifiedErrorId : BadExpression*
> * ",*
> *"module_stdout": "",*
> *"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",*
> *"rc": 1*
> *}*
>
>
> ==
>
> ==
>
> I've also attempted this same ping test using the win_ping module, but get 
> a different failed result. The command hangs for an extended period of 
> time, then eventually returns with this error:
>
>
> ==
>
> ==
>
> * (1, '', '#< CLIXML\r\n\nProcess is terminated due to 
> StackOverflowException.\n')*
> * Failed to connect to the host via ssh: #< CLIXML*
>
> *Process is terminated due to StackOverflowException.*
> *The full traceback is:*
> *Traceback (most recent call last):*
> *  File 
> "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 
> 144, in run*
> *res = self._execute()*
> *  File 
> "/usr/lib/python2.7/site-packages/ansible/executor/task

[ansible-project] Re: troubleshooting ansible win problem

2019-06-13 Thread Matthew Davis
Hmm, at a glance it looks like maybe there's a problem in the error handler 
where it's expecting an ErrorRecord to always be present, but in this case 
it's not. If that's what's happening, it's masking whatever the real error 
is because it's blowing up in the error handler. Can you file that output 
in a Github issue against https://github.com/ansible/ansible? 

Thanks,

-Matt


On Wednesday, June 12, 2019 at 9:23:05 AM UTC-7, William Dossett wrote:
>
> I increased memory to the VM and now getting the original error on 
> win_ping using domain acccount (sorry about the first post, just found the 
> code button)
>
>  ansible -i winhosts win-update-prod -m win_ping -vvv
> ansible 2.8.0
>   config file = /etc/ansible/ansible.cfg
>   configured module search path = 
> [u'/home/bi003do/.ansible/plugins/modules', 
> u'/usr/share/ansible/plugins/modules']
>   ansible python module location = /usr/lib/python2.7/site-packages/ansible
>   executable location = /usr/bin/ansible
>   python version = 2.7.5 (default, Apr  9 2019, 14:30:50) [GCC 4.8.5 
> 20150623 (Red Hat 4.8.5-36)]
> Using /etc/ansible/ansible.cfg as config file
> host_list declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts 
> as it did not pass it's verify_file() method
> script declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts as 
> it did not pass it's verify_file() method
> auto declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts as it 
> did not pass it's verify_file() method
> [DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set 
> to allow bad characters in group names by
> default, this will change, but still be user configurable on deprecation. 
> This feature will be removed in version 2.10.
>  Deprecation warnings can be disabled by setting 
> deprecation_warnings=False in ansible.cfg.
>  [WARNING]: Invalid characters were found in group names but not replaced, 
> use - to see details
>
> Parsed /home/domainuser/Playbooks/WinUpdate/winhosts inventory source with 
> ini plugin
> META: ran handlers
> Using module file 
> /usr/lib/python2.7/site-packages/ansible/modules/windows/win_ping.ps1
> Pipelining is enabled.
>  ESTABLISH WINRM CONNECTION FOR USER: 
> domainuser@MYDOMAIN.LOCAL on PORT 5986 TO covmgrid83
> EXEC (via pipeline wrapper)
> The full traceback is:
> Property 'ErrorRecord' cannot be found on this object. Make sure that it 
> exists.
> At line:61 char:5
> + Write-AnsibleError -Message "Unhandled exception while executing 
> module" `
> +
>  ~~
> + CategoryInfo  : NotSpecified: (:) [], 
> PropertyNotFoundException
> + FullyQualifiedErrorId : PropertyNotFoundStrict
>
> ScriptStackTrace:
> at , : line 61
> at , : line 26
> at , : line 137
> at , : line 7
>
> System.Management.Automation.PropertyNotFoundException: Property 
> 'ErrorRecord' cannot be found on this object. Make sure
>   that it exists.
>at 
> System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext
>  
> funcContext, Exception exc eption)
>at 
> System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame
>  
> frame)
>at 
> System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
>  
> frame)
>at 
> System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
>  
> frame)
> covmgrid83 | FAILED! => {
> "changed": false,
> "msg": "Failed to invoke PowerShell module: Property 'ErrorRecord' 
> cannot be found on this object. Make sure that it  
> exists."
> }
>
>
>
>
> On Wednesday, June 12, 2019 at 11:00:38 AM UTC-4, William Dossett wrote:
>>
>> Hi,
>> (sorry, this turned out rather long)
>>
>> I had windows updates running using an ansible playbook.
>>
>> I was using domain account, become, runas etc all working pretty well for 
>> the last 9 months...
>>
>> Then I upgraded ansible running on my centos 7.5 system to version 2.8 as 
>> I was working on the same system but was going to write a playbook to add a 
>> user account to aws instances...  
>>
>> someone that used this same system and a playbook I wrote to run windows 
>> updates on their windows VMs then told me his playbook stopped working
>>
>> I looked at it and it seemed there might have been kerberos problems, or 
>> domain membership problems - I wasn't getting anywhere so..
>>
>> I build a new ansible control server, joined to domain, setup 
>> pywinrm[kerberos] and more or less have a pristine system now with ansible 
>> 2.8, but I have the same problem, so it seems as though it is the uprgrade 
>> to 2.8 maybe that has caused this.
>>
>> basically, I run the playbook, it connects and gets to:
>>
>> TASK [Install Updates] 
>> 

[ansible-project] Re: CSV file formatting using ansible

2019-06-13 Thread Kethan R
I already used it, but still im getting output in this format which i 
cannot filter it ...

[image: lb.PNG]

  tasks:
- name: print date
  set_fact: temp="{{lookup('pipe','date \"+%Y-%m-%d-%H-%M\"')}}"
- name: creates file
  file: 
path: "/tmp/loadbalancer_{{ temp }}.csv"
state: touch
- name: creates file
  file: 
path: "/tmp/loadbalancer_{{ temp }}.txt"
state: touch
- name: print date
  set_fact: files="loadbalancer_{{ temp }}.csv"
- name: Run Health Checks on LoadBalancer servers
  bigip_command:
commands:
  - show sys version
  - show sys service | grep tmm
  - show ltm
  - show sys memory
provider:
  server: .
  password: "{{ x }}"
  user: "{{ x }}"
  validate_certs: no
  register: version
  delegate_to: localhost
- name: Updating variable
  copy: content="{{ version.stdout_lines | to_nice_yaml }}" 
dest="/tmp/loadbalancer_{{ temp }}.txt"
- name: Parse the CSV file
  shell: 
cmd: |
  cp -f "/tmp/loadbalancer_{{ temp }}.txt" /tmp/temp.txt
  cat /tmp/temp.txt| tr -s '[:blank:]' ' ' > "/tmp/loadbalancer_{{ 
temp }}.csv" 

On Thursday, June 13, 2019 at 11:31:46 AM UTC-5, J Hawkesworth wrote:
>
>
> Assuming you have the data from your load balancer stored in a registered 
> variable you could run copy to write the file to disk on the controller, 
> and then a shell task to use 'tr' command to convert the whitespace, tabs 
> and : to a comma, and then you would have .csv file you could process.  
> Something like the following (which I have NOT tested):
>
>
>  - name: copy loadbalancer output to disk
>copy:
> content: "{{ output_from_load_balancer }}"
> dest: /tmp/load-balancer-raw
>delegate_to: localhost
>
>
>  - name: make raw loadbalancer into csv
>shell: cat /tmp/load-balancer-raw | tr [:blank:] , | tr \: , > /tmp/
> load-balancer-raw
>delegate_to: localhost
>
>
>
> Also worth investigating are the lookups that ansible has.  See 
> https://docs.ansible.com/ansible/latest/plugins/lookup.html You might 
> want to use 
> https://docs.ansible.com/ansible/latest/plugins/lookup/csvfile.html to 
> load the csv for further processing.
>
> Also worth exploring to see if you can get more structured data out of 
> your load balancer, preferably json or yaml, both of which are much easier 
> to then use within ansible.
>
> Hope this helps,
>
> Jon
>
>
> On Thursday, June 13, 2019 at 4:19:49 PM UTC+1, Kethan R wrote:
>>
>> Recently i wrote a playbook to pull the data from Loadbalancer server. 
>> Output is saving in 1st row of each column.
>> output has : data separated with spaces, Tabs and :
>> I want to apply delimit option only on tabs spaces and : which i am not 
>> able to. Kindly suggest if you have any solution.
>>
>>
>> EX:
>> xxx::Node: IP.ip.ip.ip (ip.ip.ip.ip) 
>> -- 
>> Status 
>> Availability : available 
>> State : enabled 
>> Reason : Node address is available
>> Monitor : /Common/icmp (default node monitor)
>> Monitor Status : up 
>> Session Status : enabled 
>> Traffic  ServerSide General 
>> Bits In 0   - 
>> Bits Out 0   - 
>> Packets In 0   - 
>> Packets Out 0   - 
>> Current Connections 0   - 
>> Maximum Connections 0   - 
>> Total Connections 0   - 
>> Total Requests -   0 
>> Current Sessions -   0 
>>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/61fe8b1d-2119-409f-b0f9-d4b5add4c446%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: WINDOWS MODULE TO DOWNLOAD PATCHES

2019-06-13 Thread 'J Hawkesworth' via Ansible Project

I think if you configure your servers to use your WSUS server as its source 
of windows updates, you can use the win_updates module:

https://docs.ansible.com/ansible/latest/modules/win_updates_module.html

I haven't configured the windows update source myself but I believe this is 
possible via Group Policy (and is probably therefore also configurable by 
making changes to the registry).

Hope this helps,

Jon
On Thursday, June 13, 2019 at 12:14:28 PM UTC+1, new_ansible wrote:
>
> Hello All ,
>
> I really need help to know that is there any  module in ansible to 
> download only the windows patches from WSUS server ?
>
> thanks
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/54ed61a3-8e23-4606-a117-c50f1c355154%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variable registration is getting skipped in zypper module

2019-06-13 Thread Bobby Hood
Ah I see, thank you.

On Thursday, June 13, 2019 at 10:38:16 AM UTC-6, Matt Martz wrote:
>
> You are registering to the same variable in both tasks.  Ansible will 
> register regardless of the task being skipped or not.
>
> If the suse/zypper task executes, I assume that the apt task should skip, 
> as such, the zypper task registered with real data first, and then the apt 
> task overwrites the result with a skipped info.
>
> You should be using different register variable names for each task, to 
> avoid this issue.
>
> On Thu, Jun 13, 2019 at 11:23 AM Bobby Hood > 
> wrote:
>
>> I'm using the zypper and apt modules to update remote hosts. I don't know 
>> if I'm missing something or it's a bug, but registering a variable in the 
>> zypper module is getting skipped. It works fine in the apt module.
>>
>> - name: (SuSE) Update all packages to latest versions
>>   when: ansible_os_family == "Suse"
>>   *zy*pper:
>> name: '*'
>> state: latest
>> type: package
>> update_cache: yes
>>   register: update_result
>> - name: (Debian) Update all packages to latest versions
>>   when: ansible_os_family == "Debian"
>>   apt:
>> name: '*'
>> state: latest
>> update_cache: yes
>> force_apt_get: yes
>> autoremove: yes
>>   register: update_result
>>
>>
>>
>> This is the variable dump when using zypper. It's always *"changed": 
>> false* and *"skipped": true* even if changes are made.
>>
>> ok: [raamah] => { 
>>"update_result": { 
>>"changed": false,  
>>"skip_reason": "Conditional result was False",  
>>"skipped": true 
>>} 
>> }
>>
>>
>> However, the apt module always returns values for "msg", "stderr", and 
>> "stdout" as seen below. Am I using the zypper module incorrectly or 
>> something?
>>
>> ok: [webtest01] => { 
>>"update_result": { 
>>"changed": false,  
>>"failed": false,  
>>"msg": "Reading package lists...\nBuilding dependency 
>> tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 
>> 0 newly installed, 0 to remove and 0 not upgraded.\n", 
>>
>>"stderr": "",  
>>"stderr_lines": [],  
>>"stdout": "Reading package lists...\nBuilding dependency 
>> tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 
>> 0 newly installed, 0 to remove and 0 not upgraded.\n", 
>> 
>>"stdout_lines": [ 
>>"Reading package lists...",  
>>"Building dependency tree...",  
>>"Reading state information...",  
>>"Calculating upgrade...",  
>>"0 upgraded, 0 newly installed, 0 to remove and 0 not 
>> upgraded." 
>>] 
>>} 
>> }
>>
>> This e-mail message (including any attachments) is for the sole use of 
>> the intended recipient(s) and may contain confidential, privileged, and/or 
>> proprietary information. If the reader of this message is not the intended 
>> recipient, you are hereby notified that any dissemination, distribution or 
>> copying of this message (including any attachments) is strictly prohibited.
>>
>> If you have received this message in error, please contact the sender by 
>> reply e-mail message and destroy all copies of the original message 
>> (including attachments).
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/6029dc73-1bdb-4623-92d4-a59801c9f029%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
This e-mail message (including any attachments) is for the sole use of the 
intended recipient(s) and may contain confidential, privileged, and/or 
proprietary information. If the reader of this message is not the intended 
recipient, you are hereby notified that any dissemination, distribution or 
copying of this message (including any attachments) is strictly prohibited.


If you have received this message in error, please contact the sender by 
reply e-mail message and destroy all copies of the original message 
(including attachments).

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view th

[ansible-project] Re: troubleshooting ansible win problem

2019-06-13 Thread 'J Hawkesworth' via Ansible Project
I tend to install ansible from pip as pip makes it easy to revert to old 
versions.
I think you can install ansible via pip just for your user as well, so 
that's worth exploring.

I get that it used to work, but windows updates and unknown actions taken 
while you were working on other projects could have affected the windows 
hosts.

Bear in mind too that when you run windows updates you are at the mercy of 
whether or not MS's windows updates servers are busy or not, so it might 
just be worth killing and retrying it a few times.

One other thought.  Do you have any custom modules that you are using?  
I've burned myself in the past by using latest development versions of 
modules with a release ansible version, then upgrading months later 
upgrading and forgetting that I was using a custom module and wondering why 
whizzy new functionality in latest released module wasn't working.

That module has definitely had some updates since 2.6 so worth double 
checking you aren't picking up an old version.

Hope this helps,

Jon

On Thursday, June 13, 2019 at 12:54:38 PM UTC+1, William Dossett wrote:
>
> Hi Jon, thanks for the input... this was all working... I believe all I 
> did was upgrade from ansible 2.6 to 2.8, using the same windows hosts to 
> run against, same user - it had been working well for 8 months or so and 
> they ran the updates on about 60 VMs every month.  Then I was working on 
> another project for configuring users on aws instances and decided to 
> upgrade to 2.8 - well thats what yum did anyway when I did yum update 
> ansible.  Is there some way I can back level to 2.6 with yum? it doesn't 
> seem like it as yum list only lists ansible 2.8 - it would be nice to 
> confirm that this is what broke it anyway.
>
> I have upgraded powershell before on all the vms.  It does connect, I can 
> see in task mgr that there are 5 tasks, one powershell running as the user 
> that I am using in my ansible play.
>
> I continue to work on it anyway, thanks
>
> Bill
>
>
> On Thursday, June 13, 2019 at 3:16:12 AM UTC-4, J Hawkesworth wrote:
>>
>> I don't know what this, but I have some suggestions of things you can try.
>>
>> Check the environment variables on the target host are ok.  I'm wondering 
>> if maybe it can't find a powershell module.
>>
>> If this is a server 2008R2 box, make sure its had the memory fix update 
>> applied - see 
>> https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html#winrm-memory-hotfix
>>   
>> (or better still upgrade it to a later powershell /WMF version), as that's 
>> known to cause out of memory when you attempt to use winrm.
>>
>> Double check the winrm configuration and firewall on the remote host 
>> (although I doubt you'd be able to connect in that case).
>>
>> Make sure the destination machines can actually access the network so 
>> that they can receive windows updates.   I think you'd probably see nasty 
>> COM errors from the guts of windows if that was the case though.
>>
>> Worth checking the event log after you have run the playbook.
>>
>> Check that your domain user still has the privileges it needs.  IIRC the 
>> user needs a fair few privileges in order to run windows updates.
>>
>> Check your domain user is still a local administrator on the box.
>>
>> Also, on another tack you can try removing ansible from the equation and 
>> try the example python pywinrm script here: 
>> https://github.com/diyan/pywinrm/#run-a-process-on-a-remote-host to see 
>> if you can run commands.
>>
>> Sorry I don't have the solution but I hope something from the above list 
>> might help you fix this.
>>
>> Jon
>>
>> On Wednesday, June 12, 2019 at 5:23:05 PM UTC+1, William Dossett wrote:
>>>
>>> I increased memory to the VM and now getting the original error on 
>>> win_ping using domain acccount (sorry about the first post, just found the 
>>> code button)
>>>
>>>  ansible -i winhosts win-update-prod -m win_ping -vvv
>>> ansible 2.8.0
>>>   config file = /etc/ansible/ansible.cfg
>>>   configured module search path = 
>>> [u'/home/bi003do/.ansible/plugins/modules', 
>>> u'/usr/share/ansible/plugins/modules']
>>>   ansible python module location = 
>>> /usr/lib/python2.7/site-packages/ansible
>>>   executable location = /usr/bin/ansible
>>>   python version = 2.7.5 (default, Apr  9 2019, 14:30:50) [GCC 4.8.5 
>>> 20150623 (Red Hat 4.8.5-36)]
>>> Using /etc/ansible/ansible.cfg as config file
>>> host_list declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts 
>>> as it did not pass it's verify_file() method
>>> script declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts as 
>>> it did not pass it's verify_file() method
>>> auto declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts as 
>>> it did not pass it's verify_file() method
>>> [DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set 
>>> to allow bad characters in group names by
>>> default, this will change, but still be user configurable on 
>>> deprecation

Re: [ansible-project] Variable registration is getting skipped in zypper module

2019-06-13 Thread Matt Martz
You are registering to the same variable in both tasks.  Ansible will
register regardless of the task being skipped or not.

If the suse/zypper task executes, I assume that the apt task should skip,
as such, the zypper task registered with real data first, and then the apt
task overwrites the result with a skipped info.

You should be using different register variable names for each task, to
avoid this issue.

On Thu, Jun 13, 2019 at 11:23 AM Bobby Hood  wrote:

> I'm using the zypper and apt modules to update remote hosts. I don't know
> if I'm missing something or it's a bug, but registering a variable in the
> zypper module is getting skipped. It works fine in the apt module.
>
> - name: (SuSE) Update all packages to latest versions
>   when: ansible_os_family == "Suse"
>   *zy*pper:
> name: '*'
> state: latest
> type: package
> update_cache: yes
>   register: update_result
> - name: (Debian) Update all packages to latest versions
>   when: ansible_os_family == "Debian"
>   apt:
> name: '*'
> state: latest
> update_cache: yes
> force_apt_get: yes
> autoremove: yes
>   register: update_result
>
>
>
> This is the variable dump when using zypper. It's always *"changed":
> false* and *"skipped": true* even if changes are made.
>
> ok: [raamah] => {
>"update_result": {
>"changed": false,
>"skip_reason": "Conditional result was False",
>"skipped": true
>}
> }
>
>
> However, the apt module always returns values for "msg", "stderr", and
> "stdout" as seen below. Am I using the zypper module incorrectly or
> something?
>
> ok: [webtest01] => {
>"update_result": {
>"changed": false,
>"failed": false,
>"msg": "Reading package lists...\nBuilding dependency
> tree...\nReading state information...\nCalculating upgrade...\n0 upgraded,
> 0 newly installed, 0 to remove and 0 not upgraded.\n",
>
>"stderr": "",
>"stderr_lines": [],
>"stdout": "Reading package lists...\nBuilding dependency
> tree...\nReading state information...\nCalculating upgrade...\n0 upgraded,
> 0 newly installed, 0 to remove and 0 not upgraded.\n",
>
>"stdout_lines": [
>"Reading package lists...",
>"Building dependency tree...",
>"Reading state information...",
>"Calculating upgrade...",
>"0 upgraded, 0 newly installed, 0 to remove and 0 not
> upgraded."
>]
>}
> }
>
> This e-mail message (including any attachments) is for the sole use of the
> intended recipient(s) and may contain confidential, privileged, and/or
> proprietary information. If the reader of this message is not the intended
> recipient, you are hereby notified that any dissemination, distribution or
> copying of this message (including any attachments) is strictly prohibited.
>
> If you have received this message in error, please contact the sender by
> reply e-mail message and destroy all copies of the original message
> (including attachments).
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/6029dc73-1bdb-4623-92d4-a59801c9f029%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v9rKzs2BCrwN2nBJVBq0Y3c0CcER7em-x3yNm2tHPTjVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: CSV file formatting using ansible

2019-06-13 Thread 'J Hawkesworth' via Ansible Project

Assuming you have the data from your load balancer stored in a registered 
variable you could run copy to write the file to disk on the controller, 
and then a shell task to use 'tr' command to convert the whitespace, tabs 
and : to a comma, and then you would have .csv file you could process.  
Something like the following (which I have NOT tested):


 - name: copy loadbalancer output to disk
   copy:
content: "{{ output_from_load_balancer }}"
dest: /tmp/load-balancer-raw
   delegate_to: localhost


 - name: make raw loadbalancer into csv
   shell: cat /tmp/load-balancer-raw | tr [:blank:] , | tr \: , > /tmp/load-
balancer-raw
   delegate_to: localhost



Also worth investigating are the lookups that ansible has.  See 
https://docs.ansible.com/ansible/latest/plugins/lookup.html You might want 
to use https://docs.ansible.com/ansible/latest/plugins/lookup/csvfile.html 
to load the csv for further processing.

Also worth exploring to see if you can get more structured data out of your 
load balancer, preferably json or yaml, both of which are much easier to 
then use within ansible.

Hope this helps,

Jon


On Thursday, June 13, 2019 at 4:19:49 PM UTC+1, Kethan R wrote:
>
> Recently i wrote a playbook to pull the data from Loadbalancer server. 
> Output is saving in 1st row of each column.
> output has : data separated with spaces, Tabs and :
> I want to apply delimit option only on tabs spaces and : which i am not 
> able to. Kindly suggest if you have any solution.
>
>
> EX:
> xxx::Node: IP.ip.ip.ip (ip.ip.ip.ip) 
> -- 
> Status 
> Availability : available 
> State : enabled 
> Reason : Node address is available
> Monitor : /Common/icmp (default node monitor)
> Monitor Status : up 
> Session Status : enabled 
> Traffic  ServerSide General 
> Bits In 0   - 
> Bits Out 0   - 
> Packets In 0   - 
> Packets Out 0   - 
> Current Connections 0   - 
> Maximum Connections 0   - 
> Total Connections 0   - 
> Total Requests -   0 
> Current Sessions -   0 
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/09ca3d78-e6a0-4c39-996d-96f16ce3d125%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Variable registration is getting skipped in zypper module

2019-06-13 Thread Bobby Hood
I'm using the zypper and apt modules to update remote hosts. I don't know 
if I'm missing something or it's a bug, but registering a variable in the 
zypper module is getting skipped. It works fine in the apt module.

- name: (SuSE) Update all packages to latest versions
  when: ansible_os_family == "Suse"
  *zy*pper:
name: '*'
state: latest
type: package
update_cache: yes
  register: update_result
- name: (Debian) Update all packages to latest versions
  when: ansible_os_family == "Debian"
  apt:
name: '*'
state: latest
update_cache: yes
force_apt_get: yes
autoremove: yes
  register: update_result



This is the variable dump when using zypper. It's always *"changed": false*
 and *"skipped": true* even if changes are made.

ok: [raamah] => { 
   "update_result": { 
   "changed": false,  
   "skip_reason": "Conditional result was False",  
   "skipped": true 
   } 
}


However, the apt module always returns values for "msg", "stderr", and 
"stdout" as seen below. Am I using the zypper module incorrectly or 
something?

ok: [webtest01] => { 
   "update_result": { 
   "changed": false,  
   "failed": false,  
   "msg": "Reading package lists...\nBuilding dependency 
tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 
0 newly installed, 0 to remove and 0 not upgraded.\n", 
   
   "stderr": "",  
   "stderr_lines": [],  
   "stdout": "Reading package lists...\nBuilding dependency 
tree...\nReading state information...\nCalculating upgrade...\n0 upgraded, 
0 newly installed, 0 to remove and 0 not upgraded.\n", 

   "stdout_lines": [ 
   "Reading package lists...",  
   "Building dependency tree...",  
   "Reading state information...",  
   "Calculating upgrade...",  
   "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." 
   ] 
   } 
}

-- 
This e-mail message (including any attachments) is for the sole use of the 
intended recipient(s) and may contain confidential, privileged, and/or 
proprietary information. If the reader of this message is not the intended 
recipient, you are hereby notified that any dissemination, distribution or 
copying of this message (including any attachments) is strictly prohibited.


If you have received this message in error, please contact the sender by 
reply e-mail message and destroy all copies of the original message 
(including attachments).

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6029dc73-1bdb-4623-92d4-a59801c9f029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Containerized Ansible SSH-ing to Windows DockerHost

2019-06-13 Thread 'J Hawkesworth' via Ansible Project
The thing that's confused me is that you have set

*ansible_python_interpreter='C:\Program Files\Python\Python3.6.4'*


which looks like you are trying to use a windows installation of python to 
run with, and I'm pretty certain that's not going to fly.

Even when you are using ssh to talk to your windows hosts, the modules you 
will use will still be implemented in powershell.

Hope that helps a bit.  I haven't tried the ssh support myself yet, so I'm 
sorry I can't hel with that part.

Jon
On Thursday, June 13, 2019 at 2:13:20 PM UTC+1, Taylor Jackwood wrote:
>
> Hey J,
>
> My initial post may have been a bit confusing: I am running my Ansible 
> controller inside of a Linux container already, and it functions well when 
> I use that Ansible controller container to control other Linux-based 
> environments.
>
> My problem is that my Ansible container is running in Docker on a Windows 
> host machine. I'm attempting to make it so that my Ansible Linux container 
> running in Docker can control my host machine as a Windows-based Ansible 
> Node.
>
> To reiterate from my initial post, I'm opting to try the latest 
> experimental SSH support for controlling Windows-based nodes (WinRM isn't a 
> good fit for us at the moment). I can successfully SSH from my Ansible 
> Linux container to my Windows docker host machine, but I can't seem to get 
> Ansible to successfully ping my Windows host machine.
>
> Hope that clears some confusion,
>
> Thanks!
>
>
> On Thursday, June 13, 2019 at 3:25:16 AM UTC-4, J Hawkesworth wrote:
>>
>> I'm not sure I fully follow how you are trying to set this up, but 
>> windows is not supported for running ansible itself, as stated here: 
>> https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#control-node-requirements
>>
>> I am out of touch with the latest state of windows support for containers 
>> but I think you'd need to run a linux container for the ansible 
>> controller.  I think that may be possible now with latest versions, but as 
>> I say I'm not sure.
>>
>> Sorry that's probably not what you want to hear. Personally I have used 
>> WSL aka 'Bash on Ubuntu on Windows' for some time now and it works just 
>> fine for running playbooks from while developing playbooks.  I have full 
>> blown linux nodes for production ansible runs though.
>>
>> Jon
>>
>>
>> On Wednesday, June 12, 2019 at 7:39:16 PM UTC+1, Taylor Jackwood wrote:
>>>
>>> Afternoon!
>>>
>>> I am attempting to set up an Ansible Docker container for managing both 
>>> other containers running in Docker, as well as my host machine (Running 
>>> Windows 10).
>>>
>>> Using Ansible 2.8, I'm attempting to get the SSH connection to my host 
>>> machine to work, as using WinRM isn't ideal for my scenario. I have set up 
>>> OpenSSH Server on my machine, and done all of the steps to allow SSH 
>>> tunneling from my container to my host machine. I can even go so far as to 
>>> "docker exec -it ansible bash" into my container, then run an "ssh 
>>> dockerhost" command, and it successfully uses my SSH keys to authenticate 
>>> and SSH back into my host machine.
>>>
>>> My problem comes when I attempt to use Ansible from inside the container 
>>> to ping my host machine. Whenever I try to run "ansible dockerhost -m 
>>> ping", I'm met with this error:
>>>
>>>
>>> ==
>>>
>>> ==
>>>
>>> *dockerhost | FAILED! => {*
>>> *"changed": false,*
>>> *"module_stderr": "Exception calling \"Create\" with \"1\" 
>>> argument(s): \"At line:4 char:21*
>>> *+ def _ansiballz_main():*
>>> *+ ~*
>>> *An expression was expected after '('.*
>>> *At line:13 char:27*
>>> *+ except (AttributeError, OSError):*
>>> *+   ~*
>>> *Missing argument in parameter list.*
>>> *At line:15 char:7*
>>> *+ if scriptdir is not None:*
>>> *+   ~*
>>> *Missing '(' after 'if' in if statement.*
>>> *At line:22 char:7*
>>> *+ if sys.version_info < (3,):*
>>> *+*
>>> * ~*
>>> *Missing '(' after 'if' in if statement.*
>>> *At line:22 char:30*
>>> *+ if sys.version_info < (3,):*
>>> *+*
>>> * ~*
>>> *Missing expression after ','.*
>>> *At line:22 char:25*
>>> *+ if sys.version_info < (3,):*
>>> *+*
>>> *  ~*
>>> *The '<' operator is reserved for future use.*
>>> *At line:24 char:32*
>>> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
>>> *+~*
>>> *Missing expression after ','.*
>>> *At line:24 char:33*
>>> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
>>> *+ ~*
>>> *Unexpected token 'imp.PY_SOURCE' in expression or statement.*
>>> *At line:24 char:32*
>>> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
>>> *+*
>>> *

Re: [ansible-project] Ansible modules to pull info from checkpoint firewall

2019-06-13 Thread Kethan R
no Luck.

[WARNING]: sftp transfer mechanism failed on [x]. Use ANSIBLE_DEBUG=1
19
to see detailed information
20
21
[WARNING]: No python interpreters found for host xx(tried
22
['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7',
23
'python2.6', '/usr/libexec/platform-python', '/usr/bin/python3', 'python'])
24
25
fatal: [x]: FAILED! => {"ansible_facts": 
{"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, 
"module_stderr": "Shared connection to x closed.\r\n", "module_stdout": 
"/bin/sh: /usr/bin/python: No such file or directory\r\n", "msg": "The 
module failed to execute correctly, you probably need to set the 
interpreter.\nSee stdout/stderr for the exact error", "rc": 127}


On Thursday, June 13, 2019 at 10:48:13 AM UTC-5, Jonathan Lozada De La 
Matta wrote:
>
> try adding gather_facts: False like
>
> -- host: all
> gather_facts: False
>
> then try again.
>
> On Thu, Jun 13, 2019 at 11:36 AM Kethan R  > wrote:
>
>> This is the error:
>> fatal: [xx]: FAILED! => {"ansible_facts": {}, "changed": false, 
>> "msg": "The following modules failed to execute: setup\n setup: The module 
>> failed to execute correctly, you probably need to set the interpreter.\nSee 
>> stdout/stderr for the exact error\n"}
>> This is the playbook
>> - hosts: all
>>   tasks:
>> - name: Run script
>>   checkpoint_run_script:
>>  script_name: "List root"
>>  script: ls -l /
>>  targets:
>>- mycheckpointgw
>>
>> If any modification to this play book or if you have different module 
>> both ok for me
>>
>> On Thursday, June 13, 2019 at 10:30:51 AM UTC-5, Kethan R wrote:
>>>
>>> 2.8.1, i am running scripts using AWX. 
>>>
>>> On Thursday, June 13, 2019 at 10:27:05 AM UTC-5, Jonathan Lozada De La 
>>> Matta wrote:

 what ansible version are you using?

 On Thu, Jun 13, 2019 at 11:21 AM Kethan R  wrote:

> Need some sample ansible playbooks to pull info from checkpoint 
> firewall servers...
>
> -- 
> 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...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/d618a815-fecc-4b98-90e9-9d61021cd3df%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


 -- 

 Jonathan Cha'gara Lozada De La Matta 

 He / Him / His

 Automation Practice

 Senior Automation Consultant & Automation CoP Manager 

 Red Hat  
 @redhatjobs    redhatjobs 
  @redhatjobs 
    
  

  

 -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/44c4be95-0f1c-46ab-9084-7b0597f57aae%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
>
> Jonathan Cha'gara Lozada De La Matta 
>
> He / Him / His
>
> Automation Practice
>
> Senior Automation Consultant & Automation CoP Manager 
>
> Red Hat  
> @redhatjobs    redhatjobs 
>  @redhatjobs 
>    
>  
>
>  
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/df9f42ab-641f-47ab-a179-6972ba8efacd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible modules to pull info from checkpoint firewall

2019-06-13 Thread Jonathan Lozada De La Matta
try adding gather_facts: False like

-- host: all
gather_facts: False

then try again.

On Thu, Jun 13, 2019 at 11:36 AM Kethan R  wrote:

> This is the error:
> fatal: [xx]: FAILED! => {"ansible_facts": {}, "changed": false, "msg":
> "The following modules failed to execute: setup\n setup: The module failed
> to execute correctly, you probably need to set the interpreter.\nSee
> stdout/stderr for the exact error\n"}
> This is the playbook
> - hosts: all
>   tasks:
> - name: Run script
>   checkpoint_run_script:
>  script_name: "List root"
>  script: ls -l /
>  targets:
>- mycheckpointgw
>
> If any modification to this play book or if you have different module both
> ok for me
>
> On Thursday, June 13, 2019 at 10:30:51 AM UTC-5, Kethan R wrote:
>>
>> 2.8.1, i am running scripts using AWX.
>>
>> On Thursday, June 13, 2019 at 10:27:05 AM UTC-5, Jonathan Lozada De La
>> Matta wrote:
>>>
>>> what ansible version are you using?
>>>
>>> On Thu, Jun 13, 2019 at 11:21 AM Kethan R  wrote:
>>>
 Need some sample ansible playbooks to pull info from checkpoint
 firewall servers...

 --
 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...@googlegroups.com.
 To post to this group, send email to ansible...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/d618a815-fecc-4b98-90e9-9d61021cd3df%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>> --
>>>
>>> Jonathan Cha'gara Lozada De La Matta
>>>
>>> He / Him / His
>>>
>>> Automation Practice
>>>
>>> Senior Automation Consultant & Automation CoP Manager
>>>
>>> Red Hat 
>>> @redhatjobs    redhatjobs
>>>  @redhatjobs
>>> 
>>> 
>>>
>>>
>>>
>>> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/44c4be95-0f1c-46ab-9084-7b0597f57aae%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Jonathan Cha'gara Lozada De La Matta

He / Him / His

Automation Practice

Senior Automation Consultant & Automation CoP Manager

Red Hat 
@redhatjobs    redhatjobs
 @redhatjobs



-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BK4EhBCnqrykwrhcPKEawSq%2BGQmeNcMyOb-iXJPaVrTFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible modules to pull info from checkpoint firewall

2019-06-13 Thread Kethan R
This is the error:
fatal: [xx]: FAILED! => {"ansible_facts": {}, "changed": false, "msg": 
"The following modules failed to execute: setup\n setup: The module failed 
to execute correctly, you probably need to set the interpreter.\nSee 
stdout/stderr for the exact error\n"}
This is the playbook
- hosts: all
  tasks:
- name: Run script
  checkpoint_run_script:
 script_name: "List root"
 script: ls -l /
 targets:
   - mycheckpointgw

If any modification to this play book or if you have different module both 
ok for me

On Thursday, June 13, 2019 at 10:30:51 AM UTC-5, Kethan R wrote:
>
> 2.8.1, i am running scripts using AWX. 
>
> On Thursday, June 13, 2019 at 10:27:05 AM UTC-5, Jonathan Lozada De La 
> Matta wrote:
>>
>> what ansible version are you using?
>>
>> On Thu, Jun 13, 2019 at 11:21 AM Kethan R  wrote:
>>
>>> Need some sample ansible playbooks to pull info from checkpoint firewall 
>>> servers...
>>>
>>> -- 
>>> 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...@googlegroups.com.
>>> To post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/d618a815-fecc-4b98-90e9-9d61021cd3df%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> -- 
>>
>> Jonathan Cha'gara Lozada De La Matta 
>>
>> He / Him / His
>>
>> Automation Practice
>>
>> Senior Automation Consultant & Automation CoP Manager 
>>
>> Red Hat  
>> @redhatjobs    redhatjobs 
>>  @redhatjobs 
>>    
>>  
>>
>>  
>>
>>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/44c4be95-0f1c-46ab-9084-7b0597f57aae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible modules to pull info from checkpoint firewall

2019-06-13 Thread Kethan R
2.8.1, i am running scripts using AWX. 

On Thursday, June 13, 2019 at 10:27:05 AM UTC-5, Jonathan Lozada De La 
Matta wrote:
>
> what ansible version are you using?
>
> On Thu, Jun 13, 2019 at 11:21 AM Kethan R  > wrote:
>
>> Need some sample ansible playbooks to pull info from checkpoint firewall 
>> servers...
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/d618a815-fecc-4b98-90e9-9d61021cd3df%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
>
> Jonathan Cha'gara Lozada De La Matta 
>
> He / Him / His
>
> Automation Practice
>
> Senior Automation Consultant & Automation CoP Manager 
>
> Red Hat  
> @redhatjobs    redhatjobs 
>  @redhatjobs 
>    
>  
>
>  
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/86daa0b5-c2da-44fd-b01c-6fe1bb1fd52c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible modules to pull info from checkpoint firewall

2019-06-13 Thread Jonathan Lozada De La Matta
what ansible version are you using?

On Thu, Jun 13, 2019 at 11:21 AM Kethan R  wrote:

> Need some sample ansible playbooks to pull info from checkpoint firewall
> servers...
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/d618a815-fecc-4b98-90e9-9d61021cd3df%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Jonathan Cha'gara Lozada De La Matta

He / Him / His

Automation Practice

Senior Automation Consultant & Automation CoP Manager

Red Hat 
@redhatjobs    redhatjobs
 @redhatjobs



-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFYJA%2B%2BZzUzW5qA6%3Dv7rHD7%3DVfk0KD8Q3gc3U12-hrgMUNjhNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible modules to pull info from checkpoint firewall

2019-06-13 Thread Kethan R
Need some sample ansible playbooks to pull info from checkpoint firewall 
servers...

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d618a815-fecc-4b98-90e9-9d61021cd3df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] CSV file formatting using ansible

2019-06-13 Thread Kethan R
Recently i wrote a playbook to pull the data from Loadbalancer server. 
Output is saving in 1st row of each column.
output has : data separated with spaces, Tabs and :
I want to apply delimit option only on tabs spaces and : which i am not 
able to. Kindly suggest if you have any solution.


EX:
xxx::Node: IP.ip.ip.ip (ip.ip.ip.ip) 
-- 
Status 
Availability : available 
State : enabled 
Reason : Node address is available
Monitor : /Common/icmp (default node monitor)
Monitor Status : up 
Session Status : enabled 
Traffic  ServerSide General 
Bits In 0   - 
Bits Out 0   - 
Packets In 0   - 
Packets Out 0   - 
Current Connections 0   - 
Maximum Connections 0   - 
Total Connections 0   - 
Total Requests -   0 
Current Sessions -   0 

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ca290cfc-4954-4fcc-b814-982ccb2641ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: vars precedence

2019-06-13 Thread Laurent Hoss
> For this I use group_vars but with the vars/main.yml hack is impossible 
to override.

- An earlier post with the same or similar question:
https://groups.google.com/d/msg/ansible-project/jFf1KfoWxBA/KXmcsQZqAQAJ

- Please upvote your favorite solution, in the proposals I gathered in 
following post:
https://github.com/ansible/proposals/pull/21#issuecomment-470048538 


On Tuesday, June 19, 2018 at 6:12:07 PM UTC+2, dead_g...@hotmail.com wrote:
>
> Hello there!
>
> I'm having issues with vars precedence, hope you can help me here.
>
> I'm currently using geerlingguy.ansible-role-postgresql as a dependency of 
> my own postgresql role. Is define as a dependency in meta and I'm using 
> import_role in my main task.
>
> I was using vars/main.yml on my own role to override the defaults but now 
> I need to extend my own role a bit like defining diferent variables 
> depending from which group is the server in the inventory.
>
> For this I use group_vars but with the vars/main.yml hack is impossible to 
> override.
>
> What would be the best practice here?
>
> Best,
> Miracle Max
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7dd7bd09-1e32-4119-955d-fba395b0d125%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: defaults files per os and release

2019-06-13 Thread Laurent Hoss
I've got the same issue (in various roles) and still cannot foresee a good 
enough fix exists (or planned)

- An earlier post with the same question:
https://groups.google.com/d/msg/ansible-project/jFf1KfoWxBA/KXmcsQZqAQAJ

- Please upvote your favorite solution, in the proposals I gathered in 
following post:
https://github.com/ansible/proposals/pull/21#issuecomment-470048538 

On Tuesday, March 28, 2017 at 6:33:29 PM UTC+2, Mike Ray wrote:
>
> In the current Ansible setup, you can have 1 file in defaults (i.e. 
> defaults/main.yml) and it is used for all hosts that run that task, no 
> matter what the host.
>
> In our use case, we have found it would be highly advantageous to be able 
> to have os-specific and release-specific defaults files. For instance, some 
> applications change directives between releases -- using a directive in a 
> release that doesn't support it, in the best case just issues a warning 
> (which is not ideal), but in the far more likely case, breaks something.
>
> We cannot use include_vars as this completely ruins precedence: 
> http://docs.ansible.com/ansible/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable
>
> To illustrate, here is an example/outline of our setup:
>
> file structure:
> - inventory/production/host_vars/mail-server-1
> - inventory/production/group_vars/mail-servers
> - roles/servers/mail-server
> - roles/postfix
> - mail-server.yml
>
> mail-server.yml:
> roles:
> - roles/servers/mail-server
>
> roles/servers/mail-server/meta/main.yml:
> dependencies:
> - { role: postfix }
>
>
> summary: What the above is trying to illustrate, is that we have our 
> re-usable building blocks in "roles" and server-specific setups in 
> "roles/servers", e.g. the "mail-server" role runs through postfix as meta, 
> and then runs through its own tasks. This gives us the flexibility to:
> - set host-specific vars in the inventory host_vars variables (e.g. 
> relayhost="")
> - set vars common to particular groupings of mail servers in inventory 
> group_vars variables (e.g. relay_domains=domain.foo)
> - set vars common to mail-servers in general in 
> roles/servers/mail-server/vars (e.g. 
> content-filter=smtp-amavis:[127.0.0.1]:10024)
> - set vars for everything that runs the postfix role (e.g. 
> heloname="{{ ansible_hostname }}")
>
> If for example, we were to use include_vars to try to include variables 
> specific to CentOS, it would be the highest precedence and override host 
> specific settings with generic CentOS stuff.
>
>
>
> Our current working solution is to do a large amount of "union-ing" in the 
> defaults file based on variables, i.e. to get the proper postfix 
> configuration options trusty v. xenial:
> postfix_configuration_options: "{{ 
> postfix_common_configuration_options | union( 
> (ansible_distribution_release=='xenial') | 
> ternary(postfix_xenial_configuration_options,[]) ) | union( 
> (ansible_distribution_release=='trusty') | 
> ternary(postfix_trusty_configuration_options,[]) ) }}"
>
> This is not ideal for a number of reasons:
> - unless you already know what it does, it can take some time to 
> figure out
> - it gets messier and messier the more distributions you support
> - it'll get slower to run the more distributions are supported
>
> But is still useful as you can have a common template for everything then:
> main.cf.j2:
> # {{ ansible_managed }}
> {% for item in postfix_configuration_options %}
> {% if item.option is defined and item.value is defined %}
> {% if item.comment is defined %}
> {{ item.comment }}
> {% endif %}
> {{ item.option }} = {{ item.value }}
> {% endif %}
> {% endfor %}
>
>
>
>
> What we had planned on doing was using the meta structure to include 
> specific roles with particular defaults based on os and release, e.g.:
>
> - mail-server.yml:
> roles:
> - meta/postfix
>
> - meta/postfix/meta/main.yml:
> dependencies:
>   - { role: os/CentOS/postfix, when: ansible_distribution == 
> 'CentOS' }
>   - { role: releases/trusty/postfix, when: 
> ansible_distribution_release == 'trusty' }
>   - { role: releases/xenial/postfix, when: 
> ansible_distribution_release == 'xenial' }
>   - { role: postfix }
>
> - release/trusty/postfix/defaults/main.yml:
> postfix_configuration_options:
> postscreen_dnsbl_ttl
>
> - release/trusty
> postfix_configuration_options:
> address_verify_pending_request_limit
> 
> And then in the aforementioned main.cf.j2, xenial hosts would define 
> "address_verify_pending_request_limit" (which is not a thing available in 
> the postfix release for trusty) and trusty hosts would define 
> "postscreen_dnsbl_ttl" (which is not a thing available in the postfix 
> release for xenial).
>
> While it works for tha

[ansible-project] Error when i use shell: ./mon_script

2019-06-13 Thread Ryad karkar
Hi,

I have one script deployment.sh, when i play this next task, i have one 
message error :

- name: "Execut script deployment.sh"
  shell: ./deployment.sh
  delegate_to: localhost

*The next is message error :*

failed: [my_host -> localhost] => {"changed": true, "cmd": 
"./deployment.sh", "delta": "0:00:04.317850", "end": "2019-06-13 
16:32:22.757213", "rc": 1, "start": "2019-06-13 16:32:18.439363"}
stderr: Traceback (most recent call last):
  File "/mssql-cli/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
  File "/mssql-cli/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "/mssql-cli/lib/python3.6/site-packages/mssqlcli/main.py", line 101, 
in 
main()
  File "/mssql-cli/lib/python3.6/site-packages/mssqlcli/main.py", line 94, 
in main
run_cli_with(mssqlcli_options)
  File "/mssql-cli/lib/python3.6/site-packages/mssqlcli/main.py", line 56, 
in run_cli_with
mssqlcli.run()
  File "/mssql-cli/lib/python3.6/site-packages/mssqlcli/mssql_cli.py", line 
367, in run
self.cli = self._build_cli(history)
  File "/mssql-cli/lib/python3.6/site-packages/mssqlcli/mssql_cli.py", line 
471, in _build_cli
eventloop=self.eventloop)
  File 
"/mssql-cli/lib/python3.6/site-packages/prompt_toolkit/interface.py", line 
80, in __init__
self.output = output or create_output()
  File 
"/mssql-cli/lib/python3.6/site-packages/prompt_toolkit/shortcuts.py", line 
126, in create_output
ansi_colors_only=ansi_colors_only, term=term)
  File 
"/mssql-cli/lib/python3.6/site-packages/prompt_toolkit/terminal/vt100_output.py",
 
line 424, in from_pty
assert stdout.isatty()
AssertionError

FATAL: all hosts have already failed -- aborting


Someone have idea please why i have this message error ?

Thanks for your help community Ansible !!! :)

Regards,

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/84bd222a-4498-44ff-8016-0888af34ef7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible-test refuses to run, citing Python 2.7 is not supported

2019-06-13 Thread Matt Martz
validate-modules now only works on Python 3.5+

On Wed, Jun 12, 2019 at 6:09 PM 'evanmc' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> I can't seem to get ansible-test to work with Python 2.7.  Any ideas?
>
> ansible-test sanity -vvv --docker --python 2.7 --test validate-modules
>
> ... omitted ...
>
> OME=/root
> LC_ALL=en_US.UTF-8
> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
> Sanity check using validate-modules
> WARNING: Skipping validate-modules on unsupported Python version 2.7.
> No tests applicable.
> WARNING: Reviewing previous 1 warning(s):
> WARNING: Skipping validate-modules on unsupported Python version 2.7.
> Run command: docker exec
> ed8d171ede4a30af1ade4f777ea9fd983f0a3cae1e968b2643f46f7fb1ccbe04 tar czf
> /root/results.tgz -C  ...
> Working directory: /home/emcginnis/workspace/ansible-testing/ansible
> Program found: /usr/bin/docker
> HOME=/home/emcginnis
>
>
> Except it's not just 2.7, although that is what I am using.  If I specify
> 2.6 above, I get the same thing.
>
> -Evan0
>
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/92237fc7-5bba-4482-8e76-efad42a357e5%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v8_Dg64fnxo%3Duz2Ais6cBjzZhkcKsNGoL9v%2BU5mwU%2BpAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible iterate from file and populate template

2019-06-13 Thread Nicola Contu
Hey Sebastian,
thanks for your reply.

But once I read from the csv how do I get the variables populated and how 
to iterate?

I have something like this now

- hosts: dev
  become: yes
  become_method: sudo
  vars:
username: "{{ users.0 }}"
ad_username: "{{ users.1 }}"
vhost_id: "{{ users.2 }}"
  tasks:
- name: Read users from CSV file and return a list
  read_csv:
  path: /home/ncontu/users.csv
  delimiter: ';'
  register: users
- name: Ansible Template
  template:
src: 
/usr/local/cmd-sysadmin/automation/ansible/cmd/files/templates/apache_vhost_api_private_public.j2
dest: /usr/local/apache2.4/conf/vhosts/v2/{{ vhost_id }}_{{ 
username }}_apis.vhost.conf
loop: users
- name: Add vhost to httpd.conf
  shell: echo "Include conf/vhosts/v2/{{ vhost_id }}_{{ username 
}}_apis.vhost.conf" >> /usr/local/apache2.4/conf/httpd.conf
  loop: users

Il giorno giovedì 13 giugno 2019 15:50:59 UTC+2, Sebastian Meyer ha scritto:
>
> Hi Nicola, 
>
> On 13.06.19 15:06, Nicola Contu wrote: 
> > As I have too many vhosts to be created, I got a file from where I would 
> > like to read content, iterate it, populate variables and push the file. 
> > 
> > The file is like this : 
> > 5;yyy;y 
> > 70;;zzz 
> > 
> > I can modify the file to include the header, to be , delimited.. 
> whatever. 
>
> Since this is basically a CSV file, you might have a look at the 
> read_csv module. 
>
> https://docs.ansible.com/ansible/latest/modules/read_csv_module.html 
>
> This is only available in Ansible 2.8 though, for older versions you 
> might use the csvfile lookup. 
>
> https://docs.ansible.com/ansible/latest/plugins/lookup/csvfile.html 
>
> Regards 
> Sebastian 
>
> -- 
> Sebastian Meyer 
> Linux Consultant & Trainer 
> Mail: me...@b1-systems.de  
>
> B1 Systems GmbH 
> Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de 
> GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a6d3036d-7f8e-41ff-9e76-15141aa53d02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible iterate from file and populate template

2019-06-13 Thread Sebastian Meyer
Hi Nicola,

On 13.06.19 15:06, Nicola Contu wrote:
> As I have too many vhosts to be created, I got a file from where I would 
> like to read content, iterate it, populate variables and push the file.
> 
> The file is like this :
> 5;yyy;y
> 70;;zzz
> 
> I can modify the file to include the header, to be , delimited.. whatever. 

Since this is basically a CSV file, you might have a look at the
read_csv module.

https://docs.ansible.com/ansible/latest/modules/read_csv_module.html

This is only available in Ansible 2.8 though, for older versions you
might use the csvfile lookup.

https://docs.ansible.com/ansible/latest/plugins/lookup/csvfile.html

Regards
Sebastian

-- 
Sebastian Meyer
Linux Consultant & Trainer
Mail: me...@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/51ca1b5c-84dc-6b52-8d5a-221b44725d1a%40b1-systems.de.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: HOw to send email withe the Two register variables.

2019-06-13 Thread Raj Martha
i am getting the below error,,,

 msg: |-
The task includes an option with an undefined variable. The error was: 
'cur_datemqm' is undefined

The error appears to have been in 
'/opt/WebSphere/scripts/Applications/projects/timetravel/printdate.yml': 
line 23, column 9, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

   msg: "Current Date on TT servers is: {{ cur_date}}"
  - name: "Displaying the Current Date on the TT servers"
^ here


On Wednesday, June 12, 2019 at 1:43:27 PM UTC-5, Raj Martha wrote:
>
> Hi All,
>
> i am trying to send an one email after the playbook is done, but some how 
> i am getting the errors, i have tow tasks, and the out put of that tasks i 
> defined  as two set_facts, but some reason it is not working if i use the 
> two set-facts, if i use only one set_fact it is working fine, below is my 
> playbook, can some one please help me?
>
>
>
> ---
>   - hosts: all
> become: true
> tasks:
>   - name: "Printing the Date on the servers as wsadmin user"
> become_user: wsadmin
> shell: "date"
> register: current_date
> when: (inventory_hostname in groups ['wsadmindate'])
>   - name: "Printing the Date on the servers as mqm user"
> become_user: mqm
> shell: "date"
> register: current_date_mqm
> when: (inventory_hostname in groups ['mqmdate'])
>   - set_fact:
>cur_date: "{{ current_date.stdout[0:]}}"
> #   cur_datemqm: "{{ current_date_mqm.stdout[0:]}}"
> run_once: True
> with_items: (inventory_hostname in groups ['wsadmindate'])
>   - name: "Displaying the Current Date on the TT servers"
> debug:
>msg: "Current Date on TT servers is: {{ cur_date}}"
>   - set_fact:
>cur_datemqm: "{{ current_date_mqm.stdout}}"
> with_items: (inventory_hostname in groups ['mqmdate'])
>   - name: "Displaying the Current Date on the TT servers"
> debug:
>msg: "Current Date on TT servers is: {{ cur_datemqm}}"
>   - name: "Email The Results"
> mail:
>   to: kanna.rajes...@gmail.com
>   subject: "TT Email from Ansible With Server Date"
>   body: |
>{% for host in groups ['wsadmindate'] %}
>Server {{ host }} Current Date is: {{ 
> hostvars[host]['cur_date'] }}
>{% endfor %}
>   from: deploy
> delegate_to: localhost
> run_once: True
>   - name: "Email The Results As MQM user"
> mail:
>   to: kanna.rajes...@gmail.com
>   subject: "TT Email from Ansible With Server Date"
>   body: |
>{% for host in play_hosts  %}
>Server {{ host }} Current Date is: {{ 
> hostvars[host]['cur_datemqm'] }}
>{% endfor %}
>   from: deploy
> delegate_to: localhost
> run_once: True
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/245ee70f-07e9-4268-af87-48ac0d9ab0ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Containerized Ansible SSH-ing to Windows DockerHost

2019-06-13 Thread Taylor Jackwood
Hey J,

My initial post may have been a bit confusing: I am running my Ansible 
controller inside of a Linux container already, and it functions well when 
I use that Ansible controller container to control other Linux-based 
environments.

My problem is that my Ansible container is running in Docker on a Windows 
host machine. I'm attempting to make it so that my Ansible Linux container 
running in Docker can control my host machine as a Windows-based Ansible 
Node.

To reiterate from my initial post, I'm opting to try the latest 
experimental SSH support for controlling Windows-based nodes (WinRM isn't a 
good fit for us at the moment). I can successfully SSH from my Ansible 
Linux container to my Windows docker host machine, but I can't seem to get 
Ansible to successfully ping my Windows host machine.

Hope that clears some confusion,

Thanks!


On Thursday, June 13, 2019 at 3:25:16 AM UTC-4, J Hawkesworth wrote:
>
> I'm not sure I fully follow how you are trying to set this up, but windows 
> is not supported for running ansible itself, as stated here: 
> https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#control-node-requirements
>
> I am out of touch with the latest state of windows support for containers 
> but I think you'd need to run a linux container for the ansible 
> controller.  I think that may be possible now with latest versions, but as 
> I say I'm not sure.
>
> Sorry that's probably not what you want to hear. Personally I have used 
> WSL aka 'Bash on Ubuntu on Windows' for some time now and it works just 
> fine for running playbooks from while developing playbooks.  I have full 
> blown linux nodes for production ansible runs though.
>
> Jon
>
>
> On Wednesday, June 12, 2019 at 7:39:16 PM UTC+1, Taylor Jackwood wrote:
>>
>> Afternoon!
>>
>> I am attempting to set up an Ansible Docker container for managing both 
>> other containers running in Docker, as well as my host machine (Running 
>> Windows 10).
>>
>> Using Ansible 2.8, I'm attempting to get the SSH connection to my host 
>> machine to work, as using WinRM isn't ideal for my scenario. I have set up 
>> OpenSSH Server on my machine, and done all of the steps to allow SSH 
>> tunneling from my container to my host machine. I can even go so far as to 
>> "docker exec -it ansible bash" into my container, then run an "ssh 
>> dockerhost" command, and it successfully uses my SSH keys to authenticate 
>> and SSH back into my host machine.
>>
>> My problem comes when I attempt to use Ansible from inside the container 
>> to ping my host machine. Whenever I try to run "ansible dockerhost -m 
>> ping", I'm met with this error:
>>
>>
>> ==
>>
>> ==
>>
>> *dockerhost | FAILED! => {*
>> *"changed": false,*
>> *"module_stderr": "Exception calling \"Create\" with \"1\" 
>> argument(s): \"At line:4 char:21*
>> *+ def _ansiballz_main():*
>> *+ ~*
>> *An expression was expected after '('.*
>> *At line:13 char:27*
>> *+ except (AttributeError, OSError):*
>> *+   ~*
>> *Missing argument in parameter list.*
>> *At line:15 char:7*
>> *+ if scriptdir is not None:*
>> *+   ~*
>> *Missing '(' after 'if' in if statement.*
>> *At line:22 char:7*
>> *+ if sys.version_info < (3,):*
>> *+*
>> * ~*
>> *Missing '(' after 'if' in if statement.*
>> *At line:22 char:30*
>> *+ if sys.version_info < (3,):*
>> *+*
>> * ~*
>> *Missing expression after ','.*
>> *At line:22 char:25*
>> *+ if sys.version_info < (3,):*
>> *+*
>> *  ~*
>> *The '<' operator is reserved for future use.*
>> *At line:24 char:32*
>> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
>> *+~*
>> *Missing expression after ','.*
>> *At line:24 char:33*
>> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
>> *+ ~*
>> *Unexpected token 'imp.PY_SOURCE' in expression or statement.*
>> *At line:24 char:32*
>> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
>> *+*
>> *~*
>> *Missing closing ')' in expression.*
>> *At line:24 char:46*
>> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
>> *+*
>> *  ~*
>> *Unexpected token ')' in expression or statement.*
>> *Not all parse errors were reported.  Correct the reported errors and 
>> try *
>> *again.\"*
>> *At line:6 char:1*
>> *+ $exec_wrapper = [ScriptBlock]::Create($split_parts[0])*
>> *+ ~~*
>> *+ CategoryInfo  : NotSpecified: (:) [], 
>> MethodInvocationException*
>> *+ FullyQualifiedErrorId : ParseException*
>>  
>> *The expression after '&' in a pipeline element produced an object that 

[ansible-project] Ansible iterate from file and populate template

2019-06-13 Thread Nicola Contu
Hello,
I have a template with few variables to be populated, then I am shipping 
that template populated to a another server.

Here is my playbook :

- hosts: dev
  become: yes
  become_method: sudo
  vars:
username: "{{ username }}"
ad_username: "{{ ad_username }}"
vhost_id: "{{ vhost_id }}"
  tasks:
- name: Ansible Template
  template:
src: 
/usr/local/cmd-sysadmin/automation/ansible/cmd/files/templates/apache_vhost_api_private_public.j2
dest: /usr/local/apache2.4/conf/vhosts/v2/{{ vhost_id }}_{{ 
username }}_apis.vhost.conf
- name: Add vhost to httpd.conf
  shell: echo "Include conf/vhosts/v2/{{ vhost_id }}_{{ username 
}}_apis.vhost.conf" >> /usr/local/apache2.4/conf/httpd.conf

It works well if I call it from command line and I pass all variable via -e 
switch.
Something like : ansible-playbook 
playbooks/apache/create_new_vhost_from_template_dev.yml -K -e 
"username= ad_username=.xxx vhost_id=60"

As I have too many vhosts to be created, I got a file from where I would 
like to read content, iterate it, populate variables and push the file.

The file is like this :
5;yyy;y
70;;zzz

I can modify the file to include the header, to be , delimited.. whatever. 

Is there anyone that can explain how to do this?

It's hard for me to find something like this on the documentation.

Can anyone help?

Thanks

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d2fbfd69-889c-4487-9111-a4bc9e353542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: troubleshooting ansible win problem

2019-06-13 Thread William Dossett
Hi Jon, thanks for the input... this was all working... I believe all I did 
was upgrade from ansible 2.6 to 2.8, using the same windows hosts to run 
against, same user - it had been working well for 8 months or so and they 
ran the updates on about 60 VMs every month.  Then I was working on another 
project for configuring users on aws instances and decided to upgrade to 
2.8 - well thats what yum did anyway when I did yum update ansible.  Is 
there some way I can back level to 2.6 with yum? it doesn't seem like it as 
yum list only lists ansible 2.8 - it would be nice to confirm that this is 
what broke it anyway.

I have upgraded powershell before on all the vms.  It does connect, I can 
see in task mgr that there are 5 tasks, one powershell running as the user 
that I am using in my ansible play.

I continue to work on it anyway, thanks

Bill


On Thursday, June 13, 2019 at 3:16:12 AM UTC-4, J Hawkesworth wrote:
>
> I don't know what this, but I have some suggestions of things you can try.
>
> Check the environment variables on the target host are ok.  I'm wondering 
> if maybe it can't find a powershell module.
>
> If this is a server 2008R2 box, make sure its had the memory fix update 
> applied - see 
> https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html#winrm-memory-hotfix
>   
> (or better still upgrade it to a later powershell /WMF version), as that's 
> known to cause out of memory when you attempt to use winrm.
>
> Double check the winrm configuration and firewall on the remote host 
> (although I doubt you'd be able to connect in that case).
>
> Make sure the destination machines can actually access the network so that 
> they can receive windows updates.   I think you'd probably see nasty COM 
> errors from the guts of windows if that was the case though.
>
> Worth checking the event log after you have run the playbook.
>
> Check that your domain user still has the privileges it needs.  IIRC the 
> user needs a fair few privileges in order to run windows updates.
>
> Check your domain user is still a local administrator on the box.
>
> Also, on another tack you can try removing ansible from the equation and 
> try the example python pywinrm script here: 
> https://github.com/diyan/pywinrm/#run-a-process-on-a-remote-host to see 
> if you can run commands.
>
> Sorry I don't have the solution but I hope something from the above list 
> might help you fix this.
>
> Jon
>
> On Wednesday, June 12, 2019 at 5:23:05 PM UTC+1, William Dossett wrote:
>>
>> I increased memory to the VM and now getting the original error on 
>> win_ping using domain acccount (sorry about the first post, just found the 
>> code button)
>>
>>  ansible -i winhosts win-update-prod -m win_ping -vvv
>> ansible 2.8.0
>>   config file = /etc/ansible/ansible.cfg
>>   configured module search path = 
>> [u'/home/bi003do/.ansible/plugins/modules', 
>> u'/usr/share/ansible/plugins/modules']
>>   ansible python module location = 
>> /usr/lib/python2.7/site-packages/ansible
>>   executable location = /usr/bin/ansible
>>   python version = 2.7.5 (default, Apr  9 2019, 14:30:50) [GCC 4.8.5 
>> 20150623 (Red Hat 4.8.5-36)]
>> Using /etc/ansible/ansible.cfg as config file
>> host_list declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts 
>> as it did not pass it's verify_file() method
>> script declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts as 
>> it did not pass it's verify_file() method
>> auto declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts as it 
>> did not pass it's verify_file() method
>> [DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set 
>> to allow bad characters in group names by
>> default, this will change, but still be user configurable on deprecation. 
>> This feature will be removed in version 2.10.
>>  Deprecation warnings can be disabled by setting 
>> deprecation_warnings=False in ansible.cfg.
>>  [WARNING]: Invalid characters were found in group names but not 
>> replaced, use - to see details
>>
>> Parsed /home/domainuser/Playbooks/WinUpdate/winhosts inventory source 
>> with ini plugin
>> META: ran handlers
>> Using module file 
>> /usr/lib/python2.7/site-packages/ansible/modules/windows/win_ping.ps1
>> Pipelining is enabled.
>>  ESTABLISH WINRM CONNECTION FOR USER: 
>> domainuser@MYDOMAIN.LOCAL on PORT 5986 TO covmgrid83
>> EXEC (via pipeline wrapper)
>> The full traceback is:
>> Property 'ErrorRecord' cannot be found on this object. Make sure that it 
>> exists.
>> At line:61 char:5
>> + Write-AnsibleError -Message "Unhandled exception while executing 
>> module" `
>> +
>>  ~~
>> + CategoryInfo  : NotSpecified: (:) [], 
>> PropertyNotFoundException
>> + FullyQualifiedErrorId : PropertyNotFoundStrict
>>
>> ScriptStackTrace:
>> at , : line 61
>> at , : line 26
>> at , : line 137
>> at , : line 7
>>
>> System.Management.Automation.PropertyNo

[ansible-project] WINDOWS MODULE TO DOWNLOAD PATCHES

2019-06-13 Thread Vandana Thakur
Hello All ,

I really need help to know that is there any  module in ansible to download
only the windows patches from WSUS server ?

thanks

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALJDb0%3D0Qe4cZjxq5qGtStemaYc8YqwiuN_%3D%2B3SQY13vR6k%2Biw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Stopping at first change

2019-06-13 Thread Andy Smith
Hi,

Is there a way, without modifying the playbooks, to make
ansible-playbook stop at/after the first change but carry on through
any tasks that don't make changes?

My intent is to run it in --check and --diff mode against
infrastructure to see that all the nodes are correctly configured,
but if there is any change outstanding it's going to stop and show
me what the change is without doing it.

I know I can step through every action choosing to do it or not, but
this steps through even actions that are not going to make any
change.

Just --check by itself of course will prevent any change being made
so that is the nearest thing to a solution I have so far, but it
carries on through the whole playbook. There's pages of output when
in this instance my main interest is "is there any change to be made
at all?"

Thanks,
Andy

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20190613102143.GU4569%40bitfolk.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: I can't edit jira issue with ansible

2019-06-13 Thread 'J Hawkesworth' via Ansible Project
Try running your playbook with -vv

It's been a while but I had some trouble with the jira module (and also 
running via python 2) so in the end I switched to using the 'uri' module  
for some things and running any playbooks that interact with jira using 
python 3.

I forget the exact issue but I couldn't establish a connection from a 
python 2.

If you can't run all your playbooks with python 3 yet then you can choose 
to run a playbook using python3 like this:

ansible-playbook sample-playbook.yml -e 
'ansible_python_interpreter=/usr/bin/python3'
 (as described here: 
https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html)

Hope this helps,

Jon


On Wednesday, June 12, 2019 at 10:48:26 AM UTC+1, Rodrigo Rapozo wrote:
>
> I don't know why the Jira module it's not working.
>
> IT'S WORKS!!!
>
> *[root@bd9fb0ef9526 playbooks]# curl -u rodrigo:q0y6S3lwmxlHbMYckmA6AF -X 
> POST -d @data.json -H "Content-Type: application/json" 
> "https://myjira.atlassian.net/rest/api/3/issue 
> "*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *{"id":"425566","key":"VFNCDS-1442","self":"https://myjira.atlassian.net/rest/api/3/issue/425566
>  
> "}data.json:{"fields": 
> {   "project":   {  "key": "VFNCDS"   },   "summary": "REST 
> EXAMPLE2",   "issuetype": {  "name": "Task"   }  }*
> *}*
>
> IT'S *NOT *WORKS!!!
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *[root@bd9fb0ef9526 playbooks]# ansible-playbook create_issue.ymlPLAY 
> [clients] 
> **TASK
>  
> [Gathering Facts] 
> **ok:
>  
> [172.17.0.4]TASK [Create an issue] 
> **fatal:
>  
> [172.17.0.4]: FAILED! => {"changed": false, "msg": "HTTP Error 400: 
> "}to retry, use: --limit 
> @/etc/ansible/playbooks/create_issue.retryPLAY RECAP 
> **172.17.0.4
>  
> : ok=1changed=0unreachable=0failed=1*
>
> *create_issue.yml*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> * hosts: anyHost  vars:ansible_python_interpreter: 
> /usr/bin/python3  tasks:  - name: Create an issuejira:  uri: 
> 'https://myjira.atlassian.net '  
> username: 'rodrigo'  password: 'q0y6S3lwmxlHbMYckmA6AF'  project: 
> VFNCD  operation: create  summary: REST EXAMPLE3  description: 
> Test*
> *  issuetype: Task*
>
>
> Best Regards
> Rodrigo Rapozo
>
> Em sexta-feira, 7 de junho de 2019 11:30:01 UTC+1, Rodrigo Rapozo escreveu:
>>
>> Hello I'm trying to edit a jira issue but I receive 404 I don't know why
>>
>> I think that could be because the field hosts is required, but I don't 
>> have ssh to the server and I put other host just to pass.
>>
>> Any ideia?
>>
>> ---
>> - hosts: clients
>>   vars:
>> ansible_python_interpreter: /usr/bin/python3
>>   tasks:
>>   - name: Jira VF/CF
>> jira:
>>   uri: 'https://mycompanyjira.atlassian.net'
>>   username: 'rodrigo\@mycompany.com'
>>   password: 'XXX'
>>   operation: edit
>>   issue: 'VFNCDS-1414'
>>   assignee: rodrigo
>>
>>
>>
>>
>> [root@bd9fb0ef9526 playbooks]# ansible-playbook jira_mycompany.yml -vvv
>> ansible-playbook 2.7.10
>>   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/site-packages/ansible
>>   executable location = /usr/bin/ansible-playbook
>>   python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 
>> 20150623 (Red Hat 4.8.5-36)]
>> Using /etc/ansible/ansible.cfg as config file
>> /etc/ansible/hosts did not meet host_list requirements, check plugin 
>> documentation if this is unexpected
>> /etc/ansible/hosts did not meet script requirements, check plugin 
>> documentation if this is unexpected
>> Parsed /etc/ansible/hosts inventory source with ini plugin
>>
>> PLAYBOOK: jira_mycompany.yml 
>> ***

[ansible-project] Re: Containerized Ansible SSH-ing to Windows DockerHost

2019-06-13 Thread 'J Hawkesworth' via Ansible Project
I'm not sure I fully follow how you are trying to set this up, but windows 
is not supported for running ansible itself, as stated here: 
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#control-node-requirements

I am out of touch with the latest state of windows support for containers 
but I think you'd need to run a linux container for the ansible 
controller.  I think that may be possible now with latest versions, but as 
I say I'm not sure.

Sorry that's probably not what you want to hear. Personally I have used WSL 
aka 'Bash on Ubuntu on Windows' for some time now and it works just fine 
for running playbooks from while developing playbooks.  I have full blown 
linux nodes for production ansible runs though.

Jon


On Wednesday, June 12, 2019 at 7:39:16 PM UTC+1, Taylor Jackwood wrote:
>
> Afternoon!
>
> I am attempting to set up an Ansible Docker container for managing both 
> other containers running in Docker, as well as my host machine (Running 
> Windows 10).
>
> Using Ansible 2.8, I'm attempting to get the SSH connection to my host 
> machine to work, as using WinRM isn't ideal for my scenario. I have set up 
> OpenSSH Server on my machine, and done all of the steps to allow SSH 
> tunneling from my container to my host machine. I can even go so far as to 
> "docker exec -it ansible bash" into my container, then run an "ssh 
> dockerhost" command, and it successfully uses my SSH keys to authenticate 
> and SSH back into my host machine.
>
> My problem comes when I attempt to use Ansible from inside the container 
> to ping my host machine. Whenever I try to run "ansible dockerhost -m 
> ping", I'm met with this error:
>
>
> ==
>
> ==
>
> *dockerhost | FAILED! => {*
> *"changed": false,*
> *"module_stderr": "Exception calling \"Create\" with \"1\" 
> argument(s): \"At line:4 char:21*
> *+ def _ansiballz_main():*
> *+ ~*
> *An expression was expected after '('.*
> *At line:13 char:27*
> *+ except (AttributeError, OSError):*
> *+   ~*
> *Missing argument in parameter list.*
> *At line:15 char:7*
> *+ if scriptdir is not None:*
> *+   ~*
> *Missing '(' after 'if' in if statement.*
> *At line:22 char:7*
> *+ if sys.version_info < (3,):*
> *+*
> * ~*
> *Missing '(' after 'if' in if statement.*
> *At line:22 char:30*
> *+ if sys.version_info < (3,):*
> *+*
> * ~*
> *Missing expression after ','.*
> *At line:22 char:25*
> *+ if sys.version_info < (3,):*
> *+*
> *  ~*
> *The '<' operator is reserved for future use.*
> *At line:24 char:32*
> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
> *+~*
> *Missing expression after ','.*
> *At line:24 char:33*
> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
> *+ ~*
> *Unexpected token 'imp.PY_SOURCE' in expression or statement.*
> *At line:24 char:32*
> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
> *+*
> *~*
> *Missing closing ')' in expression.*
> *At line:24 char:46*
> *+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)*
> *+*
> *  ~*
> *Unexpected token ')' in expression or statement.*
> *Not all parse errors were reported.  Correct the reported errors and try *
> *again.\"*
> *At line:6 char:1*
> *+ $exec_wrapper = [ScriptBlock]::Create($split_parts[0])*
> *+ ~~*
> *+ CategoryInfo  : NotSpecified: (:) [], 
> MethodInvocationException*
> *+ FullyQualifiedErrorId : ParseException*
>  
> *The expression after '&' in a pipeline element produced an object that 
> was not *
> *valid. It must result in a command name, a script block, or a 
> CommandInfo *
> *object.*
> *At line:7 char:2*
> *+ &$exec_wrapper*
> *+  ~*
> *+ CategoryInfo  : InvalidOperation: (:) [], RuntimeException*
> *+ FullyQualifiedErrorId : BadExpression*
> * ",*
> *"module_stdout": "",*
> *"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",*
> *"rc": 1*
> *}*
>
>
> ==
>
> ==
>
> I've also attempted this same ping test using the win_ping module, but get 
> a different failed result. The command hangs for an extended period of 
> time, then eventually returns with this error:
>
>
> ==
>
> =

[ansible-project] Re: troubleshooting ansible win problem

2019-06-13 Thread 'J Hawkesworth' via Ansible Project
I don't know what this, but I have some suggestions of things you can try.

Check the environment variables on the target host are ok.  I'm wondering 
if maybe it can't find a powershell module.

If this is a server 2008R2 box, make sure its had the memory fix update 
applied - see 
https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html#winrm-memory-hotfix
  
(or better still upgrade it to a later powershell /WMF version), as that's 
known to cause out of memory when you attempt to use winrm.

Double check the winrm configuration and firewall on the remote host 
(although I doubt you'd be able to connect in that case).

Make sure the destination machines can actually access the network so that 
they can receive windows updates.   I think you'd probably see nasty COM 
errors from the guts of windows if that was the case though.

Worth checking the event log after you have run the playbook.

Check that your domain user still has the privileges it needs.  IIRC the 
user needs a fair few privileges in order to run windows updates.

Check your domain user is still a local administrator on the box.

Also, on another tack you can try removing ansible from the equation and 
try the example python pywinrm script here: 
https://github.com/diyan/pywinrm/#run-a-process-on-a-remote-host to see if 
you can run commands.

Sorry I don't have the solution but I hope something from the above list 
might help you fix this.

Jon

On Wednesday, June 12, 2019 at 5:23:05 PM UTC+1, William Dossett wrote:
>
> I increased memory to the VM and now getting the original error on 
> win_ping using domain acccount (sorry about the first post, just found the 
> code button)
>
>  ansible -i winhosts win-update-prod -m win_ping -vvv
> ansible 2.8.0
>   config file = /etc/ansible/ansible.cfg
>   configured module search path = 
> [u'/home/bi003do/.ansible/plugins/modules', 
> u'/usr/share/ansible/plugins/modules']
>   ansible python module location = /usr/lib/python2.7/site-packages/ansible
>   executable location = /usr/bin/ansible
>   python version = 2.7.5 (default, Apr  9 2019, 14:30:50) [GCC 4.8.5 
> 20150623 (Red Hat 4.8.5-36)]
> Using /etc/ansible/ansible.cfg as config file
> host_list declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts 
> as it did not pass it's verify_file() method
> script declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts as 
> it did not pass it's verify_file() method
> auto declined parsing /home/domainuser/Playbooks/WinUpdate/winhosts as it 
> did not pass it's verify_file() method
> [DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set 
> to allow bad characters in group names by
> default, this will change, but still be user configurable on deprecation. 
> This feature will be removed in version 2.10.
>  Deprecation warnings can be disabled by setting 
> deprecation_warnings=False in ansible.cfg.
>  [WARNING]: Invalid characters were found in group names but not replaced, 
> use - to see details
>
> Parsed /home/domainuser/Playbooks/WinUpdate/winhosts inventory source with 
> ini plugin
> META: ran handlers
> Using module file 
> /usr/lib/python2.7/site-packages/ansible/modules/windows/win_ping.ps1
> Pipelining is enabled.
>  ESTABLISH WINRM CONNECTION FOR USER: 
> domainuser@MYDOMAIN.LOCAL on PORT 5986 TO covmgrid83
> EXEC (via pipeline wrapper)
> The full traceback is:
> Property 'ErrorRecord' cannot be found on this object. Make sure that it 
> exists.
> At line:61 char:5
> + Write-AnsibleError -Message "Unhandled exception while executing 
> module" `
> +
>  ~~
> + CategoryInfo  : NotSpecified: (:) [], 
> PropertyNotFoundException
> + FullyQualifiedErrorId : PropertyNotFoundStrict
>
> ScriptStackTrace:
> at , : line 61
> at , : line 26
> at , : line 137
> at , : line 7
>
> System.Management.Automation.PropertyNotFoundException: Property 
> 'ErrorRecord' cannot be found on this object. Make sure
>   that it exists.
>at 
> System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext
>  
> funcContext, Exception exc eption)
>at 
> System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame
>  
> frame)
>at 
> System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
>  
> frame)
>at 
> System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
>  
> frame)
> covmgrid83 | FAILED! => {
> "changed": false,
> "msg": "Failed to invoke PowerShell module: Property 'ErrorRecord' 
> cannot be found on this object. Make sure that it  
> exists."
> }
>
>
>
>
> On Wednesday, June 12, 2019 at 11:00:38 AM UTC-4, William Dossett wrote:
>>
>> Hi,
>> (sorry, this turned out rather long)
>>
>> I had windows updates running using an