Re: [ansible-project] Playbook to reboot the machine infinite times

2020-04-16 Thread Srinivas Naram
Did you try using items ?

On Fri, Apr 17, 2020 at 11:07 AM Pavan Nr  wrote:

> Hi,
>
> Need help to create playbook, server need to reboot over night in loop,
> like 100 time's I need to reboot and It should stop and collect the event
> viewer logs.
>
> Do we have module already?
>
> Thanks,
> Pavan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/9a9f36c2-5df1-4dbe-aaa1-4a47f5a6c766%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAG-N3P6%2Bpp9NyfepbdvMeXuOnQdXCD2sQui-4mWoswgWyC6abg%40mail.gmail.com.


[ansible-project] Playbook to reboot the machine infinite times

2020-04-16 Thread Pavan Nr


Hi,

Need help to create playbook, server need to reboot over night in loop, 
like 100 time's I need to reboot and It should stop and collect the event 
viewer logs.

Do we have module already?

Thanks,
Pavan

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9a9f36c2-5df1-4dbe-aaa1-4a47f5a6c766%40googlegroups.com.


[ansible-project] New Ansible releases 2.9.7, 2.8.11, and 2.7.17

2020-04-16 Thread Matt Clay
Hi all- we're happy to announce that the general release of Ansible 2.9.7,
2.8.11, and 2.7.17 are now available!


How do you get it?
--

$ pip install ansible==2.9.7 --user
or
$ pip install ansible==2.8.11 --user
or
$ pip install ansible==2.7.17 --user

The tar.gz of the releases can be found here:

* 2.9.7
  https://releases.ansible.com/ansible/ansible-2.9.7.tar.gz
  SHA256: 7222ce925536a25b2912364e13b03a3e21dbf2f96799ebff304f48509324de7b
* 2.8.11
  https://releases.ansible.com/ansible/ansible-2.8.11.tar.gz
  SHA256: 156caa8b6c60b9f0d5c7d57ee0f4e46d8e226147b58546be6a8ac52925a9c191
* 2.7.17
  https://releases.ansible.com/ansible/ansible-2.7.17.tar.gz
  SHA256: 9fdb79c43f7ad972dc7ccff8a4e9553d623e52dc80b802c619568d3c38f94ccc


What's new in 2.9.7, 2.8.11, and 2.7.17
---

These releases are maintenance releases containing numerous bugfixes. The 
full
changelogs are at:

* 2.9.7
  
https://github.com/ansible/ansible/blob/stable-2.9/changelogs/CHANGELOG-v2.9.rst
* 2.8.11
  
https://github.com/ansible/ansible/blob/stable-2.8/changelogs/CHANGELOG-v2.8.rst
* 2.7.17
  
https://github.com/ansible/ansible/blob/stable-2.7/changelogs/CHANGELOG-v2.7.rst


What's the schedule for future maintenance releases?


Future maintenance releases will occur approximately every 3 weeks.  So 
expect
the next one around 2020-05-07.


Porting Help


We've published a porting guide at
https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.9.html 
to
help migrate your content to 2.9.


If you discover any errors or if any of your working playbooks break when 
you
upgrade to 2.9.7, please use the following link to report the regression:

  https://github.com/ansible/ansible/issues/new/choose

In your issue, be sure to mention the Ansible version that works and the one
that doesn't.

Thanks!

-Matt Clay

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9b096b98-ccd1-4403-820b-4cd3bd59b72d%40googlegroups.com.


Re: [ansible-project] ec2_vpc_route_table to delete a given subnet

2020-04-16 Thread Dick Visser
I think this is how it is supposed to work.
You define which subnets there should be, and the module will take care of that.
The only choice is whether to purge subnets that aren't in your desired list.

Dick

On Thu, 16 Apr 2020 at 22:33, Kyle Sloan  wrote:
>
> Hello all,
>
> I am using the ec2_vpc_route_table module and am able to create the route 
> table, as well as adding more subnets with the "subnets", "purge_subnets" and 
> "lookup" parameters.  I however have been unable to determine how to remove a 
> subnet from an existing route_table.  The only solution I have found is to 
> query and get all the existing subnets and pass them in with 
> purge_subnets=true on a second call.
>
> I am hoping I am overlooking, or perhaps missing an example, of how I can do 
> one call that would allow me to delete a given subnet from an existing 
> route_table.
>
>
> This works to add,
>
> profile: "{{ aws_profile }}"
> vpc_id: "{{ vpc_id }}"
> state: present
> region: us-east-1
> lookup: id
> route_table_id: rtb-0
> subnets:
>   - subnet-0418
>
> purge_routes: no
> purge_subnets: no
> purge_tags: no
>
>
>
> I was hoping adding state: absent would work, but that attempts to delete the 
> route_table instead of the subnet.
>
> Thanks!
>
>
> https://docs.ansible.com/ansible/latest/modules/ec2_vpc_route_table_module.html
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/6e65cad3-df8e-4cdd-9870-0d4ed8c0218d%40googlegroups.com.



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOcM%3D9kDnv4UfpuB%3DcdyALGkNFPA1a4XsWdJPeNRCEQ5A%40mail.gmail.com.


[ansible-project] ec2_vpc_route_table to delete a given subnet

2020-04-16 Thread Kyle Sloan
Hello all,

I am using the ec2_vpc_route_table module and am able to create the route 
table, as well as adding more subnets with the "subnets", "purge_subnets" 
and "lookup" parameters.  I however have been unable to determine how to 
remove a subnet from an existing route_table.  The only solution I have 
found is to query and get all the existing subnets and pass them in with 
purge_subnets=true on a second call.

I am hoping I am overlooking, or perhaps missing an example, of how I can 
do one call that would allow me to delete a given subnet from an existing 
route_table.


This works to add,

profile: "{{ aws_profile }}"
vpc_id: "{{ vpc_id }}"
state: present
region: us-east-1
lookup: id
route_table_id: rtb-0
subnets:
  - subnet-0418

purge_routes: no
purge_subnets: no
purge_tags: no



I was hoping adding state: absent would work, but that attempts to delete 
the route_table instead of the subnet.

Thanks!


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


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6e65cad3-df8e-4cdd-9870-0d4ed8c0218d%40googlegroups.com.


Re: [ansible-project] telnet issue

2020-04-16 Thread Zaldy B
Hi Kai,

Thank you very much for replaying on my issue. I know that it should be 
straight forward, and I just copy it on the module

I am still getting the failure message even though I changed the hosts to


[Cisco_Telnet]
10.197.48.240


Tasks:

- name: Telnet do show version for IOS
  hosts: 10.197.48.240
  gather_facts: false
  connection: local

  tasks:
- name: show version
  telnet:
user: ansible
password: Inf1n1TY
login_prompt: "Username:"
prompts:
  - "[#]"
command:
  - terminal length 0
  - show version


Here is the error:

PLAY [Telnet do show version for IOS] 
***

TASK [show version] 
*
fatal: [10.197.48.240]: FAILED! => {"changed": true, "msg": "Telnet action 
failed: telnet connection closed", "output": []}




Here is when i do the -vvv:

Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/TEMPLATES/Cisco_IOS as it did not 
pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the 
current user
script declined parsing /etc/ansible/TEMPLATES/Cisco_IOS as it did not pass 
it's verify_file() method


On Thursday, April 16, 2020 at 2:32:52 AM UTC-4, Kai Stian Olstad wrote:
>
> On Mon, Apr 13, 2020 at 01:37:13AM -0700, Zaldy B wrote: 
> > playbook is just straight forward: 
> > 
> > 
> > --- 
> > - name: Telnet do show version for IOS 
> >   hosts: Cisco_Telnet 
> >   gather_facts: false 
> >   connection: local 
> > 
> >   tasks: 
> > - name: show version 
> >   telnet: 
> > user: "{{ username }}" 
> > password: "{{ password }}" 
> > login_prompt: "Username:" 
> > prompts: 
> >   - "[>|#]" 
> > command: 
> >   - terminal length 0 
> >   - show version 
> > 
> > 
> > hostfile: 
> > 
> > [Cisco_Telnet] 
> > cisco_devicehost=192.168.1.1   username=cisco password=cisco 
>
> This looks like a playbook just copied from documentation. 
> https://docs.ansible.com/ansible/latest/modules/telnet_module.html 
>
> Your task is missing host: default is the variable remote_addr according 
> to the 
> documentation. So you need to provide host: or sett the correct variable. 
>
> You also need to tailor the prompt for you environment, it should be a 
> list of 
> all prompt, you only have one prompt that is literally checking for [>|#] 
> I 
> doubt you prompt looks like that. 
>
> If you can't figure this out yourself you need to provide the complete 
> output 
> of telnet including telnet itself and the exit of the telnet. 
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a0d2711e-8a5d-4d58-a0e1-41c9ae4dd93a%40googlegroups.com.


Re: [ansible-project] Need some data filter from meta data which came from custom module.

2020-04-16 Thread Venu Devannagari
Hi

Thanks for the reply my playbook give me the following output in one 
variable.

ok: [localhost -> localhost] => {
"changed": false,
"invocation": {
"module_args": {
"forti_ip": "x",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"username": "",
"vdom": "root"
}
},
"meta": [
0,
3,
4,
5,
6
]
}

but I need to save this output to one remote machine where the same 
variable will be called there in data field the changed and failed params 
are came.

changed: [localhost] => {
"changed": true,
"invocation": {
"module_args": {
"data": "{'failed': False, 'meta': [0, 3, 4, 5, 6], 'changed': 
False}",
"dirname": "t",
"filename": "fortigate.txt",
"password": "x",
"remote_machine": "x",
"username": "x"
}
},
"meta": "{'failed': False, 'meta': [0, 3, 4, 5, 6], 'changed': False}"

On Thursday, April 16, 2020 at 6:54:06 PM UTC+5:30, Thanh Nguyen Duc wrote:
>
> Seem like you can register the result result and extract only the meta:
> register: result
> debug:
>   var: result.meta
>
> Anyway, you must see how is the data your module return:)
> Sent from my iPhone
>
> On Apr 16, 2020, at 20:29, Venu Devannagari  > wrote:
>
> 
> I am getting following output from my ansible custom module '{'failed': 
> False, 'meta': {'Unused Policy Rules IDS': [0, 3, 4, 5, 6]}, 'changed': 
> False}' to one variable .I need to fetch only "{'Unused Policy Rules IDS': 
> [0, 3, 4, 5, 6]"}.Can anyone help to resolve this issue.
>
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/689b3317-c371-49b8-b052-4a743fffe587%40googlegroups.com
>  
> 
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5bbdfcca-21a5-46c6-ae4c-5426515cbd1e%40googlegroups.com.


Re: [ansible-project] Need some data filter from meta data which came from custom module.

2020-04-16 Thread Thanh Nguyen Duc
Seem like you can register the result result and extract only the meta:
register: result
debug:
  var: result.meta

Anyway, you must see how is the data your module return:)
Sent from my iPhone

> On Apr 16, 2020, at 20:29, Venu Devannagari  wrote:
> 
> 
> I am getting following output from my ansible custom module '{'failed': 
> False, 'meta': {'Unused Policy Rules IDS': [0, 3, 4, 5, 6]}, 'changed': 
> False}' to one variable .I need to fetch only "{'Unused Policy Rules IDS': 
> [0, 3, 4, 5, 6]"}.Can anyone help to resolve this issue.
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/689b3317-c371-49b8-b052-4a743fffe587%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/E530E62C-1546-42B2-AE1C-5819F2A6039F%40gmail.com.


Re: [ansible-project] "Win_Command" module not working to connect localhost to run Powershell script from ansible which is installed in windows10

2020-04-16 Thread Thanh Nguyen Duc
Localhost is your ansible server and it doesn’t work with windown module, you 
need to specify the client group name

Sent from my iPhone

> On Apr 16, 2020, at 16:59, Pavan K Kumar  wrote:
> 
> 
> Hello Experts,
> 
> 
> 
> I'm new to Ansible and PowerShell.
> 
> 
> 
> I have installed cygwin in my windows 10 Operating system and installed 
> ansible and its related packages as per below mail.
> 
> https://geekflare.com/ansible-installation-windows/
> 
> 
> 
> Here are the environment details
> 
> Ansible version:  2.8.4
> python version : 3.7.7 (default, Apr 10 2020, 07:59:19) [GCC 9.3.0]
> 
> Powershell Version: 5.1.17763.1007
> 
> 
> 
> on above successful setup, i tried to run my below sample ansible script with 
> hosts as "localhost"
> 
> 
> 
> - hosts: localhost
> 
>   tasks:
> 
>   - name: "run whoami"
> 
> win_command: whoami
> 
> register: whoami_out
> 
>   - debug: var=whoami_out.stdout_lines
> 
> 
> but, i am ending up with the below error
> 
> [WARNING]: provided hosts list is empty, only localhost is available. Note 
> that the implicit localhost does not match 'all'
> 
> PLAY [localhost] 
> ***
> 
> TASK [Gathering Facts] 
> *
> ok: [localhost]
> 
> TASK [run whoami] 
> **
> fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": 
> "/home/Pavan.Kammara/.ansible/tmp/ansible-tmp-1586957425.671443-215768864612631/AnsiballZ_win_command.ps1
>  : The term 
> \r\n'/home/Pavan.Kammara/.ansible/tmp/ansible-tmp-1586957425.671443-215768864612631/AnsiballZ_win_command.ps1'
>  is not \r\nrecognized as the name of a cmdlet, function, script file, or 
> operable program. Check the spelling of the name, or if \r\na path was 
> included, verify that the path is correct and try again.\r\nAt line:1 
> char:1\r\n+ 
> /home/Pavan.Kammara/.ansible/tmp/ansible-tmp-1586957425.671443-215768 
> ...\r\n+ 
> ~\r\n + 
> CategoryInfo : ObjectNotFound: (/home/Pavan.Kam...win_command.ps1:String) [], 
> CommandNotFoundException\r\n + FullyQualifiedErrorId : 
> CommandNotFoundException\r\n \r\n", "module_stdout": "", "msg": "MODULE 
> FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
> 
> PLAY RECAP 
> *
> localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 
> ignored=0
> 
> 
> and i tried the 2nd approach by creating my windows 10 machine ip address in 
> etc/ansible/ansible.cfg and referred the same in asnible playbook as below
> 
> - hosts: all
>   tasks:
>   - name: "run whoami"
> win_command: whoami
> register: whoami_out
>   - debug: var=whoami_out.stdout_lines 
> 
> this time also ended up with the different error, PFB
> 
> PLAY [all] 
> *
> 
> TASK [Gathering Facts] 
> *
> fatal: [192.***.*.***]: UNREACHABLE! => {"changed": false, "msg": "Failed to 
> connect to the host via ssh: ssh: connect to host 192.***.*.*** port 22: 
> Connection refused", "unreachable": true}
> 
> PLAY RECAP 
> *
> 192.***.*.***   : ok=0changed=0unreachable=1failed=0
> skipped=0rescued=0ignore 
> 
> Kindly help me, is it something the environment set up issue. Im completely 
> clueless why it is not working as im new to this technology.
> 
> Thanks in advance! 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/0a657327-034b-4131-a9b7-9ee99364889a%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Re: [ansible-project] Re: Error message - "module_stderr": "/bin/sh: 1: powershell: not found\n", when running a powershell through win_command

2020-04-16 Thread Thanh Nguyen Duc
Why localhost? Localhost mean you are running it in the ansible server, not win 
10 client

Sent from my iPhone

> On Apr 16, 2020, at 17:04, Pavan K Kumar  wrote:
> 
> 
> Hi Kiran,
> 
> Did you got any fix for this ?
> 
> im also facing the same issue.. 
> 
>> On Sunday, February 23, 2020 at 12:38:16 AM UTC+5:30, Karthik Kumar wrote:
>> Iam trying to run the below simple playbook in ansible in windows 10 through 
>> ubuntu installed.
>> 
>> But Iam getting error as  "module_stderr": "/bin/sh: 1: powershell: not 
>> found\n", "module_stdout": 
>> Please let me know how to resolve this issue.
>> 
>> - name: Run Powershell Scripts
>>   hosts: localhost
>>   tasks:
>> - name: Run powershell script
>>   win_command: pwsh.exe -ExecutionPolicy ByPass -File 
>> C:/temp/Firstpowershellscript.ps1
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/0956a7ca-030f-41c6-a1e3-2e5c27b1dc9f%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/605834A7-5D96-48CD-890C-86912D51AD75%40gmail.com.


[ansible-project] Is anyone work on fortigate thorugh network_cli as a connection type.

2020-04-16 Thread Venu Devannagari
Hi,

I have tried to work through connection type network_cli but unable to do 
it.Ansible says ansible_network_os type is not supported.If anyone worked 
on it please help me to resolve this.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/84af300a-de25-413f-9ddd-f4c2ff90cbb0%40googlegroups.com.


[ansible-project] Need some data filter from meta data which came from custom module.

2020-04-16 Thread Venu Devannagari
I am getting following output from my ansible custom module '{'failed': 
False, 'meta': {'Unused Policy Rules IDS': [0, 3, 4, 5, 6]}, 'changed': 
False}' to one variable .I need to fetch only "{'Unused Policy Rules IDS': 
[0, 3, 4, 5, 6]"}.Can anyone help to resolve this issue.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/689b3317-c371-49b8-b052-4a743fffe587%40googlegroups.com.


Re: [ansible-project] yum repolist -v Output to Vars/Dict and use the data

2020-04-16 Thread Kai Stian Olstad
On Thu, Apr 16, 2020 at 03:19:33AM -0700, 'Spoonless' via Ansible Project wrote:
> This is what I am trying to do:
> 
> yum repolist -v will give me a list of the enabled repos on a system, for 
> example:
> 
> Repo-id  : jenkins
> Repo-name: Jenkins-stable
> Repo-revision: 1585146777
> Repo-updated : Wed Mar 25 15:32:57 2020
> Repo-pkgs: 102
> Repo-size: 6.1 G
> Repo-baseurl : http://pkg.jenkins.io/redhat-stable/
> Repo-expire  : 21,600 second(s) (last: Tue Apr 14 08:28:35 2020)
>   Filter : read-only:present
> Repo-filename: /etc/yum.repos.d/jenkins.repo
> 
> Repo-id  : mongodb-org-4.2/7
> Repo-name: MongoDB Repository
> Repo-revision: 1585187010
> Repo-updated : Thu Mar 26 02:43:32 2020
> Repo-pkgs: 25
> Repo-size: 543 M
> Repo-baseurl : https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/
> Repo-expire  : 21,600 second(s) (last: Tue Apr 14 08:28:36 2020)
>   Filter : read-only:present
> Repo-filename: /etc/yum.repos.d/mongodb-org-4.2.repo
> 
> I want to:
> 1: register, lets say for now, the Repo-id, Repo-name, Repo-baseurl, 
> Repo-filename to variable/s, or a dictionary, not sure here ?.
> 2: Check if the Repo-baseurl of a Repo-id contains a certain url, if it 
> does, register another variable, illegalurl = 1,  for that Repo
> 3: Grab the Repo-filename where the Repo-baseurl illegalurl is 1
> 4: Do something with that file:
>   a: Generate a mail with that information
>   b: Check if a repo file exists in a different location with a correct 
> Repo-baseurl
>   c: Change the Repo-baseurl in the originating .repo file.
>   == I guess, if I have the variables, dictionary, facts of the individual 
> blocks of data, then I can use them to do other tasks that I need.
> 
> I have tried:
> 
> Individual tasks to grab the data and register a variable:
> example:
> 
>   tasks:
> - name: Collect Repo id  from yum repolist -v
>   shell: "yum repolist -v | grep Repo-id | awk -F\": \" '{print $2}'"
>   register: echo_repoids
> #   - debug:
> #var: echo_repoids.stdout_lines
> 
> - name: Collect Repo Name  from yum repolist -v
>   shell: "yum repolist -v | grep Repo-name | awk -F\": \" '{print $2}'"
>   register: echo_reponame
> #- debug:
> #var: echo_reponame.stdout_lines
> 
> - name: Collect Repo base url  from yum repolist -v
>   shell: "yum repolist -v | grep Repo-baseurl | awk -F\": \" '{print 
> $2}'"
>   register: echo_repobaseurl
> #- debug:
> #var: echo_repobaseurl.stdout_lines
> 
> - name: Collect Repo filename  from yum repolist -v
>   shell: "yum repolist -v | grep Repo-filename | awk -F\": \" '{print 
> $2}'"
>   register: echo_repofilename
> #   - debug:
> #   var: echo_repofilename.stdout_lines

If you use .stdout you get the value, .stdout_lines is a list where
the first line is the first element, so you would need to use
.stdout_lines.0

> I also tried:
> 
>   tasks:
> - name: Collect the enabled Repo information
>   shell: "yum repolist -v | grep {{item}} | awk -F\": \" '{print $2}'"
>   with_items:
> - "Repo-id"
> - "Repo-name"
> - "Repo-baseurl"
> - "Repo-filename"
>   register: output  
> #  debug: var=output 

Since you run this in a loop, the result is in results.

Repo-id is output.results.0.stdout
Repo-name is output.results.1.stdout
and so on


> But I do not know how to match the blocks contents of Repo-id, Repo-name, 
> Repo-baseurl, Repo-filename as keys and values so I can use them later in 
> the tasks/ playbooks.

You could just use the variables as shown above. You could use set_fact to
create new variable. Something like this for the last example.

- set_fact:
repoid: "{{ output.results.0.stdout }}"
reponame: "{{ output.results.1.stdout }}"


-- 
Kai Stian Olstad

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200416115519.vy5wzlhl4zmqn7kd%40olstad.com.


[ansible-project] Re: "Win_Command" module not working to connect localhost to run Powershell script from ansible which is installed in windows10

2020-04-16 Thread Pavan K Kumar
Hello Jordan,

Thank you very much for your reply. that is very much informative.

could you please guide how do i can setup the basic environment to play 
around ansible with powershell.

i need to develop a scripts, which needs to communicate each other *(Powershell 
script <--> Ansible)* to achieve some functionality. 

Thank you again!!


On Thursday, April 16, 2020 at 4:13:08 PM UTC+5:30, Jordan Borean wrote:
>
> You cannot run Windows modules over localhost, they are designed to run 
> through a connection plugin like winrm, psrp, or ssh. Also I would highly 
> advise not running Ansible through cygwin, it may work in some places but 
> will then fall flat in others. If you are on Windows 10 then WSL is a lot 
> better in terms of compatibility but nothing will trump a VM running Linux. 
> You also avoid issue like this where you try to run Windows stuff on 
> localhost when Ansible isn't designed for that.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/29320c65-17d4-4f79-b5fe-b1852adf23eb%40googlegroups.com.


[ansible-project] Re: "Win_Command" module not working to connect localhost to run Powershell script from ansible which is installed in windows10

2020-04-16 Thread Jordan Borean
You cannot run Windows modules over localhost, they are designed to run 
through a connection plugin like winrm, psrp, or ssh. Also I would highly 
advise not running Ansible through cygwin, it may work in some places but 
will then fall flat in others. If you are on Windows 10 then WSL is a lot 
better in terms of compatibility but nothing will trump a VM running Linux. 
You also avoid issue like this where you try to run Windows stuff on 
localhost when Ansible isn't designed for that.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a99e4f37-f2da-4015-93ef-3634ee812521%40googlegroups.com.


Re: [ansible-project] Need help on json query call in ansible

2020-04-16 Thread Suresh Karpurapu
Thanks Racke, it's working for if host has single volume but same is
failing if the host has multiple volumes. Basically, loop is getting
failed. Please suggest if there any alternative ways

# cat mounts.csv
host,remote_path,mnt_path,python
host1,nfsflr01:/volahcstg_www_masup_stg_data_01,/myasup/stg/data,/usr/bin/python2.6
host1,nfsflr02:/volahcstg_www_masup_stg_app_01,/myasup/stg/app,/usr/bin/python2.6
host2,nfsflr01:/volahcstg_www_masup_stg_data_01,/myasup/stg/data,/usr/bin/python2.6
host2,nfsflr02:/volahcstg_www_masup_stg_app_01,/myasup/stg/app,/usr/bin/python2.6


Result:

TASK [Grouping host and volume information]
*
task path: /suresh/suresh_playbooks/mounts.yml:12
creating host via 'add_host': hostname=host1
changed: [localhost] => (item=[u'host1', [{u'python':
u'/usr/bin/python2.6', u'host': u'host1', u'mnt_path': u'/myasup/stg/data',
u'remote_path': u'nfsflr01:/volahcstg_www_masup_stg_data_01'}, {u'python':
u'/usr/bin/python2.6', u'host': u'host1', u'mnt_path': u'/myasup/stg/app',
u'remote_path': u'nfsflr02:/volahcstg_www_masup_stg_app_01'}]]) => {
"add_host": {
"groups": [
"nfsgroup"
],
"host_name": "host1",
"host_vars": {
"ansible_python_interpreter": "/usr/bin/python2.6",
"var1": [
"nfsflr01:/volahcstg_www_masup_stg_data_01",
"nfsflr02:/volahcstg_www_masup_stg_app_01"
],
"var2": [
"/myasup/stg/data",
"/myasup/stg/app"
]
}
},
"ansible_loop_var": "item",
"changed": true,
"item": [
"host1",
[
{
"host": "host1",
"mnt_path": "/myasup/stg/data",
"python": "/usr/bin/python2.6",
"remote_path": "nfsflr01:/volahcstg_www_masup_stg_data_01"
},
{
"host": "host1",
"mnt_path": "/myasup/stg/app",
"python": "/usr/bin/python2.6",
"remote_path": "nfsflr02:/volahcstg_www_masup_stg_app_01"
}
]
]
}
creating host via 'add_host': hostname=host2
changed: [localhost] => (item=[u'host2', [{u'python':
u'/usr/bin/python2.6', u'host': u'host2', u'mnt_path': u'/myasup/stg/data',
u'remote_path': u'nfsflr01:/volahcstg_www_masup_stg_data_01'}, {u'python':
u'/usr/bin/python2.6', u'host': u'host2', u'mnt_path': u'/myasup/stg/app',
u'remote_path': u'nfsflr02:/volahcstg_www_masup_stg_app_01'}]]) => {
"add_host": {
"groups": [
"nfsgroup"
],
"host_name": "host2",
"host_vars": {
"ansible_python_interpreter": "/usr/bin/python2.6",
"var1": [
"nfsflr01:/volahcstg_www_masup_stg_data_01",
"nfsflr02:/volahcstg_www_masup_stg_app_01"
],
"var2": [
"/myasup/stg/data",
"/myasup/stg/app"
]
}
},
"ansible_loop_var": "item",
"changed": true,
"item": [
"host2",
[
{
"host": "host2",
"mnt_path": "/myasup/stg/data",
"python": "/usr/bin/python2.6",
"remote_path": "nfsflr01:/volahcstg_www_masup_stg_data_01"
},
{
"host": "host2",
"mnt_path": "/myasup/stg/app",
"python": "/usr/bin/python2.6",
"remote_path": "nfsflr02:/volahcstg_www_masup_stg_app_01"
}
]
]
}
META: ran handlers
META: ran handlers


TASK [debug output]
*
task path: /suresh/suresh_playbooks/mounts.yml:25
ok: [host1] => {
"msg": [
"host1",
[
"nfsflr01:/volahcstg_www_masup_stg_data_01",
"nfsflr02:/volahcstg_www_masup_stg_app_01"
],
[
"/myasup/stg/data",
"/myasup/stg/app"
]
]
}
ok: [host2] => {
"msg": [
"host2",
[
"nfsflr01:/volahcstg_www_masup_stg_data_01",
"nfsflr02:/volahcstg_www_masup_stg_app_01"
],
[
"/myasup/stg/data",
"/myasup/stg/app"
]
]
}

TASK [mounting the volume in the fstab file]

changed: [host1 -> host1] => {
"changed": true,
"dump": "0",
"fstab": "/etc/fstab",
"fstype": "nfs",
"invocation": {
"module_args": {
"backup": false,
"boot": true,
"dump": "0",
"fstab": null,
"fstype": "nfs",
"opts":

Re: [ansible-project] pip needs to be installed

2020-04-16 Thread Stefan Hornburg (Racke)
On 4/16/20 12:13 PM, Punit Ramaji wrote:
> python --version
> Python 2.7.16
> whereis pip
> pip: /usr/local/bin/pip2.7 /usr/local/bin/pip
> 

Please try pip: name=pip state=latest executable=/usr/local/bin/pip

Regards
Racke

> On Thursday, 16 April 2020 15:40:54 UTC+5:30, Stefan Hornburg (Racke) wrote:
> 
> On 4/16/20 12:07 PM, Punit Ramaji wrote:
> > Yes, I am trying to upgrade it. But it is failing.
> 
> Which version of Python do you use on the target machine? Where is pip 
> installed exactly?
> 
> Regards
>         Racke
> 
> >
> > On Thursday, 16 April 2020 15:28:31 UTC+5:30, Mauricio Tavares wrote:
> >
> >     On Thu, Apr 16, 2020 at 5:51 AM Punit Ramaji  > wrote:
> >     >
> >     > I am getting below error, when I try to pip: name=pip state=latest
> >     > TASK [install : Upgrade pip] 
> ***
> >     > fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable 
> to find any of pip2, pip to use.  pip needs
> to be
> >     installed."}
> >     >         to retry, use: --limit
> >     >
> >           Is pip already installed in target machine?
> >
> >     > --
> >     > 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 view this discussion on the web visit
> >     
> https://groups.google.com/d/msgid/ansible-project/9fea132f-6939-48da-b3f9-ba005097c528%40googlegroups.com
> 
> 
> >     
>  
> >.
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to
> > ansible...@googlegroups.com  
> .
> > To view this discussion on the web visit
> > 
> https://groups.google.com/d/msgid/ansible-project/085344f6-fa0a-4b8c-821a-abc1fdf6ec3a%40googlegroups.com
> 
> 
> >
> 
>  
> >.
> 
> 
> 
> -- 
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/e38fdd60-4b14-471e-9b4e-d321c87d152a%40googlegroups.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/441654e5-ee5c-db08-53ff-00f3f62ca900%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[ansible-project] yum repolist -v Output to Vars/Dict and use the data

2020-04-16 Thread 'Spoonless' via Ansible Project
Hi all,

I am having some difficulty in getting my head around the use of variables, 
facts and dicts.

The Ansible yum module does not give me output from an equivalent yum 
repolist -v command, so I am using shell for that.

This is what I am trying to do:

yum repolist -v will give me a list of the enabled repos on a system, for 
example:

Repo-id  : jenkins
Repo-name: Jenkins-stable
Repo-revision: 1585146777
Repo-updated : Wed Mar 25 15:32:57 2020
Repo-pkgs: 102
Repo-size: 6.1 G
Repo-baseurl : http://pkg.jenkins.io/redhat-stable/
Repo-expire  : 21,600 second(s) (last: Tue Apr 14 08:28:35 2020)
  Filter : read-only:present
Repo-filename: /etc/yum.repos.d/jenkins.repo

Repo-id  : mongodb-org-4.2/7
Repo-name: MongoDB Repository
Repo-revision: 1585187010
Repo-updated : Thu Mar 26 02:43:32 2020
Repo-pkgs: 25
Repo-size: 543 M
Repo-baseurl : https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/
Repo-expire  : 21,600 second(s) (last: Tue Apr 14 08:28:36 2020)
  Filter : read-only:present
Repo-filename: /etc/yum.repos.d/mongodb-org-4.2.repo

I want to:
1: register, lets say for now, the Repo-id, Repo-name, Repo-baseurl, 
Repo-filename to variable/s, or a dictionary, not sure here ?.
2: Check if the Repo-baseurl of a Repo-id contains a certain url, if it 
does, register another variable, illegalurl = 1,  for that Repo
3: Grab the Repo-filename where the Repo-baseurl illegalurl is 1
4: Do something with that file:
  a: Generate a mail with that information
  b: Check if a repo file exists in a different location with a correct 
Repo-baseurl
  c: Change the Repo-baseurl in the originating .repo file.
  == I guess, if I have the variables, dictionary, facts of the individual 
blocks of data, then I can use them to do other tasks that I need.

I have tried:

Individual tasks to grab the data and register a variable:
example:

  tasks:
- name: Collect Repo id  from yum repolist -v
  shell: "yum repolist -v | grep Repo-id | awk -F\": \" '{print $2}'"
  register: echo_repoids
#   - debug:
#var: echo_repoids.stdout_lines

- name: Collect Repo Name  from yum repolist -v
  shell: "yum repolist -v | grep Repo-name | awk -F\": \" '{print $2}'"
  register: echo_reponame
#- debug:
#var: echo_reponame.stdout_lines

- name: Collect Repo base url  from yum repolist -v
  shell: "yum repolist -v | grep Repo-baseurl | awk -F\": \" '{print 
$2}'"
  register: echo_repobaseurl
#- debug:
#var: echo_repobaseurl.stdout_lines

- name: Collect Repo filename  from yum repolist -v
  shell: "yum repolist -v | grep Repo-filename | awk -F\": \" '{print 
$2}'"
  register: echo_repofilename
#   - debug:
#   var: echo_repofilename.stdout_lines

I also tried:

  tasks:
- name: Collect the enabled Repo information
  shell: "yum repolist -v | grep {{item}} | awk -F\": \" '{print $2}'"
  with_items:
- "Repo-id"
- "Repo-name"
- "Repo-baseurl"
- "Repo-filename"
  register: output  
#  debug: var=output 

But I do not know how to match the blocks contents of Repo-id, Repo-name, 
Repo-baseurl, Repo-filename as keys and values so I can use them later in 
the tasks/ playbooks.

I hope that helps you to understand what I am trying to accomplish.

Thanks in advance for any advice anyone can offer. :)
Best 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/87522c0a-7225-406d-8369-d0c8ee4fd58b%40googlegroups.com.


Re: [ansible-project] pip needs to be installed

2020-04-16 Thread Punit Ramaji
python --version
Python 2.7.16
whereis pip
pip: /usr/local/bin/pip2.7 /usr/local/bin/pip

On Thursday, 16 April 2020 15:40:54 UTC+5:30, Stefan Hornburg (Racke) wrote:
>
> On 4/16/20 12:07 PM, Punit Ramaji wrote: 
> > Yes, I am trying to upgrade it. But it is failing. 
>
> Which version of Python do you use on the target machine? Where is pip 
> installed exactly? 
>
> Regards 
> Racke 
>
> > 
> > On Thursday, 16 April 2020 15:28:31 UTC+5:30, Mauricio Tavares wrote: 
> > 
> > On Thu, Apr 16, 2020 at 5:51 AM Punit Ramaji  > wrote: 
> > > 
> > > I am getting below error, when I try to pip: name=pip state=latest 
> > > TASK [install : Upgrade pip] 
> *** 
> > > fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable 
> to find any of pip2, pip to use.  pip needs to be 
> > installed."} 
> > > to retry, use: --limit 
> > > 
> >   Is pip already installed in target machine? 
> > 
> > > -- 
> > > 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 view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/9fea132f-6939-48da-b3f9-ba005097c528%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/ansible-project/9fea132f-6939-48da-b3f9-ba005097c528%40googlegroups.com>.
>  
>
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to 
> > ansible...@googlegroups.com   ansible-project+unsubscr...@googlegroups.com >. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/085344f6-fa0a-4b8c-821a-abc1fdf6ec3a%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/ansible-project/085344f6-fa0a-4b8c-821a-abc1fdf6ec3a%40googlegroups.com?utm_medium=email_source=footer>.
>  
>
>
>
> -- 
> Ecommerce and Linux consulting + Perl and web application programming. 
> Debian and Sympa administration. Provisioning with Ansible. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e38fdd60-4b14-471e-9b4e-d321c87d152a%40googlegroups.com.


Re: [ansible-project] pip needs to be installed

2020-04-16 Thread Stefan Hornburg (Racke)
On 4/16/20 12:07 PM, Punit Ramaji wrote:
> Yes, I am trying to upgrade it. But it is failing. 

Which version of Python do you use on the target machine? Where is pip 
installed exactly?

Regards
Racke

> 
> On Thursday, 16 April 2020 15:28:31 UTC+5:30, Mauricio Tavares wrote:
> 
> On Thu, Apr 16, 2020 at 5:51 AM Punit Ramaji  > wrote:
> >
> > I am getting below error, when I try to pip: name=pip state=latest
> > TASK [install : Upgrade pip] 
> ***
> > fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to 
> find any of pip2, pip to use.  pip needs to be
> installed."}
> >         to retry, use: --limit
> >
>       Is pip already installed in target machine?
> 
> > --
> > 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 view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/ansible-project/9fea132f-6939-48da-b3f9-ba005097c528%40googlegroups.com
> 
> .
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/085344f6-fa0a-4b8c-821a-abc1fdf6ec3a%40googlegroups.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/31d659c8-c376-8eb6-61db-c83b7e73807c%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] pip needs to be installed

2020-04-16 Thread Punit Ramaji
Yes, I am trying to upgrade it. But it is failing. 

On Thursday, 16 April 2020 15:28:31 UTC+5:30, Mauricio Tavares wrote:
>
> On Thu, Apr 16, 2020 at 5:51 AM Punit Ramaji  > wrote: 
> > 
> > I am getting below error, when I try to pip: name=pip state=latest 
> > TASK [install : Upgrade pip] 
> *** 
> > fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to find 
> any of pip2, pip to use.  pip needs to be installed."} 
> > to retry, use: --limit 
> > 
>   Is pip already installed in target machine? 
>
> > -- 
> > 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/9fea132f-6939-48da-b3f9-ba005097c528%40googlegroups.com.
>  
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/085344f6-fa0a-4b8c-821a-abc1fdf6ec3a%40googlegroups.com.


Re: [ansible-project] pip needs to be installed

2020-04-16 Thread Mauricio Tavares
On Thu, Apr 16, 2020 at 5:51 AM Punit Ramaji  wrote:
>
> I am getting below error, when I try to pip: name=pip state=latest
> TASK [install : Upgrade pip] 
> ***
> fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to find any 
> of pip2, pip to use.  pip needs to be installed."}
> to retry, use: --limit
>
  Is pip already installed in target machine?

> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/9fea132f-6939-48da-b3f9-ba005097c528%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAHEKYV4p4Ws9Y0z%2Be7acL_p4poZ-0GfWu12%3DtMrDX3B%2B9x%2BKcw%40mail.gmail.com.


[ansible-project] pip needs to be installed

2020-04-16 Thread Punit Ramaji
I am getting below error, when I try to pip: name=pip state=latest
TASK [install : Upgrade pip] 
***
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to find 
any of pip2, pip to use.  pip needs to be installed."}
to retry, use: --limit

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9fea132f-6939-48da-b3f9-ba005097c528%40googlegroups.com.


Re: [ansible-project] Re: Need some suggestion

2020-04-16 Thread David Foley
If you are looking to break your application roles up into some sort of micro 
service: I would suggest looking at Ansible plugin for Jenkins and configure a 
pipeline with choces, based on these it will callthe roles, or you can have a 
pipeline for each role with a downstream from the main pipeline. 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/69cec0ae-7026-48d2-962c-7b3fd2132aa7%40googlegroups.com.


Re: [ansible-project] Re: Need some suggestion

2020-04-16 Thread Rahul Kumar
THis is theoretical question only , I am trying to make some ansible based
framework which manages deployments of many applications.

Lets  see if i can explain , if not I am sorry :
I have 10 applications. All 10  applications can be installed and
configured using ansible via a common monolithic github project which
contains 10 roles , one for each application installation and configuration.
Now actual application code for each application is maintained in 10
different repository of github.
But installation and configurations of all applications are there in single
project as i mentioned in first line.

Now I want to break this monolithic picture and want to move ansible
related code of each and each application to individual application code
repos. So that whenever some application feature comes, one can enhance its
ansible code in same repo (which has both Application code+ Ansible code).

Now at the same time , i want to maintain some ansible code in Common
monolithic  project  also  which can be applied on all applications , so no
meaning of duplicating this code in individual application github repo.
Example of such common code: My All 10 applications requires deployment in
JBOSS server or any other server. So i want to maintain all JBOSS
configuration related tuning etc. in common monolithic code.

Hence in order to deploy my application , i need both Application code
github repo( java code+ ansible code)  and common monolithic github project
(because deployment in server is managed through this common project).
Hence i need to create some interface between this common project and
application specific project , how can i do that ?


On Thu, 16 Apr 2020 at 14:00, Stefan Hornburg (Racke) 
wrote:

> On 4/16/20 8:41 AM, Rahul Kumar wrote:
> > Any update on this ? Hope this question is still alive and not lost?
> >
>
> I think you misunderstood me, so as long as you don't offer more concrete
> information / use cases this thread
> is pretty dead from my point of view.
>
> Regards
>  Racke
>
> > Rahul
> >
> > On Wed, 15 Apr 2020 at 17:41, Rahul Kumar  > wrote:
> >
> > THanks Racke , I would be waiting for same !
> >
> > Rahul
> >
> > On Wed, 15 Apr 2020 at 15:08, Stefan Hornburg (Racke) <
> ra...@linuxia.de > wrote:
> >
> > On 4/15/20 11:23 AM, Rahul Kumar wrote:
> > > Thanks Dick , would you like to suggest some thing on this ?
> > >
> > > Rahul
> >
> > Your request is rather theoretical. I would add some use cases
> to increase chances on (sensible) answers.
> >
> > Regards
> >   Racke
> >
> > >
> > > On Tue, 14 Apr 2020 at 13:31, Dick Visser <
> dick.vis...@geant.org 
> > >>
> wrote:
> > >
> > > On Tue, 14 Apr 2020 at 07:08, Rahul Kumar <
> rajput4u4...@gmail.com 
> > >>
> wrote:
> > > >
> > > > Guys any help on this ?
> > >
> > > Not yet apparently, but given that this list is run by
> volunteers and
> > > it's Easter holidays that shouldn't come as a surprise.
> > >
> > > --
> > > 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  ansible-project%2bunsubscr...@googlegroups.com>
> > >.
> > > To view this discussion on the web visit
> > >
> >
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwNiwJ5UwBrPdgBZN04LS%2BtBgJAesv6kNmwupW_KbBapFA%40mail.gmail.com
> .
> > >
> > > --
> > > You received this message because you are subscribed to the
> Google Groups "Ansible Project" group.
> > > To unsubscribe from this group and stop receiving emails from
> it, send an email to
> > > ansible-project+unsubscr...@googlegroups.com  ansible-project%2bunsubscr...@googlegroups.com>
> > >.
> > > To view this discussion on the web visit
> > >
> >
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEzaBPxtO3GqjDX9KALk0ZseWbiE4vHSVXt7wOUa%2Bd9xwg%40mail.gmail.com
> > >
> > <
> 

[ansible-project] Re: Error message - "module_stderr": "/bin/sh: 1: powershell: not found\n", when running a powershell through win_command

2020-04-16 Thread Pavan K Kumar
Hi Kiran,

Did you got any fix for this ?

im also facing the same issue.. 

On Sunday, February 23, 2020 at 12:38:16 AM UTC+5:30, Karthik Kumar wrote:
>
> Iam trying to run the below simple playbook in ansible in windows 10 
> through ubuntu installed.
>
> But Iam getting error as  "module_stderr": "/bin/sh: 1: powershell: not 
> found\n", "module_stdout": 
> Please let me know how to resolve this issue.
>
> - name: Run Powershell Scripts
>   hosts: localhost
>   tasks:
> - name: Run powershell script
>   win_command: pwsh.exe -ExecutionPolicy ByPass -File 
> C:/temp/Firstpowershellscript.ps1
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0956a7ca-030f-41c6-a1e3-2e5c27b1dc9f%40googlegroups.com.


[ansible-project] "Win_Command" module not working to connect localhost to run Powershell script from ansible which is installed in windows10

2020-04-16 Thread Pavan K Kumar


Hello Experts,


I'm new to Ansible and PowerShell.


I have installed cygwin in my windows 10 Operating system and installed 
ansible and its related packages as per below mail.

https://geekflare.com/ansible-installation-windows/


*Here are the environment details*

Ansible version:  2.8.4
python version : 3.7.7 (default, Apr 10 2020, 07:59:19) [GCC 9.3.0]

Powershell Version: 5.1.17763.1007


on above successful setup, i tried to run my below sample ansible script 
with *hosts as "localhost"*


- hosts: localhost

  tasks:

  - name: "run whoami"

win_command: whoami

register: whoami_out

  - debug: var=whoami_out.stdout_lines


but, i am ending up with the below error


   1. 
   
   [WARNING]: provided hosts list is empty, only localhost is available. 
   Note that the implicit localhost does not match 'all'
   
PLAY [localhost] 
***

TASK [Gathering Facts] 
*
ok: [localhost]

TASK [run whoami] 
**
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": 
"/home/Pavan.Kammara/.ansible/tmp/ansible-tmp-1586957425.671443-215768864612631/AnsiballZ_win_command.ps1
 
: The term 
\r\n'/home/Pavan.Kammara/.ansible/tmp/ansible-tmp-1586957425.671443-215768864612631/AnsiballZ_win_command.ps1'
 
is not \r\nrecognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if \r\na path was 
included, verify that the path is correct and try again.\r\nAt line:1 
char:1\r\n+ 
/home/Pavan.Kammara/.ansible/tmp/ansible-tmp-1586957425.671443-215768 
...\r\n+ 
~\r\n + 
CategoryInfo : ObjectNotFound: (/home/Pavan.Kam...win_command.ps1:String) 
[], CommandNotFoundException\r\n + FullyQualifiedErrorId : 
CommandNotFoundException\r\n \r\n", "module_stdout": "", "msg": "MODULE 
FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP 
*
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 
ignored=0


and i tried the 2nd approach by creating my windows 10 machine ip address 
in etc/ansible/ansible.cfg and referred the same in asnible playbook as 
below

- hosts: all
  tasks:
  - name: "run whoami"
win_command: whoami
register: whoami_out
  - debug: var=whoami_out.stdout_lines 


this time also ended up with the different error, PFB

PLAY [all] 
*

TASK [Gathering Facts] 
*
fatal: [192.***.*.***]: UNREACHABLE! => {"changed": false, "msg": "Failed 
to connect to the host via ssh: ssh: connect to host 192.***.*.*** port 22: 
Connection refused", "unreachable": true}

PLAY RECAP 
*
192.***.*.***   : ok=0changed=0unreachable=1failed=0
skipped=0rescued=0ignore 


Kindly help me, is it something the environment set up issue. Im completely 
clueless why it is not working as im new to this technology.

Thanks in advance! 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0a657327-034b-4131-a9b7-9ee99364889a%40googlegroups.com.


Re: [ansible-project] Re: Need some suggestion

2020-04-16 Thread Stefan Hornburg (Racke)
On 4/16/20 8:41 AM, Rahul Kumar wrote:
> Any update on this ? Hope this question is still alive and not lost?
> 

I think you misunderstood me, so as long as you don't offer more concrete 
information / use cases this thread
is pretty dead from my point of view.

Regards
 Racke

> Rahul
> 
> On Wed, 15 Apr 2020 at 17:41, Rahul Kumar  > wrote:
> 
> THanks Racke , I would be waiting for same !
> 
> Rahul
> 
> On Wed, 15 Apr 2020 at 15:08, Stefan Hornburg (Racke)  > wrote:
> 
> On 4/15/20 11:23 AM, Rahul Kumar wrote:
> > Thanks Dick , would you like to suggest some thing on this ?
> >
> > Rahul
> 
> Your request is rather theoretical. I would add some use cases to 
> increase chances on (sensible) answers.
> 
> Regards
>           Racke
> 
> >
> > On Tue, 14 Apr 2020 at 13:31, Dick Visser  
> >> wrote:
> >
> >     On Tue, 14 Apr 2020 at 07:08, Rahul Kumar 
> mailto:rajput4u4...@gmail.com>
> >> 
> wrote:
> >     >
> >     > Guys any help on this ?
> >
> >     Not yet apparently, but given that this list is run by 
> volunteers and
> >     it's Easter holidays that shouldn't come as a surprise.
> >
> >     --
> >     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 view this discussion on the web visit
> >   
>  
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwNiwJ5UwBrPdgBZN04LS%2BtBgJAesv6kNmwupW_KbBapFA%40mail.gmail.com.
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, 
> send an email to
> > ansible-project+unsubscr...@googlegroups.com 
> 
>  >.
> > To view this discussion on the web visit
> >
> 
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEzaBPxtO3GqjDX9KALk0ZseWbiE4vHSVXt7wOUa%2Bd9xwg%40mail.gmail.com
> >
> 
> .
> 
> 
> -- 
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, 
> send an email to
> ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/ansible-project/f32404c4-4e9d-d848-41f1-c77886d10cfa%40linuxia.de.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEyXQ-CYA--dJvK2QxJvU2BXhyzppJNfAvG2kx%2BgKAio%3Dg%40mail.gmail.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

[ansible-project] Re: "msg": "Local object for PUT does not exist"

2020-04-16 Thread Serin Abraham
anyway i figured the actual problem. it was just the 
"src"(/root/playbook/serin.txt) file was not present in the targeted 
"hosts"(ubuntu).

simple issue but i guess this is how we learn :)

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c390524b-4bc4-42e2-a8c3-457b7b13105d%40googlegroups.com.


Re: [ansible-project] run_once not working to register value of curl

2020-04-16 Thread Nicola Contu
The discussion has been moved to another problem after Dick's suggestion,
sorry for the confusion.
By the way I solved it using this
:  hostvars['localhost']['PHP_SITE_RESPONSE'].json.version

That's the way to pass a variable to another play.

Il giorno gio 16 apr 2020 alle ore 02:14 Dan Linder  ha
scritto:

> When you say "variable is not available between plays in the same
> playbook", that is a different question than the one originally asked in
> this thread.
>
> I'd suggest you post a very minimal playbook showing the error so we can
> reproduce it and assist you further with that problem.
>
> You wrote "I think I did not understand what you want to debug."
>
> The playbook example was trying to "baby step" adding a couple more tasks
> in the play, and introduce a few additional variables.  I might have
> confused you by using the "debug:" module.
>
> On Wednesday, April 15, 2020 at 2:43:51 AM UTC-5, Nicola Contu wrote:
>>
>> I am sorry Dan,
>> I think I did not understand what you want to debug.
>> This playbook does not work and I can't make it working.
>>
>> Sorry about that.
>>
>> Btw, the issue is that the variable is not available between plays in the
>> same playbook. I just want to know how to pass those variable to the next
>> play because it does not seem to be automatic.
>>
>> Thanks
>>
>> Il giorno ven 10 apr 2020 alle ore 23:41 Dan Linder  ha
>> scritto:
>>
>>> So, from that output we know that the 'PHP_SITE_RESPONSE' variable is
>>> being set and we have the variable structure to look at.
>>>
>>> Your error from a few messages back just showed:
>>> {"msg": "The task includes an option with an undefined variable. The
>>> error was: 'PHP_SITE_RESPONSE' is undefined
>>>
>>> I assume that was from one of these tasks:
>>> ```
>>> - name: Write header
>>>   run_once: true
>>>   lineinfile: dest=/home/ncontu/test.txt create=yes line="LATEST
>>> VERSION PHP {{PHP_SITE_RESPONSE.json.version}} HTTPD
>>> {{HTTPD_SITE_VERSION.stdout_lines[0]VERSION.stdout_lines[0]}}"
>>>   delegate_to: 127.0.0.1
>>>
>>> - name: Write to local disk
>>>   lineinfile: dest=/home/ncontu/test.txt insertafter=EOF create=yes
>>> line="{{ ansible_fqdn }} {{CURRENT_PHP_VERSION.stdout_lines[0]}}
>>> {{CURRENT_HTTPD_VERSI}} {{CURRENT_GIT_VERSION.stdout_lines[0]}}"
>>>   delegate_to: 127.0.0.1
>>>   when: CURRENT_PHP_VERSION.stdout_lines[0] !=
>>> PHP_SITE_RESPONSE.json.version or CURRENT_HTTPD_VERSION.stdout_lines[0] !=
>>> HTTPD_SITE_VERSION.stdout_lines[VERSION.stdout_lines[0] !=
>>> GIT_SITE_VERSION.stdout_lines[0]
>>> ```
>>>
>>> As a next step I'd add each of those tasks one at a time into the small
>>> playbook you just wrote/tested but change the tasks to further "debug"
>>> calls:
>>>
>>> ```
>>> - hosts: "{{ variable_host }}"
>>>   serial: 1
>>>   tasks:
>>> -
>>>   name: "Get PHP version from site"
>>>   register: PHP_SITE_RESPONSE
>>>   uri:
>>> body_format: json
>>> method: GET
>>> return_content: true
>>> url: "https://www.php.net/releases/?json=7.2;
>>>   run_once: true
>>>   delegate_to: 127.0.0.1
>>>
>>> -
>>>   name: "Show PHP version from site"
>>>   debug:
>>> var: PHP_SITE_RESPONSE
>>>
>>> - name: DEBUG Write header
>>>   run_once: true
>>>   debug: |
>>> lineinfile: dest=/home/ncontu/test.txt create=yes line="LATEST
>>> VERSION PHP {{PHP_SITE_RESPONSE.json.version}} HTTPD
>>> {{HTTPD_SITE_VERSION.stdout_lines[0]VERSION.stdout_lines[0]}}"
>>>   delegate_to: 127.0.0.1
>>> ```
>>>
>>> On Friday, April 10, 2020 at 1:06:08 PM UTC-5, Nicola Contu wrote:

 [ncontu@cmd-config cmd]$ ansible-playbook playbooks/test.yml -e
 "variable_host=127.0.0.1"
 [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


 PLAY [127.0.0.1]
 ***

 TASK [Gathering Facts]
 *
 ok: [127.0.0.1]

 TASK [Get PHP version from site]
 ***
 ok: [127.0.0.1]

 TASK [Show PHP version from site]
 

[ansible-project] Re: "msg": "Local object for PUT does not exist"

2020-04-16 Thread Serin Abraham
thank you Dick it worked. 

I'm using root since its just for practise. anyway I will be mindful of 
that. 

but the thing is I was able to install a ec2 and create a s3 bucket without 
localhost. anyway will need to dig-in deeper.

thanks again and appreciate it and thanks David for your help as-well. 
Cheers

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fd359445-089b-4662-bf3b-801a14679c59%40googlegroups.com.


Re: [ansible-project] Re: Need some suggestion

2020-04-16 Thread Rahul Kumar
Any update on this ? Hope this question is still alive and not lost?

Rahul

On Wed, 15 Apr 2020 at 17:41, Rahul Kumar  wrote:

> THanks Racke , I would be waiting for same !
>
> Rahul
>
> On Wed, 15 Apr 2020 at 15:08, Stefan Hornburg (Racke) 
> wrote:
>
>> On 4/15/20 11:23 AM, Rahul Kumar wrote:
>> > Thanks Dick , would you like to suggest some thing on this ?
>> >
>> > Rahul
>>
>> Your request is rather theoretical. I would add some use cases to
>> increase chances on (sensible) answers.
>>
>> Regards
>>   Racke
>>
>> >
>> > On Tue, 14 Apr 2020 at 13:31, Dick Visser > > wrote:
>> >
>> > On Tue, 14 Apr 2020 at 07:08, Rahul Kumar > > wrote:
>> > >
>> > > Guys any help on this ?
>> >
>> > Not yet apparently, but given that this list is run by volunteers
>> and
>> > it's Easter holidays that shouldn't come as a surprise.
>> >
>> > --
>> > 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 > ansible-project%2bunsubscr...@googlegroups.com>.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwNiwJ5UwBrPdgBZN04LS%2BtBgJAesv6kNmwupW_KbBapFA%40mail.gmail.com
>> .
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Ansible Project" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to
>> > ansible-project+unsubscr...@googlegroups.com > ansible-project+unsubscr...@googlegroups.com>.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/ansible-project/CAGH8rEzaBPxtO3GqjDX9KALk0ZseWbiE4vHSVXt7wOUa%2Bd9xwg%40mail.gmail.com
>> > <
>> https://groups.google.com/d/msgid/ansible-project/CAGH8rEzaBPxtO3GqjDX9KALk0ZseWbiE4vHSVXt7wOUa%2Bd9xwg%40mail.gmail.com?utm_medium=email_source=footer
>> >.
>>
>>
>> --
>> Ecommerce and Linux consulting + Perl and web application programming.
>> Debian and Sympa administration. Provisioning with Ansible.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ansible-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/f32404c4-4e9d-d848-41f1-c77886d10cfa%40linuxia.de
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAGH8rEyXQ-CYA--dJvK2QxJvU2BXhyzppJNfAvG2kx%2BgKAio%3Dg%40mail.gmail.com.


Re: [ansible-project] telnet issue

2020-04-16 Thread Kai Stian Olstad
On Mon, Apr 13, 2020 at 01:37:13AM -0700, Zaldy B wrote:
> playbook is just straight forward:
> 
> 
> ---
> - name: Telnet do show version for IOS
>   hosts: Cisco_Telnet
>   gather_facts: false
>   connection: local
> 
>   tasks:
> - name: show version
>   telnet:
> user: "{{ username }}"
> password: "{{ password }}"
> login_prompt: "Username:"
> prompts:
>   - "[>|#]"
> command:
>   - terminal length 0
>   - show version
> 
> 
> hostfile:
> 
> [Cisco_Telnet]
> cisco_devicehost=192.168.1.1   username=cisco password=cisco

This looks like a playbook just copied from documentation.
https://docs.ansible.com/ansible/latest/modules/telnet_module.html

Your task is missing host: default is the variable remote_addr according to the
documentation. So you need to provide host: or sett the correct variable.

You also need to tailor the prompt for you environment, it should be a list of
all prompt, you only have one prompt that is literally checking for [>|#] I
doubt you prompt looks like that.

If you can't figure this out yourself you need to provide the complete output
of telnet including telnet itself and the exit of the telnet.

-- 
Kai Stian Olstad

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200416063223.ripv6dkloy2els5w%40olstad.com.