Re: [ansible-project] telnet issue

2020-04-22 Thread Werner Flamme
Zaldy B schrieb am 23.04.20 um 05:45:
> HI Brian,
> 
> Thank you for the reply. 
> 
> I did the 5v's as you mentioned, and dont know why it is saying that the 
> hosts does not match. 
> 
> TEMPLATES]# cp IOS_telnet.yaml /etc/ansible/
> [root@spm6637 TEMPLATES]# ansible-playbook -i Cisco_Telnet IOS_telnet.yaml

Zaldy,

-i is not to be followed by a hostname the playbook will be excuted on,
but by an inventory list (either a file name or a host list). You have
to specify the hosts file here, at least that is what the first WARNING
is about

>  [WARNING]: Unable to parse /etc/ansible/TEMPLATES/Cisco_Telnet as an 
> inventory source

The rest is a follow-up error: since the mentioned inventory list has
not been found, there is no 'all' host group and no host other than
'localhost' at all.

>  [WARNING]: No inventory was parsed, only implicit localhost is available
>  [WARNING]: provided hosts list is empty, only localhost is available. Note 
> that the implicit localhost does not match 'all'
>  [WARNING]: Could not match supplied host pattern, ignoring: Cisco_Telnet

My proposal: you should skip the "-i Cisco_Telnet" part of the
commandline and instead put the hostname inside the playbook.

> 
> PLAY [Telnet do show version for IOS] 
> ***
> skipping: no hosts matched
> 
> PLAY RECAP 
> **
> 
> 
> I tried pinging it, and it was successful.
> 
> TEMPLATES]# ansible Cisco_Telnet -m ping
> d2c2e-be-ag249-o | SUCCESS => {
> "changed": false, 
> "ping": "pong"
> 
> 
> TEMPLATES]# ansible --list-host  Cisco_Telnet
>   hosts (1):
> d2c2e-be-ag249-o
> 
> 
> 
> On Tuesday, April 21, 2020 at 1:04:54 AM UTC-4, Brian Coca wrote:
>>
>> for telnet use 5 v's (-v) , 3 won't show anything about the task. 
>>
>>
>> -- 
>> -- 
>> Brian Coca 
>>
>>
> 


-- 


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1076f1ca-5cf1-802a-78b4-79dae3b611fe%40ufz.de.


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [ansible-project] telnet issue

2020-04-22 Thread Zaldy B
Here is my cfg file:

ansible]# cat ansible.cfg
[defaults]
# Use local hosts file
inventory = /etc/ansible/hosts

# Disable SSH key host checking (RSA fingerprints)
host_key_checking = False

# Do not create .retry files on job failures
retry_files_enabled = False

# Do not gather facts
gathering = explicit

#Python Interpreter for Ansible 2.8 onwards
interpreter_python = /usr/bin/python3


On Wednesday, April 22, 2020 at 11:50:48 PM UTC-4, Zaldy B wrote:
>
> I can also see my inventory:
>
> TEMPLATES]# ansible all --list-hosts
>   hosts (1):
> d2c2e-be-ag249-o
>
>
> On Wednesday, April 22, 2020 at 11:45:30 PM UTC-4, Zaldy B wrote:
>>
>> HI Brian,
>>
>> Thank you for the reply. 
>>
>> I did the 5v's as you mentioned, and dont know why it is saying that the 
>> hosts does not match. 
>>
>> TEMPLATES]# cp IOS_telnet.yaml /etc/ansible/
>> [root@spm6637 TEMPLATES]# ansible-playbook -i Cisco_Telnet IOS_telnet.yaml
>>  [WARNING]: Unable to parse /etc/ansible/TEMPLATES/Cisco_Telnet as an 
>> inventory source
>>  [WARNING]: No inventory was parsed, only implicit localhost is available
>>  [WARNING]: provided hosts list is empty, only localhost is available. 
>> Note that the implicit localhost does not match 'all'
>>  [WARNING]: Could not match supplied host pattern, ignoring: Cisco_Telnet
>>
>> PLAY [Telnet do show version for IOS] 
>> ***
>> skipping: no hosts matched
>>
>> PLAY RECAP 
>> **
>>
>>
>> I tried pinging it, and it was successful.
>>
>> TEMPLATES]# ansible Cisco_Telnet -m ping
>> d2c2e-be-ag249-o | SUCCESS => {
>> "changed": false, 
>> "ping": "pong"
>>
>>
>> TEMPLATES]# ansible --list-host  Cisco_Telnet
>>   hosts (1):
>> d2c2e-be-ag249-o
>>
>>
>>
>> On Tuesday, April 21, 2020 at 1:04:54 AM UTC-4, Brian Coca wrote:
>>>
>>> for telnet use 5 v's (-v) , 3 won't show anything about the task. 
>>>
>>>
>>> -- 
>>> -- 
>>> Brian Coca 
>>>
>>>

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


Re: [ansible-project] telnet issue

2020-04-22 Thread Zaldy B
I can also see my inventory:

TEMPLATES]# ansible all --list-hosts
  hosts (1):
d2c2e-be-ag249-o


On Wednesday, April 22, 2020 at 11:45:30 PM UTC-4, Zaldy B wrote:
>
> HI Brian,
>
> Thank you for the reply. 
>
> I did the 5v's as you mentioned, and dont know why it is saying that the 
> hosts does not match. 
>
> TEMPLATES]# cp IOS_telnet.yaml /etc/ansible/
> [root@spm6637 TEMPLATES]# ansible-playbook -i Cisco_Telnet IOS_telnet.yaml
>  [WARNING]: Unable to parse /etc/ansible/TEMPLATES/Cisco_Telnet as an 
> inventory source
>  [WARNING]: No inventory was parsed, only implicit localhost is available
>  [WARNING]: provided hosts list is empty, only localhost is available. 
> Note that the implicit localhost does not match 'all'
>  [WARNING]: Could not match supplied host pattern, ignoring: Cisco_Telnet
>
> PLAY [Telnet do show version for IOS] 
> ***
> skipping: no hosts matched
>
> PLAY RECAP 
> **
>
>
> I tried pinging it, and it was successful.
>
> TEMPLATES]# ansible Cisco_Telnet -m ping
> d2c2e-be-ag249-o | SUCCESS => {
> "changed": false, 
> "ping": "pong"
>
>
> TEMPLATES]# ansible --list-host  Cisco_Telnet
>   hosts (1):
> d2c2e-be-ag249-o
>
>
>
> On Tuesday, April 21, 2020 at 1:04:54 AM UTC-4, Brian Coca wrote:
>>
>> for telnet use 5 v's (-v) , 3 won't show anything about the task. 
>>
>>
>> -- 
>> -- 
>> Brian Coca 
>>
>>

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


Re: [ansible-project] telnet issue

2020-04-22 Thread Zaldy B
HI Brian,

Thank you for the reply. 

I did the 5v's as you mentioned, and dont know why it is saying that the 
hosts does not match. 

TEMPLATES]# cp IOS_telnet.yaml /etc/ansible/
[root@spm6637 TEMPLATES]# ansible-playbook -i Cisco_Telnet IOS_telnet.yaml
 [WARNING]: Unable to parse /etc/ansible/TEMPLATES/Cisco_Telnet as an 
inventory source
 [WARNING]: No inventory was parsed, only implicit localhost is available
 [WARNING]: provided hosts list is empty, only localhost is available. Note 
that the implicit localhost does not match 'all'
 [WARNING]: Could not match supplied host pattern, ignoring: Cisco_Telnet

PLAY [Telnet do show version for IOS] 
***
skipping: no hosts matched

PLAY RECAP 
**


I tried pinging it, and it was successful.

TEMPLATES]# ansible Cisco_Telnet -m ping
d2c2e-be-ag249-o | SUCCESS => {
"changed": false, 
"ping": "pong"


TEMPLATES]# ansible --list-host  Cisco_Telnet
  hosts (1):
d2c2e-be-ag249-o



On Tuesday, April 21, 2020 at 1:04:54 AM UTC-4, Brian Coca wrote:
>
> for telnet use 5 v's (-v) , 3 won't show anything about the task. 
>
>
> -- 
> -- 
> Brian Coca 
>
>

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


Re: [ansible-project] [WARNING]: Module invocation had junk after the JSON data:

2020-04-22 Thread Dick Visser
Hi


Thanks for using ansible. To answer your question more information is
needed. Could you please describe clearly all of the below:


- What goal you are trying to achieve.

- How you are doing this.

- What problems you encounter.

- Which commands did you run, and what actual output did you get (copied as
plain text - not as screenshots, images, or other binary attachments).

- What do the relevant inventory/tasks/playbooks/code/variables look like.

- The output of ‘ansible --version’



On Thu, 23 Apr 2020 at 00:33, R2  wrote:

> Has anyone ever seen this issue with ansible when attempting to install a
> yum package
>
> --
> 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/38bbd83d-de88-4993-9726-f7144019a144%40googlegroups.com
> 
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

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


Re: [ansible-project] setting explicit remote shell

2020-04-22 Thread Brian Coca
if you set these as environment variables, Ansible is not going to do
anything with them, they need to be variables.

ansible_shell_executable: "/usr/bin/ksh"
ansible_shell_interpreter: "/usr/bin/ksh"
ansible_python_interpreter: "/opt/bin/python"

 Also the `environment:` keyword won't affect Ansible itself, any
environment setting for Ansible must be set BEFORE calling the ansible
executable.


In any case, the output seems to show you using `ksh` and the specific
python, so they must be set correctly, just posting the above to
clarify misconceptions.

I'm not sure what is causing the bash error, since the last command
(part of cleanup) clearly uses ksh also:

'/usr/bin/ksh -c '"'"'rm -f -r
/root/.ansible/tmp/ansible-tmp-1587558405.77-115997468659119/ >
/dev/null 2>&1 && sleep 0'"'"''

unless the ssh login itself is forcing bash usage. I suggest tracing
the process on the remote to try to find out what exactly is executed
to trigger that error, since the last ansible command clearly
specifies ksh.

-- 
--
Brian Coca

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


[ansible-project] associating IAM role with AWS redshift cluster in ansible

2020-04-22 Thread Raymond Yee


I would like to attach IAM roles to a redshift cluster in my ansible 
playbook but don’t see any parameter for IAM roles in the redshift module 
(https://docs.ansible.com/ansible/latest/modules/redshift_module.html). 
Such options do exist in the boto3 library 
(https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/redshift.html#Redshift.Client.create_cluster)
 
and the awscli 
(https://docs.aws.amazon.com/cli/latest/reference/redshift/create-cluster.html).
 
Any suggestions of what to do? 


Thanks.


-Raymond Yee

-- 
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/05d741ee-8d2a-44f8-ac23-3d5142101f9e%40googlegroups.com.


[ansible-project] [WARNING]: Module invocation had junk after the JSON data:

2020-04-22 Thread R2
Has anyone ever seen this issue with ansible when attempting to install a 
yum package

-- 
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/38bbd83d-de88-4993-9726-f7144019a144%40googlegroups.com.


Re: [ansible-project] Extract content in the register variable stdout value

2020-04-22 Thread Stefan Hornburg (Racke)
On 4/22/20 8:56 PM, Josephsimon Arokiaraj wrote:
> Hi All,
> 
> I am capturing the script output in the ansible play using register and using 
> it on another role.  The register value
> contains some additional characters.
> 
>   - name: Extracting Hostname
> 
>   local_action: command /usr/bin/perl  extracturl.pl {{ url }} port
> 
>   register: port
> 
> 
> I can get the value in  stdout   "80"           
> 
> 
> "stderr": "", "stderr_lines": [], "stdout": "80", "stdout_lines": ["80"]
> 
> 
> Using port.stdout in a another task. Here is the issue. I am getting [u'80'] 
> in {{ port.stdout }} . 
> 
>   - include_role:
> 
>     name: roles/telnet
> 
>   vars:
> 
>     telnet_port
> 
>  - "{{ port.stdout }}"
> 
> 
> Any idea how to get rid of [u''] . Just I need the port no: 80

vars:
   telnet_port: "{{ port.stdout }}"

In your task the - turns it into  a list.

Regards
  Racke

> 
> 
> Any ideas how to do this?
> 
> 
> Cheers,
> 
> Joseph 
> 
>      
> 
> 
> -- 
> 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/9afba275-9e3a-4c05-8cf7-b68318400ea1%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/46631a5f-d619-9398-4f43-ae23df839582%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[ansible-project] Extract content in the register variable stdout value

2020-04-22 Thread Josephsimon Arokiaraj
Hi All,

I am capturing the script output in the ansible play using register and 
using it on another role.  The register value contains some additional 
characters.

  - name: Extracting Hostname

  local_action: command /usr/bin/perl  extracturl.pl {{ url }} port

  register: port


I can get the value in  stdout   "80"   


"stderr": "", "stderr_lines": [], "stdout": "80", "stdout_lines": ["80"]


Using port.stdout in a another task. Here is the issue. I am getting 
[u'80'] in {{ port.stdout }} . 

  - include_role:

name: roles/telnet

  vars:

telnet_port

 - "{{ port.stdout }}"


Any idea how to get rid of [u''] . Just I need the port no: 80


Any ideas how to do this?


Cheers,

Joseph 

 


-- 
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/9afba275-9e3a-4c05-8cf7-b68318400ea1%40googlegroups.com.


Re: [ansible-project] [WARNING]: "register" is not templatable, but we found:

2020-04-22 Thread Laurent HENSSEN
Interesting, I also just found that.

I did try that : 

---
- set_fact:
"{{ path_list }}": "{{ rrr.results }}"

- debug: var=ansible_facts
- debug: var="{{ path_list }}"
---

where "rrr" is the "register: rrr" part.
And so, I can copy the content of "rrr" (previously registered) to fact 
with any var name and any value.

This should definitively resolve my issue :)


Thanks, 
Laurent


Le mercredi 22 avril 2020 18:19:22 UTC+2, Stefan Hornburg (Racke) a écrit :
>
> On 4/22/20 6:07 PM, Laurent HENSSEN wrote: 
> > Hello,  
> > 
> > 
> > I'm trying to register a var through a dynamical use of "register" (I 
> mean : using a var, like : register: {{ var }}). 
> > 
> > Dev updated the code and removed this option (now static only). 
> > I'm not able to find more information about that change and also there 
> is nobody connected on the IRC so, I post here. 
>
> It was likely never documented. You can append a "set_fact" task  to 
> alleviate that. 
>
> Regards 
> Racke 
>
> >   
> > 
> > Bug report (closed without real details) :  
> > https://github.com/ansible/ansible/issues/57839 
> > 
> > Code change :  
> > 
> https://gitlab.ics.muni.cz/242618/ansible/commit/be776daefed047f0bd45d7441efde046677fd417
>  
> > 
> > 
> > The very detailed comment about that (from the bug report) :  
> > --- 
> > 
> > 
> >   sivel  commented on Jun 14, 2019 
> >   <
> https://github.com/ansible/ansible/issues/57839#issuecomment-502115371> 
> > 
> > This is expected and we will never allow this behavior. Register must 
> use a statically defined string. 
> > 
> > If you have further questions please stop by IRC or the mailing list: 
> > 
> >   * IRC: #ansible on irc.freenode.net 
> >   * mailing list: 
> https://groups.google.com/forum/#!forum/ansible-project 
> > 
> > @sivel  sivel  closed 
> this on Jun 14, 2019 
> >  
> > --- 
> > 
> > 
> > That's it, no more information, I don't understand why and now I'm stuck 
> in my Ansible configuration. 
> > I was trying to create a loop of 4 tasks (function like), I'm able to 
> pass any vars to those tasks (using separated 
> > include: and loop:). 
> > But all this is useless if I can't register results in "dynamically 
> selected" variable name. 
> > Final results are input for a template (just after that include task). 
> > 
> > So, I have now a "working" function, able to consume any var already 
> defined ... but can only register to a unique var 
> > (very very useful when you are in a loop with MULTIPLE elements and not 
> only 1). 
> > Can someone explain me why this change of behavior and how am I supposed 
> to make it works now without the option to 
> > "register: {{ my_var }} ? 
> > 
> > Let me copy past my configuration so that it will be easier to 
> understand. 
> > What I see with that change to static register : can't loop on tasks 
> anymore (or only for basic use). 
> > Pelase let me know how I'm supposed to do that in "a compact way" now (I 
> was trying to move from 5x blocks of 4 tasks to 
> > 1 include (with loop) of 4 tasks). 
> > 
> > 
> > --- 
> > (main) 
> > # Check if paths exist + extract real path (no symlink) 
> > 
> ##
>  
>
> > # Using a Function like in Ansible (= big loop on included tasks) 
> > - include: path_checker.yml 
> >   loop_control: 
> > # As we are creating a big loop, and as we also have one nested 
> loop, need to use another var name else they 
> > conflict (if "item" on both nested loops) 
> > loop_var: path_list 
> >   # Here, need to add all lists available so that all paths will be 
> checked as expected (before generating the template) 
> >   loop: 
> > - audit_list_include_power_abuse 
> > - audit_list_exclude_network_accept 
> > - audit_list_exclude_network_socket 
> > - audit_list_include_power_abuse 
> > - audit_list_exe_exclude_all 
> > - audit_list_dir_exclude_all 
> > 
> > (path_checker) 
> > # 1. Path exists ? 
> > - name: check if excluded paths exist (list={{ path_list }}) 
> >   stat: 
> > path: "{{ item }}" 
> >   register: "{{ path_list }}_result_exist" 
> >   #register: audit_list_include_power_abuse_result_exist 
> > #  debug: 
> > #msg: "HIHI : {{ item }}" 
> >   loop: "{{ vars[path_list] }}" 
> > 
> > [...] 
> > 
> > (error) 
> >  [WARNING]: "register" is not templatable, but we found: {{ path_list 
> }}_result_exist, it will not be templated and will 
> > be used "as is". 
> > --- 
> > 
> > 
> > How should I do now to avoid all my duplicated blocks ?  
> > 
> > 
> > Thanks,  
> > Laurent 
> > 
> > -- 
> > 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   

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread Dick Visser
With all due respect, this is a support mailing list, not a chat room.
I will suggest to spend some time doing research first, before firing
off a ton of questions that could have been answered by Googling for
10 seconds.







On Wed, 22 Apr 2020 at 19:20, Tony Wong  wrote:
>
> I am finding switching from powercli to ansible for vmware tough. any 
> benefits to using ansible vs powercli?
>
> On Wed, Apr 22, 2020 at 10:16 AM David Foley  wrote:
>>
>> You need to do loop on the var
>>
>> --
>> 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/4f261b1b-17ae-475d-ba8d-dbe7b8aead5a%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/CALmkhkriVo2%2BSp0DZpH8aGV7Bkxs_b-rRjmius4J1LF7y5xvxg%40mail.gmail.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/CAL8fbwMSZc8%2Bvr-N8wPAXnE7iUWWLT8v%2BYm-h%3DtPmf2ZO80NXw%40mail.gmail.com.


[ansible-project] Check for existing ACI contract between 2 IPs using Ansbile

2020-04-22 Thread Dave Zarei
Hi,

I'm trying to figure out a way to check for any existing contract between 2 
IPs in ACI using Ansible before creating a contract, any aci_rest get 
method?

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ab077e94-8e89-4197-9e56-4ade05ed8d75%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread Tony Wong
I am finding switching from powercli to ansible for vmware tough. any
benefits to using ansible vs powercli?

On Wed, Apr 22, 2020 at 10:16 AM David Foley  wrote:

> You need to do loop on the var
>
> --
> 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/4f261b1b-17ae-475d-ba8d-dbe7b8aead5a%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/CALmkhkriVo2%2BSp0DZpH8aGV7Bkxs_b-rRjmius4J1LF7y5xvxg%40mail.gmail.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread David Foley
You need to do loop on the var

-- 
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/4f261b1b-17ae-475d-ba8d-dbe7b8aead5a%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread Tony Wong
hi to run this for multiple machines, do i need to put it in a vars file?

On Wed, Apr 22, 2020 at 9:58 AM Tony Wong  wrote:

> ok got it
>
>
>
>
> On Wed, Apr 22, 2020 at 9:39 AM David Foley  wrote:
>
>> You need to debug out the message
>>
>> --
>> 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/10241fc0-733f-4839-a1a3-fce4818545e7%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/CALmkhkpcrFAVpDuNH0kzjCG7BSJ-e410KcB-6Nh%3DR%2BvWyP7f-g%40mail.gmail.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread Tony Wong
ok got it




On Wed, Apr 22, 2020 at 9:39 AM David Foley  wrote:

> You need to debug out the message
>
> --
> 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/10241fc0-733f-4839-a1a3-fce4818545e7%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/CALmkhkoEppD2wQDy%3DrwrsS3MB2e5dVa2JnM9VzvgE8xqYy9O9Q%40mail.gmail.com.


Re: [ansible-project] Need help for some logic

2020-04-22 Thread Rahul Kumar
Ansible gurus, any suggestions?

On Wed, 22 Apr 2020 at 13:44, Rahul Kumar  wrote:

> In short , I want this configuration file as an interface between
> mymasterplaybook.yml and individual roles , also mymasterplaybook.yml need
> to recognize this file to fill its dynamic params .
>
> Rahul
>
> On Wed, 22 Apr 2020 at 13:28, Rahul Kumar  wrote:
>
>> Thanks stefan !
>> My question how i can take these 3 dynamic values as a configuration file
>> which comes with each role.
>> Example: I want to invoke mymasterplaybook.yml for 10 roles , so  i
>> invoke this playbook
>> as >ansible-playbook -i inventory.yml  mymasterplaybook.yml -> This
>> invocation could be completed if mymasterplaybook.yml takes those 3 params
>> which are dynamic from some configuration file a below
>> ---
>> dynamic rolename: something
>> dynamic taskfromgroupname: something
>> dynamic group name: something
>>
>> So if this is the configuration file , it will only include role only
>> named with "something" and import task from that role named with
>> "something" and similarly for group name.
>> Though i might have 100 roles but which will be included depends on this
>> configuration file .
>> so my question is : where and how this configuration file should be
>> written , so that my masterplaybook.yml understand this and takes all
>> dynamic params from this config file in order to execute the flow.
>>
>> Rahul
>>
>>
>>
>> On Wed, 22 Apr 2020 at 13:12, Stefan Hornburg (Racke) 
>> wrote:
>>
>>> On 4/22/20 9:35 AM, Rahul Kumar wrote:
>>> > Hi Ansible Gurus,
>>> > I have below playbook in one git repository:  mymasterplaybook.yml
>>> > - name: Do some test
>>> >   include_role:
>>> > name: mytestrole
>>> > tasks_from: test-server-names
>>> >   when: "'testing-group-name' in group_names"`
>>> >
>>> > Now I  invoke above playbook with a existing role named "mytestrole"
>>> and task in it as "test-server-names" and group
>>> > name is testing-group-name.It works fine.
>>> >
>>> > Now what i want tasks_from , name of role and group name as dynamic :
>>> so my mymasterplaybook.yml will look like as below
>>> >   - name: Do some test
>>> >   include_role:
>>> > name: {{dynamic role name}
>>> > tasks_from: {{dynamic task name from role}}
>>> >   when: "{{dynamic group name}' in group_names"`
>>> >
>>> > so that any role can be plugged into that !
>>> > So whenever some one writes roles , they write 2 things
>>> > 1. Role
>>> > 2. some configuration file which contains  "dynamic role name",
>>> "dynamic task name from role", "dynamic group name" as
>>> > configurable items so that it can be plugged in master playbook named
>>> mymasterplaybook.yml as shown above.
>>> > and this configuration file will work as an interface between role and
>>> master playbook (named mymasterplaybook.yml) for
>>> > entire execution.
>>> >
>>> > Rahul
>>>
>>> Yes, and what's your question(s) ?
>>>
>>> The when condition wouldn't work that way as the value is virtually
>>> wrapped into a Jinja template, so try:
>>>
>>> when: dynamic_group_name in group_names
>>>
>>> Regards
>>> Racke
>>>
>>> >
>>> > --
>>> > 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/CAGH8rExBLxOpYKQPQMUsbXgiBt%2Bw4pgd6atCoP9TW3z%3DEUJJXg%40mail.gmail.com
>>> > <
>>> https://groups.google.com/d/msgid/ansible-project/CAGH8rExBLxOpYKQPQMUsbXgiBt%2Bw4pgd6atCoP9TW3z%3DEUJJXg%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/958b3e2e-da34-a278-3089-fc9ad0aab637%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/CAGH8rEwLXd0E%3DpD2ig1F5TPFcS81RUSG89sS-PamExi6V5puHg%40mail.gmail.com.


Re: [ansible-project] Yum update on multiple hosts but using a cusom repo file

2020-04-22 Thread Jack Morgan
Hello,

Based on the situation you define below, it sounds like you are wanting
to add a custom yum repository to some hosts. Let's look at how you
could go about doing it.

(1) You will need to create a yum repository file on your hosts. This
file will point to your custom repository on your Yum server. You can
achieve that via ansible module(s) or just copy the yum repository file
that you created to each host. You will need to do some research on how
to do it. As others have pointed out, the yum module is a good place to
start. I'm only offering two ways to achieve this step but there might
be others strategies.

(2) You will need to have ansible update your systems. I'm including
part of my upgrade playbook below to use as a reference (I'm on fedora
so using dnf instead of yum). You can have your hosts defined in your
ansible hosts file (/etc/ansible/hosts). I'm not sure your strategy for
organizing your hosts as there is a lot to say here but again some
investigation is needed.

Finally, you could combine step 1 and 2 into a single playbook to have
them be two playbooks depending on your needs. I hope this is helpful.

---

- hosts: fedora
  tasks:
  - name: UPDATE | upgrade packages
    dnf:
  name: "*"
  state: latest

  - name: UPDATE | check if reboot is needed due to new kernel
    shell: if [ $(rpm -q kernel|tail -n 1) != kernel-$(uname -r) ]; then
echo 'reboot'; else echo 'no'; fi
    register: reboot_hint

  - name: UPDATE | rebooting host...
    shell: shutdown -r now "Reboot required for updated kernel"
    async: 1
    poll: 0
    when: reboot_hint.stdout.find("reboot") != -1

  - name: UPDATE | wait for host to reboot...
    wait_for_connection:
  connect_timeout: 20
  sleep: 5
  delay: 5
  timeout: 300
    when: reboot_hint.stdout.find("reboot") != -1

  - name: UPDATE | remove unused packages
    dnf:
  autoremove: yes




On 4/21/20 9:44 PM, Quad Zero wrote:
> G'day all Ansible gurus,
>
> I am very new to Ansible and I am learning through youtube videos as I
> am enquiring about this problem. It might be a simple one to some of
> you guys:
>
> So I have multiple servers on my System. I have a VM by the name of
> YUM which has all the updates (updates folder) on its /var/www/html
> folder so it can be referenced from other systems if it was done
> manually (which is what i have been doing until now).
>
> How do I specify this folder in Ansible to all other hosts?
>
> For eg:
>
> if my YUM server has all its updates in 
> http://192.168.0.5/rhel6pathes/april/
>
> how do i get the other servers to look at this location and update it
> from here?
>
> Thank you so much.

-- 
Jack Morgan


-- 
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/1ae55ac5-4443-bdb7-c72f-2831ba2a7434%40jento.io.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread David Foley
You need to debug out the message

-- 
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/10241fc0-733f-4839-a1a3-fce4818545e7%40googlegroups.com.


Re: [ansible-project] Re: [WARNING]: "register" is not templatable, but we found:

2020-04-22 Thread Matt Martz
`register` has never been templatable.  Previously it would create a
literal variable called `{{ var }}` which included the brackets.

When looping and using register, see
https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#registering-variables-with-a-loop

On Wed, Apr 22, 2020 at 11:21 AM Laurent HENSSEN 
wrote:

> Let me add a quick update :
> - I'm trying to process several paths
> - paths are grouped and so, there are several "list" of paths (because
> need to generate from template and it's different regarding the list)
> - objective was to use an compact / easier code (instead of copy existing
> task for a new list, just use kind of "function" ... = include and loop)
>
>
>
>
> Le mercredi 22 avril 2020 18:07:32 UTC+2, Laurent HENSSEN a écrit :
>>
>> Hello,
>>
>>
>> I'm trying to register a var through a dynamical use of "register" (I
>> mean : using a var, like : register: {{ var }}).
>>
>> Dev updated the code and removed this option (now static only).
>> I'm not able to find more information about that change and also there is
>> nobody connected on the IRC so, I post here.
>>
>>
>> Bug report (closed without real details) :
>> https://github.com/ansible/ansible/issues/57839
>>
>> Code change :
>>
>> https://gitlab.ics.muni.cz/242618/ansible/commit/be776daefed047f0bd45d7441efde046677fd417
>>
>>
>> The very detailed comment about that (from the bug report) :
>> ---
>> sivel  commented on Jun 14, 2019
>> 
>>
>> This is expected and we will never allow this behavior. Register must use
>> a statically defined string.
>>
>> If you have further questions please stop by IRC or the mailing list:
>>
>>- IRC: #ansible on irc.freenode.net
>>- mailing list:
>>https://groups.google.com/forum/#!forum/ansible-project
>>
>> [image: @sivel]  sivel
>>  closed this on Jun 14, 2019
>> 
>> ---
>>
>>
>> That's it, no more information, I don't understand why and now I'm stuck
>> in my Ansible configuration.
>> I was trying to create a loop of 4 tasks (function like), I'm able to
>> pass any vars to those tasks (using separated include: and loop:).
>> But all this is useless if I can't register results in "dynamically
>> selected" variable name.
>> Final results are input for a template (just after that include task).
>>
>> So, I have now a "working" function, able to consume any var already
>> defined ... but can only register to a unique var (very very useful when
>> you are in a loop with MULTIPLE elements and not only 1).
>> Can someone explain me why this change of behavior and how am I supposed
>> to make it works now without the option to "register: {{ my_var }} ?
>>
>> Let me copy past my configuration so that it will be easier to understand.
>> What I see with that change to static register : can't loop on tasks
>> anymore (or only for basic use).
>> Pelase let me know how I'm supposed to do that in "a compact way" now (I
>> was trying to move from 5x blocks of 4 tasks to 1 include (with loop) of 4
>> tasks).
>>
>>
>> ---
>> (main)
>> # Check if paths exist + extract real path (no symlink)
>> ##
>> # Using a Function like in Ansible (= big loop on included tasks)
>> - include: path_checker.yml
>>   loop_control:
>> # As we are creating a big loop, and as we also have one nested loop,
>> need to use another var name else they conflict (if "item" on both nested
>> loops)
>> loop_var: path_list
>>   # Here, need to add all lists available so that all paths will be
>> checked as expected (before generating the template)
>>   loop:
>> - audit_list_include_power_abuse
>> - audit_list_exclude_network_accept
>> - audit_list_exclude_network_socket
>> - audit_list_include_power_abuse
>> - audit_list_exe_exclude_all
>> - audit_list_dir_exclude_all
>>
>> (path_checker)
>> # 1. Path exists ?
>> - name: check if excluded paths exist (list={{ path_list }})
>>   stat:
>> path: "{{ item }}"
>>   register: "{{ path_list }}_result_exist"
>>   #register: audit_list_include_power_abuse_result_exist
>> #  debug:
>> #msg: "HIHI : {{ item }}"
>>   loop: "{{ vars[path_list] }}"
>>
>> [...]
>>
>> (error)
>>  [WARNING]: "register" is not templatable, but we found: {{ path_list
>> }}_result_exist, it will not be templated and will be used "as is".
>> ---
>>
>>
>> How should I do now to avoid all my duplicated blocks ?
>>
>>
>> Thanks,
>> Laurent
>>
> --
> 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: [WARNING]: "register" is not templatable, but we found:

2020-04-22 Thread Laurent HENSSEN
Let me add a quick update : 
- I'm trying to process several paths 
- paths are grouped and so, there are several "list" of paths (because need 
to generate from template and it's different regarding the list)
- objective was to use an compact / easier code (instead of copy existing 
task for a new list, just use kind of "function" ... = include and loop)




Le mercredi 22 avril 2020 18:07:32 UTC+2, Laurent HENSSEN a écrit :
>
> Hello, 
>
>
> I'm trying to register a var through a dynamical use of "register" (I mean 
> : using a var, like : register: {{ var }}).
>
> Dev updated the code and removed this option (now static only).
> I'm not able to find more information about that change and also there is 
> nobody connected on the IRC so, I post here.
>
>
> Bug report (closed without real details) : 
> https://github.com/ansible/ansible/issues/57839
>
> Code change : 
>
> https://gitlab.ics.muni.cz/242618/ansible/commit/be776daefed047f0bd45d7441efde046677fd417
>
>
> The very detailed comment about that (from the bug report) : 
> ---
> sivel  commented on Jun 14, 2019 
> 
>
> This is expected and we will never allow this behavior. Register must use 
> a statically defined string.
>
> If you have further questions please stop by IRC or the mailing list:
>
>- IRC: #ansible on irc.freenode.net
>- mailing list: https://groups.google.com/forum/#!forum/ansible-project
>
> [image: @sivel]  sivel 
>  closed this on Jun 14, 2019 
> 
> ---
>
>
> That's it, no more information, I don't understand why and now I'm stuck 
> in my Ansible configuration.
> I was trying to create a loop of 4 tasks (function like), I'm able to pass 
> any vars to those tasks (using separated include: and loop:).
> But all this is useless if I can't register results in "dynamically 
> selected" variable name.
> Final results are input for a template (just after that include task).
>
> So, I have now a "working" function, able to consume any var already 
> defined ... but can only register to a unique var (very very useful when 
> you are in a loop with MULTIPLE elements and not only 1).
> Can someone explain me why this change of behavior and how am I supposed 
> to make it works now without the option to "register: {{ my_var }} ?
>
> Let me copy past my configuration so that it will be easier to understand.
> What I see with that change to static register : can't loop on tasks 
> anymore (or only for basic use).
> Pelase let me know how I'm supposed to do that in "a compact way" now (I 
> was trying to move from 5x blocks of 4 tasks to 1 include (with loop) of 4 
> tasks).
>
>
> ---
> (main)
> # Check if paths exist + extract real path (no symlink) 
> ##
> # Using a Function like in Ansible (= big loop on included tasks)
> - include: path_checker.yml
>   loop_control:
> # As we are creating a big loop, and as we also have one nested loop, 
> need to use another var name else they conflict (if "item" on both nested 
> loops)
> loop_var: path_list
>   # Here, need to add all lists available so that all paths will be 
> checked as expected (before generating the template)
>   loop:
> - audit_list_include_power_abuse
> - audit_list_exclude_network_accept
> - audit_list_exclude_network_socket
> - audit_list_include_power_abuse
> - audit_list_exe_exclude_all
> - audit_list_dir_exclude_all
>
> (path_checker)
> # 1. Path exists ?
> - name: check if excluded paths exist (list={{ path_list }})
>   stat:
> path: "{{ item }}"
>   register: "{{ path_list }}_result_exist"
>   #register: audit_list_include_power_abuse_result_exist
> #  debug:
> #msg: "HIHI : {{ item }}"
>   loop: "{{ vars[path_list] }}"
>
> [...]
>
> (error)
>  [WARNING]: "register" is not templatable, but we found: {{ path_list 
> }}_result_exist, it will not be templated and will be used "as is".
> ---
>
>
> How should I do now to avoid all my duplicated blocks ? 
>
>
> Thanks, 
> Laurent
>

-- 
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/2be7f256-8b1d-4079-9b91-0c128a54b0c3%40googlegroups.com.


Re: [ansible-project] [WARNING]: "register" is not templatable, but we found:

2020-04-22 Thread Stefan Hornburg (Racke)
On 4/22/20 6:07 PM, Laurent HENSSEN wrote:
> Hello, 
> 
> 
> I'm trying to register a var through a dynamical use of "register" (I mean : 
> using a var, like : register: {{ var }}).
> 
> Dev updated the code and removed this option (now static only).
> I'm not able to find more information about that change and also there is 
> nobody connected on the IRC so, I post here.

It was likely never documented. You can append a "set_fact" task  to alleviate 
that.

Regards
Racke

>  
> 
> Bug report (closed without real details) : 
> https://github.com/ansible/ansible/issues/57839
> 
> Code change : 
> https://gitlab.ics.muni.cz/242618/ansible/commit/be776daefed047f0bd45d7441efde046677fd417
> 
> 
> The very detailed comment about that (from the bug report) : 
> ---
> 
> 
>   sivel  commented on Jun 14, 2019
>   
> 
> This is expected and we will never allow this behavior. Register must use a 
> statically defined string.
> 
> If you have further questions please stop by IRC or the mailing list:
> 
>   * IRC: #ansible on irc.freenode.net
>   * mailing list: https://groups.google.com/forum/#!forum/ansible-project
> 
> @sivel  sivel  closed 
> this on Jun 14, 2019
> 
> ---
> 
> 
> That's it, no more information, I don't understand why and now I'm stuck in 
> my Ansible configuration.
> I was trying to create a loop of 4 tasks (function like), I'm able to pass 
> any vars to those tasks (using separated
> include: and loop:).
> But all this is useless if I can't register results in "dynamically selected" 
> variable name.
> Final results are input for a template (just after that include task).
> 
> So, I have now a "working" function, able to consume any var already defined 
> ... but can only register to a unique var
> (very very useful when you are in a loop with MULTIPLE elements and not only 
> 1).
> Can someone explain me why this change of behavior and how am I supposed to 
> make it works now without the option to
> "register: {{ my_var }} ?
> 
> Let me copy past my configuration so that it will be easier to understand.
> What I see with that change to static register : can't loop on tasks anymore 
> (or only for basic use).
> Pelase let me know how I'm supposed to do that in "a compact way" now (I was 
> trying to move from 5x blocks of 4 tasks to
> 1 include (with loop) of 4 tasks).
> 
> 
> ---
> (main)
> # Check if paths exist + extract real path (no symlink)
> ##
> # Using a Function like in Ansible (= big loop on included tasks)
> - include: path_checker.yml
>   loop_control:
>     # As we are creating a big loop, and as we also have one nested loop, 
> need to use another var name else they
> conflict (if "item" on both nested loops)
>     loop_var: path_list
>   # Here, need to add all lists available so that all paths will be checked 
> as expected (before generating the template)
>   loop:
>     - audit_list_include_power_abuse
>     - audit_list_exclude_network_accept
>     - audit_list_exclude_network_socket
>     - audit_list_include_power_abuse
>     - audit_list_exe_exclude_all
>     - audit_list_dir_exclude_all
> 
> (path_checker)
> # 1. Path exists ?
> - name: check if excluded paths exist (list={{ path_list }})
>   stat:
>     path: "{{ item }}"
>   register: "{{ path_list }}_result_exist"
>   #register: audit_list_include_power_abuse_result_exist
> #  debug:
> #    msg: "HIHI : {{ item }}"
>   loop: "{{ vars[path_list] }}"
> 
> [...]
> 
> (error)
>  [WARNING]: "register" is not templatable, but we found: {{ path_list 
> }}_result_exist, it will not be templated and will
> be used "as is".
> ---
> 
> 
> How should I do now to avoid all my duplicated blocks ? 
> 
> 
> Thanks, 
> Laurent
> 
> -- 
> 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/823751d4-4d65-4910-ba72-57267a36f1d6%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 

[ansible-project] [WARNING]: "register" is not templatable, but we found:

2020-04-22 Thread Laurent HENSSEN
Hello, 


I'm trying to register a var through a dynamical use of "register" (I mean 
: using a var, like : register: {{ var }}).

Dev updated the code and removed this option (now static only).
I'm not able to find more information about that change and also there is 
nobody connected on the IRC so, I post here.


Bug report (closed without real details) : 
https://github.com/ansible/ansible/issues/57839

Code change : 
https://gitlab.ics.muni.cz/242618/ansible/commit/be776daefed047f0bd45d7441efde046677fd417


The very detailed comment about that (from the bug report) : 
---
sivel  commented on Jun 14, 2019 


This is expected and we will never allow this behavior. Register must use a 
statically defined string.

If you have further questions please stop by IRC or the mailing list:

   - IRC: #ansible on irc.freenode.net
   - mailing list: https://groups.google.com/forum/#!forum/ansible-project

[image: @sivel]  sivel  
closed 
this on Jun 14, 2019 

---


That's it, no more information, I don't understand why and now I'm stuck in 
my Ansible configuration.
I was trying to create a loop of 4 tasks (function like), I'm able to pass 
any vars to those tasks (using separated include: and loop:).
But all this is useless if I can't register results in "dynamically 
selected" variable name.
Final results are input for a template (just after that include task).

So, I have now a "working" function, able to consume any var already 
defined ... but can only register to a unique var (very very useful when 
you are in a loop with MULTIPLE elements and not only 1).
Can someone explain me why this change of behavior and how am I supposed to 
make it works now without the option to "register: {{ my_var }} ?

Let me copy past my configuration so that it will be easier to understand.
What I see with that change to static register : can't loop on tasks 
anymore (or only for basic use).
Pelase let me know how I'm supposed to do that in "a compact way" now (I 
was trying to move from 5x blocks of 4 tasks to 1 include (with loop) of 4 
tasks).


---
(main)
# Check if paths exist + extract real path (no symlink) 
##
# Using a Function like in Ansible (= big loop on included tasks)
- include: path_checker.yml
  loop_control:
# As we are creating a big loop, and as we also have one nested loop, 
need to use another var name else they conflict (if "item" on both nested 
loops)
loop_var: path_list
  # Here, need to add all lists available so that all paths will be checked 
as expected (before generating the template)
  loop:
- audit_list_include_power_abuse
- audit_list_exclude_network_accept
- audit_list_exclude_network_socket
- audit_list_include_power_abuse
- audit_list_exe_exclude_all
- audit_list_dir_exclude_all

(path_checker)
# 1. Path exists ?
- name: check if excluded paths exist (list={{ path_list }})
  stat:
path: "{{ item }}"
  register: "{{ path_list }}_result_exist"
  #register: audit_list_include_power_abuse_result_exist
#  debug:
#msg: "HIHI : {{ item }}"
  loop: "{{ vars[path_list] }}"

[...]

(error)
 [WARNING]: "register" is not templatable, but we found: {{ path_list 
}}_result_exist, it will not be templated and will be used "as is".
---


How should I do now to avoid all my duplicated blocks ? 


Thanks, 
Laurent

-- 
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/823751d4-4d65-4910-ba72-57267a36f1d6%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread Tony Wong
my ansible version

tony@ubuntu:~/ansiblework$ ansible --version
ansible 2.9.0
  config file = /home/tony/ansiblework/ansible.cfg
  configured module search path = [u'/home/tony/ansiblework/library']
  ansible python module location =
/home/tony/.local/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]

On Wed, Apr 22, 2020 at 8:54 AM Tony Wong  wrote:

> Hi I am still getting error
>
>
>
> On Wed, Apr 22, 2020 at 8:44 AM Abhijeet Kasurde 
> wrote:
>
>> I attached a correct playbook.
>>
>> On Wed, Apr 22, 2020 at 8:55 PM Tony Wong  wrote:
>>
>>> I dont understand where am I getting the ident issue?
>>>
>>> On Wed, Apr 22, 2020 at 7:49 AM Dick Visser 
>>> wrote:
>>>
 You continue to get that error because you continue to mess up the
 indentation.
 Sort that first.


 https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html



 On Wed, 22 Apr 2020 at 16:41, Tony Wong  wrote:
 >
 > I just upgraded ansible to 2.9
 >
 > but still getting this error
 >
 >
 >
 > On Mon, Apr 20, 2020 at 1:30 AM Dick Visser 
 wrote:
 >>
 >> You are using vmware_guest_info module, which was introduced in
 >> ansible 2.9:
 https://docs.ansible.com/ansible/latest/modules/vmware_guest_info_module.html
 >>
 >> On that page it also says that the module used to be called
 >> vmware_guest_facts prior to 2.9.
 >>
 >> Given that you have difficulty upgrading, try to use the old module
 name?
 >>
 >>
 >>
 >>
 >> On Sun, 19 Apr 2020 at 23:55, Tony Wong  wrote:
 >> >
 >> > tony@ubuntu:~/ansiblework$ sudo apt-add-repository
 ppa:ansible/ansible
 >> >  Ansible is a radically simple IT automation platform that makes
 your applications and systems easier to deploy. Avoid writing scripts or
 custom code to deploy and update your applications— automate in a language
 that approaches plain English, using SSH, with no agents to install on
 remote systems.
 >> >
 >> > http://ansible.com/
 >> >  More info: https://launchpad.net/~ansible/+archive/ubuntu/ansible
 >> > Press [ENTER] to continue or Ctrl-c to cancel adding it.
 >> >
 >> > Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
 >> > Hit:2 http://ppa.launchpad.net/ansible/ansible/ubuntu cosmic
 InRelease
 >> > Ign:3 http://archive.ubuntu.com/ubuntu cosmic InRelease
 >> > Ign:4 http://archive.ubuntu.com/ubuntu cosmic-updates InRelease
 >> > Ign:5 http://archive.ubuntu.com/ubuntu cosmic-backports InRelease
 >> > Ign:6 http://archive.ubuntu.com/ubuntu cosmic-security InRelease
 >> > Err:7 http://archive.ubuntu.com/ubuntu cosmic Release
 >> >   404  Not Found [IP: 91.189.88.152 80]
 >> > Err:8 http://archive.ubuntu.com/ubuntu cosmic-updates Release
 >> >   404  Not Found [IP: 91.189.88.152 80]
 >> > Err:9 http://archive.ubuntu.com/ubuntu cosmic-backports Release
 >> >   404  Not Found [IP: 91.189.88.152 80]
 >> > Err:10 http://archive.ubuntu.com/ubuntu cosmic-security Release
 >> >   404  Not Found [IP: 91.189.88.152 80]
 >> > Reading package lists... Done
 >> > E: The repository 'http://archive.ubuntu.com/ubuntu cosmic
 Release' no longer has a Release file.
 >> > N: Updating from such a repository can't be done securely, and is
 therefore disabled by default.
 >> > N: See apt-secure(8) manpage for repository creation and user
 configuration details.
 >> > E: The repository 'http://archive.ubuntu.com/ubuntu
 cosmic-updates Release' no longer has a Release file.
 >> > N: Updating from such a repository can't be done securely, and is
 therefore disabled by default.
 >> > N: See apt-secure(8) manpage for repository creation and user
 configuration details.
 >> > E: The repository 'http://archive.ubuntu.com/ubuntu
 cosmic-backports Release' no longer has a Release file.
 >> > N: Updating from such a repository can't be done securely, and is
 therefore disabled by default.
 >> > N: See apt-secure(8) manpage for repository creation and user
 configuration details.
 >> > E: The repository 'http://archive.ubuntu.com/ubuntu
 cosmic-security Release' no longer has a Release file.
 >> > N: Updating from such a repository can't be done securely, and is
 therefore disabled by default.
 >> > N: See apt-secure(8) manpage for repository creation and user
 configuration details.
 >> > tony@ubuntu:~/ansiblework$ sudo apt-get update
 >> > Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
 >> > Ign:2 http://archive.ubuntu.com/ubuntu cosmic InRelease
 >> > Hit:3 http://ppa.launchpad.net/ansible/ansible/ubuntu cosmic
 InRelease
 >> > Ign:4 http://archive.ubuntu.com/ubuntu cosmic-updates InRelease
 >> > Ign:5 

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread David Foley
Still ident While Fixing The Last Ident Issue you seem to have moved 
everything to the Left: 

Abhijeet Kasurde Just attached the Correct Way of Doing It;

I would Recommend Reading / Watching Some Ansible Videos before taken on 
some Projects: you may end-up doing more harm then good within your 
Environment  

-- 
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/5563ddd6-a7fe-4287-bf54-be68796dcdfa%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread Dick Visser
You continue to get that error because you continue to mess up the indentation.
Sort that first.

https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html



On Wed, 22 Apr 2020 at 16:41, Tony Wong  wrote:
>
> I just upgraded ansible to 2.9
>
> but still getting this error
>
>
>
> On Mon, Apr 20, 2020 at 1:30 AM Dick Visser  wrote:
>>
>> You are using vmware_guest_info module, which was introduced in
>> ansible 2.9: 
>> https://docs.ansible.com/ansible/latest/modules/vmware_guest_info_module.html
>>
>> On that page it also says that the module used to be called
>> vmware_guest_facts prior to 2.9.
>>
>> Given that you have difficulty upgrading, try to use the old module name?
>>
>>
>>
>>
>> On Sun, 19 Apr 2020 at 23:55, Tony Wong  wrote:
>> >
>> > tony@ubuntu:~/ansiblework$ sudo apt-add-repository ppa:ansible/ansible
>> >  Ansible is a radically simple IT automation platform that makes your 
>> > applications and systems easier to deploy. Avoid writing scripts or custom 
>> > code to deploy and update your applications— automate in a language that 
>> > approaches plain English, using SSH, with no agents to install on remote 
>> > systems.
>> >
>> > http://ansible.com/
>> >  More info: https://launchpad.net/~ansible/+archive/ubuntu/ansible
>> > Press [ENTER] to continue or Ctrl-c to cancel adding it.
>> >
>> > Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
>> > Hit:2 http://ppa.launchpad.net/ansible/ansible/ubuntu cosmic InRelease
>> > Ign:3 http://archive.ubuntu.com/ubuntu cosmic InRelease
>> > Ign:4 http://archive.ubuntu.com/ubuntu cosmic-updates InRelease
>> > Ign:5 http://archive.ubuntu.com/ubuntu cosmic-backports InRelease
>> > Ign:6 http://archive.ubuntu.com/ubuntu cosmic-security InRelease
>> > Err:7 http://archive.ubuntu.com/ubuntu cosmic Release
>> >   404  Not Found [IP: 91.189.88.152 80]
>> > Err:8 http://archive.ubuntu.com/ubuntu cosmic-updates Release
>> >   404  Not Found [IP: 91.189.88.152 80]
>> > Err:9 http://archive.ubuntu.com/ubuntu cosmic-backports Release
>> >   404  Not Found [IP: 91.189.88.152 80]
>> > Err:10 http://archive.ubuntu.com/ubuntu cosmic-security Release
>> >   404  Not Found [IP: 91.189.88.152 80]
>> > Reading package lists... Done
>> > E: The repository 'http://archive.ubuntu.com/ubuntu cosmic Release' no 
>> > longer has a Release file.
>> > N: Updating from such a repository can't be done securely, and is 
>> > therefore disabled by default.
>> > N: See apt-secure(8) manpage for repository creation and user 
>> > configuration details.
>> > E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-updates 
>> > Release' no longer has a Release file.
>> > N: Updating from such a repository can't be done securely, and is 
>> > therefore disabled by default.
>> > N: See apt-secure(8) manpage for repository creation and user 
>> > configuration details.
>> > E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-backports 
>> > Release' no longer has a Release file.
>> > N: Updating from such a repository can't be done securely, and is 
>> > therefore disabled by default.
>> > N: See apt-secure(8) manpage for repository creation and user 
>> > configuration details.
>> > E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-security 
>> > Release' no longer has a Release file.
>> > N: Updating from such a repository can't be done securely, and is 
>> > therefore disabled by default.
>> > N: See apt-secure(8) manpage for repository creation and user 
>> > configuration details.
>> > tony@ubuntu:~/ansiblework$ sudo apt-get update
>> > Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
>> > Ign:2 http://archive.ubuntu.com/ubuntu cosmic InRelease
>> > Hit:3 http://ppa.launchpad.net/ansible/ansible/ubuntu cosmic InRelease
>> > Ign:4 http://archive.ubuntu.com/ubuntu cosmic-updates InRelease
>> > Ign:5 http://archive.ubuntu.com/ubuntu cosmic-backports InRelease
>> > Ign:6 http://archive.ubuntu.com/ubuntu cosmic-security InRelease
>> > Err:7 http://archive.ubuntu.com/ubuntu cosmic Release
>> >   404  Not Found [IP: 91.189.88.142 80]
>> > Err:8 http://archive.ubuntu.com/ubuntu cosmic-updates Release
>> >   404  Not Found [IP: 91.189.88.142 80]
>> > Err:9 http://archive.ubuntu.com/ubuntu cosmic-backports Release
>> >   404  Not Found [IP: 91.189.88.142 80]
>> > Err:10 http://archive.ubuntu.com/ubuntu cosmic-security Release
>> >   404  Not Found [IP: 91.189.88.142 80]
>> > Reading package lists... Done
>> > E: The repository 'http://archive.ubuntu.com/ubuntu cosmic Release' no 
>> > longer has a Release file.
>> > N: Updating from such a repository can't be done securely, and is 
>> > therefore disabled by default.
>> > N: See apt-secure(8) manpage for repository creation and user 
>> > configuration details.
>> > E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-updates 
>> > Release' no longer has a Release file.
>> > N: Updating from such a repository can't be done securely, and is 
>> > therefore disabled by 

[ansible-project] How to run 2 playbooks in parallel using a master playbook and monitor for any error

2020-04-22 Thread Happy Souls
Hi,

I would appreciate if someone could share a simple example of running 2 
playbooks running in parallel, called in a master playbook .

smallest of examples of basic tasks would be great.

Regards,
Abhishek

-- 
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/6c1f6090-38b3-4d0d-b692-ba548a37d0b0%40googlegroups.com.


Re: [ansible-project] Will `with_*` loops be removed once 2.10 is out?

2020-04-22 Thread 'Felix Fontein' via Ansible Project
Hi,

also (forgot to mention that in my previous mail), in 2.10 the short
name will automatically redirect to the long name for plugins (and
modules) that were already in 2.9. I.e. with_flattened will continue to
work. (Except if you don't install the community.general collection,
then of course it won't, since it's a redirection.)

The redirect behavior is currently not available in devel (if you have
tried that), but will be hopefully soon...

Cheers,
Felix



On Wed, 22 Apr 2020 06:58:13 -0700 (PDT)
Nick Kakouros  wrote:

> Thanks for the tip!
> 
> On Wednesday, April 22, 2020 at 1:50:55 PM UTC, Felix Fontein wrote:
> >
> > Hi Nick, 
> >  
> > > Is the a way to combine `with_` and a lookup from a collection?
> > > E.g. the flattened lookup from community.general.   
> >
> > you can use "with_namespace.collection.plugin:". 
> >
> > Looks ugly, but works :) 
> >
> > Cheers, 
> > Felix 

-- 
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/20200422160418.44019b58%40utsjoki.


Re: [ansible-project] Will `with_*` loops be removed once 2.10 is out?

2020-04-22 Thread Nick Kakouros
Thanks for the tip!

On Wednesday, April 22, 2020 at 1:50:55 PM UTC, Felix Fontein wrote:
>
> Hi Nick, 
>
> > Is the a way to combine `with_` and a lookup from a collection? E.g. 
> > the flattened lookup from community.general. 
>
> you can use "with_namespace.collection.plugin:". 
>
> Looks ugly, but works :) 
>
> Cheers, 
> Felix 
>
>
>

-- 
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/d1460697-9a3c-4bd8-9883-f04aab6726c1%40googlegroups.com.


Re: [ansible-project] Will `with_*` loops be removed once 2.10 is out?

2020-04-22 Thread 'Felix Fontein' via Ansible Project
Hi Nick,

> Is the a way to combine `with_` and a lookup from a collection? E.g.
> the flattened lookup from community.general. 

you can use "with_namespace.collection.plugin:".

Looks ugly, but works :)

Cheers,
Felix


-- 
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/20200422154824.009f6ad7%40utsjoki.


Re: [ansible-project] Help with ios_command Module

2020-04-22 Thread Srinivas Naram
You can use ignore_errors=True

On Wed, Apr 22, 2020 at 6:48 PM Omar Hegazy 
wrote:

> Hello, i have 2 switches. I wanted to run a command (show arp) and check a
> specific output if exist or not on both. Then, i wanted to run a command
> (show arp) and display the output.
>
> The problem is that since the output i'm inspecting on first task doesn't
> exist on switch1  the next task (Display Output) is not performed for
> switch 1. i don't know why this dependency. I thought that there
> shouldn't be dependencies between tasks this way. How to overcome?
> --
>
>-
>
>hosts: SWITCHES
>
>tasks:
>-
>
>   name: run show and check to see if output contains value
>   ios_command:
>   commands: "show arp"
>   wait_for: result[0] contains aabb.cc00.3000
>   -
>
>   name: Get Shows
>   ios_command:
>   commands: "show arp"
>   register: Output
>   -
>
>   name: Display Output
>   debug:
>   msg: "{{ Output.stdout_lines[0] }}"
>
> Output:
>
> PLAY [SWITCHES]
> **
>
> TASK [run show version and check to see if output contains IOS]
> **
> ok: [switch2]
> fatal: [switch1]: FAILED! => {"changed": false, "failed_conditions":
> ["result[0] contains aabb.cc00.3000"], "msg": "One or more conditional
> statements have not been satisfied"}
>
> TASK [Get Shows]
> *
> ok: [switch2]
>
> TASK [Display Output]
> 
> ok: [switch2] => {
> "msg": [
> "Protocol Address Age (min) Hardware Addr Type Interface",
> "Internet 192.168.0.1 0 342c.c4ad.9a81 ARPA Ethernet0/0",
> "Internet 192.168.0.157 - aabb.cc00.3000 ARPA Ethernet0/0",
> "Internet 192.168.0.248 0 d4d2.5287.83ef ARPA Ethernet0/0"
> ]
> }
>
> PLAY RECAP
> ***
> switch1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0
> ignored=0
> switch2 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0
> ignored=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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/2a134fb2-ebd2-46a7-b3a8-f141d95b4fef%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-N3P5Twu%2Bb2%3DaaAN_cd042KQhVDPdhR5hRSX5cT_DFfhD3QA%40mail.gmail.com.


[ansible-project] Will `with_*` loops be removed once 2.10 is out?

2020-04-22 Thread Nick Kakouros
Is the a way to combine `with_` and a lookup from a collection? E.g. the 
flattened lookup from community.general. 

-- 
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/8f4fa245-3035-492d-83c8-538ad5a6fc0d%40googlegroups.com.


[ansible-project] Help with ios_command Module

2020-04-22 Thread Omar Hegazy


Hello, i have 2 switches. I wanted to run a command (show arp) and check a 
specific output if exist or not on both. Then, i wanted to run a command 
(show arp) and display the output.

The problem is that since the output i'm inspecting on first task doesn't 
exist on switch1  the next task (Display Output) is not performed for 
switch 1. i don't know why this dependency. I thought that there 
shouldn't be dependencies between tasks this way. How to overcome?
--

   - 
   
   hosts: SWITCHES
   
   tasks:
   - 
  
  name: run show and check to see if output contains value
  ios_command:
  commands: "show arp"
  wait_for: result[0] contains aabb.cc00.3000
  - 
  
  name: Get Shows
  ios_command:
  commands: "show arp"
  register: Output
  - 
  
  name: Display Output
  debug:
  msg: "{{ Output.stdout_lines[0] }}"
  
Output: 

PLAY [SWITCHES] 
**

TASK [run show version and check to see if output contains IOS] 
**
ok: [switch2]
fatal: [switch1]: FAILED! => {"changed": false, "failed_conditions": 
["result[0] contains aabb.cc00.3000"], "msg": "One or more conditional 
statements have not been satisfied"}

TASK [Get Shows] 
*
ok: [switch2]

TASK [Display Output] 

ok: [switch2] => {
"msg": [
"Protocol Address Age (min) Hardware Addr Type Interface",
"Internet 192.168.0.1 0 342c.c4ad.9a81 ARPA Ethernet0/0",
"Internet 192.168.0.157 - aabb.cc00.3000 ARPA Ethernet0/0",
"Internet 192.168.0.248 0 d4d2.5287.83ef ARPA Ethernet0/0"
]
}

PLAY RECAP 
***
switch1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 
ignored=0
switch2 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 
ignored=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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2a134fb2-ebd2-46a7-b3a8-f141d95b4fef%40googlegroups.com.


Re: [ansible-project] Yum update on multiple hosts but using a cusom repo file

2020-04-22 Thread Stefan Hornburg (Racke)
On 4/22/20 10:26 AM, Quad Zero wrote:
> Hi Vivek,
> 
> On each machine, I would run yum update on it. My repo file points to the 
> server
> http://192.168.0.5/rhel6pathes/april/

Give the yum_repository module a try:

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

Regards
 Racke

> 
> Thank you.
> 
> On Wed, Apr 22, 2020 at 3:06 PM Vivek Kothawale  > wrote:
> 
> Hi  
> Could you please let me know how you doing it in manually ?
> 
> Thanks
> Vivek
> 
> On Wed, Apr 22, 2020, 10:34 AM Dick Visser  > wrote:
> 
> If you are really new then you are better off reading about the 
> basics first, for instance 
> 
> 
> https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html
> 
> This should give enough inspiration to get going with your task at 
> hand. 
> 
> 
> 
> On Wed, 22 Apr 2020 at 06:53, Quad Zero  > wrote:
> 
> Vivek,
> 
> Could you actually show that to me in code? I am very new to 
> this. 
> 
> Thank you sir.
> 
> On Wednesday, April 22, 2020 at 2:50:52 PM UTC+10, Vivek 
> Kothawale wrote:
> 
> Hi
> 
> You could use variable and reference that variable inside 
> playbook.
> I this way you don't have to repeat on call same path mutiple 
> time instead you can call that variable.
> 
> Thanks,
> Vivek
> 
> On Wed, Apr 22, 2020, 10:14 AM Quad Zero  
> wrote:
> 
> G'day all Ansible gurus,
> 
> I am very new to Ansible and I am learning through 
> youtube videos as I am enquiring about this
> problem. It might be a simple one to some of you guys:
> 
> So I have multiple servers on my System. I have a VM by 
> the name of YUM which has all the updates
> (updates folder) on its /var/www/html folder so it can be 
> referenced from other systems if it was
> done manually (which is what i have been doing until now).
> 
> How do I specify this folder in Ansible to all other 
> hosts?
> 
> For eg:
> 
> if my YUM server has all its updates in 
> http://192.168.0.5/rhel6pathes/april/
> 
> how do i get the other servers to look at this location 
> and update it from here?
> 
> Thank you so much.
> 
> 
> 
> -- 
> 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/ad7b76e9-6307-46f4-936a-b5cbfc7302e0%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/f0395e8d-460c-4d75-9340-8d7ce6fa1562%40googlegroups.com
> 
> .
> 
> -- 
> Sent from a mobile device - please excuse the brevity, spelling and 
> punctuation.
> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, 
> send an email to
> ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwNnBttcaDzpfVE%3DQt46s9oAUHuE6Sk6T%2BECz4Y9rgAoEg%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
> 

Re: [ansible-project] Yum update on multiple hosts but using a cusom repo file

2020-04-22 Thread Quad Zero
Hi Vivek,

On each machine, I would run yum update on it. My repo file points to the
server
http://192.168.0.5/rhel6pathes/april/

Thank you.

On Wed, Apr 22, 2020 at 3:06 PM Vivek Kothawale 
wrote:

> Hi
> Could you please let me know how you doing it in manually ?
>
> Thanks
> Vivek
>
> On Wed, Apr 22, 2020, 10:34 AM Dick Visser  wrote:
>
>> If you are really new then you are better off reading about the basics
>> first, for instance
>>
>>
>> https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html
>>
>> This should give enough inspiration to get going with your task at hand.
>>
>>
>>
>> On Wed, 22 Apr 2020 at 06:53, Quad Zero  wrote:
>>
>>> Vivek,
>>>
>>> Could you actually show that to me in code? I am very new to this.
>>>
>>> Thank you sir.
>>>
>>> On Wednesday, April 22, 2020 at 2:50:52 PM UTC+10, Vivek Kothawale wrote:

 Hi

 You could use variable and reference that variable inside playbook.
 I this way you don't have to repeat on call same path mutiple time
 instead you can call that variable.

 Thanks,
 Vivek

 On Wed, Apr 22, 2020, 10:14 AM Quad Zero  wrote:

> G'day all Ansible gurus,
>
> I am very new to Ansible and I am learning through youtube videos as I
> am enquiring about this problem. It might be a simple one to some of you
> guys:
>
> So I have multiple servers on my System. I have a VM by the name of
> YUM which has all the updates (updates folder) on its /var/www/html folder
> so it can be referenced from other systems if it was done manually (which
> is what i have been doing until now).
>
> How do I specify this folder in Ansible to all other hosts?
>
> For eg:
>
> if my YUM server has all its updates in
> http://192.168.0.5/rhel6pathes/april/
>
> how do i get the other servers to look at this location and update it
> from here?
>
> Thank you so much.
>
>
>
> --
> 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/ad7b76e9-6307-46f4-936a-b5cbfc7302e0%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/f0395e8d-460c-4d75-9340-8d7ce6fa1562%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> Sent from a mobile device - please excuse the brevity, spelling and
>> punctuation.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ansible-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwNnBttcaDzpfVE%3DQt46s9oAUHuE6Sk6T%2BECz4Y9rgAoEg%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/CAA420E9KgDDWSo5vYgmpqhT6AvA3hLKxjRAiStWHF6ZFKJhZfg%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/CAKr7FntkWu3ntYXAu0V61%3DxMo-OyhXrz%3Df%2BqjzCDGkS5uYow8g%40mail.gmail.com.


Re: [ansible-project] Need help for some logic

2020-04-22 Thread Rahul Kumar
In short , I want this configuration file as an interface between
mymasterplaybook.yml and individual roles , also mymasterplaybook.yml need
to recognize this file to fill its dynamic params .

Rahul

On Wed, 22 Apr 2020 at 13:28, Rahul Kumar  wrote:

> Thanks stefan !
> My question how i can take these 3 dynamic values as a configuration file
> which comes with each role.
> Example: I want to invoke mymasterplaybook.yml for 10 roles , so  i invoke
> this playbook
> as >ansible-playbook -i inventory.yml  mymasterplaybook.yml -> This
> invocation could be completed if mymasterplaybook.yml takes those 3 params
> which are dynamic from some configuration file a below
> ---
> dynamic rolename: something
> dynamic taskfromgroupname: something
> dynamic group name: something
>
> So if this is the configuration file , it will only include role only
> named with "something" and import task from that role named with
> "something" and similarly for group name.
> Though i might have 100 roles but which will be included depends on this
> configuration file .
> so my question is : where and how this configuration file should be
> written , so that my masterplaybook.yml understand this and takes all
> dynamic params from this config file in order to execute the flow.
>
> Rahul
>
>
>
> On Wed, 22 Apr 2020 at 13:12, Stefan Hornburg (Racke) 
> wrote:
>
>> On 4/22/20 9:35 AM, Rahul Kumar wrote:
>> > Hi Ansible Gurus,
>> > I have below playbook in one git repository:  mymasterplaybook.yml
>> > - name: Do some test
>> >   include_role:
>> > name: mytestrole
>> > tasks_from: test-server-names
>> >   when: "'testing-group-name' in group_names"`
>> >
>> > Now I  invoke above playbook with a existing role named "mytestrole"
>> and task in it as "test-server-names" and group
>> > name is testing-group-name.It works fine.
>> >
>> > Now what i want tasks_from , name of role and group name as dynamic :
>> so my mymasterplaybook.yml will look like as below
>> >   - name: Do some test
>> >   include_role:
>> > name: {{dynamic role name}
>> > tasks_from: {{dynamic task name from role}}
>> >   when: "{{dynamic group name}' in group_names"`
>> >
>> > so that any role can be plugged into that !
>> > So whenever some one writes roles , they write 2 things
>> > 1. Role
>> > 2. some configuration file which contains  "dynamic role name",
>> "dynamic task name from role", "dynamic group name" as
>> > configurable items so that it can be plugged in master playbook named
>> mymasterplaybook.yml as shown above.
>> > and this configuration file will work as an interface between role and
>> master playbook (named mymasterplaybook.yml) for
>> > entire execution.
>> >
>> > Rahul
>>
>> Yes, and what's your question(s) ?
>>
>> The when condition wouldn't work that way as the value is virtually
>> wrapped into a Jinja template, so try:
>>
>> when: dynamic_group_name in group_names
>>
>> Regards
>> Racke
>>
>> >
>> > --
>> > 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/CAGH8rExBLxOpYKQPQMUsbXgiBt%2Bw4pgd6atCoP9TW3z%3DEUJJXg%40mail.gmail.com
>> > <
>> https://groups.google.com/d/msgid/ansible-project/CAGH8rExBLxOpYKQPQMUsbXgiBt%2Bw4pgd6atCoP9TW3z%3DEUJJXg%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/958b3e2e-da34-a278-3089-fc9ad0aab637%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/CAGH8rEww17UCXuY8uOfUa%3DhZYo%2BJ%3D2WQ1_pg3Za5ANyzwBOV4Q%40mail.gmail.com.


Re: [ansible-project] Need help for some logic

2020-04-22 Thread Rahul Kumar
Thanks stefan !
My question how i can take these 3 dynamic values as a configuration file
which comes with each role.
Example: I want to invoke mymasterplaybook.yml for 10 roles , so  i invoke
this playbook
as >ansible-playbook -i inventory.yml  mymasterplaybook.yml -> This
invocation could be completed if mymasterplaybook.yml takes those 3 params
which are dynamic from some configuration file a below
---
dynamic rolename: something
dynamic taskfromgroupname: something
dynamic group name: something

So if this is the configuration file , it will only include role only named
with "something" and import task from that role named with "something" and
similarly for group name.
Though i might have 100 roles but which will be included depends on this
configuration file .
so my question is : where and how this configuration file should be
written , so that my masterplaybook.yml understand this and takes all
dynamic params from this config file in order to execute the flow.

Rahul



On Wed, 22 Apr 2020 at 13:12, Stefan Hornburg (Racke) 
wrote:

> On 4/22/20 9:35 AM, Rahul Kumar wrote:
> > Hi Ansible Gurus,
> > I have below playbook in one git repository:  mymasterplaybook.yml
> > - name: Do some test
> >   include_role:
> > name: mytestrole
> > tasks_from: test-server-names
> >   when: "'testing-group-name' in group_names"`
> >
> > Now I  invoke above playbook with a existing role named "mytestrole" and
> task in it as "test-server-names" and group
> > name is testing-group-name.It works fine.
> >
> > Now what i want tasks_from , name of role and group name as dynamic : so
> my mymasterplaybook.yml will look like as below
> >   - name: Do some test
> >   include_role:
> > name: {{dynamic role name}
> > tasks_from: {{dynamic task name from role}}
> >   when: "{{dynamic group name}' in group_names"`
> >
> > so that any role can be plugged into that !
> > So whenever some one writes roles , they write 2 things
> > 1. Role
> > 2. some configuration file which contains  "dynamic role name", "dynamic
> task name from role", "dynamic group name" as
> > configurable items so that it can be plugged in master playbook named
> mymasterplaybook.yml as shown above.
> > and this configuration file will work as an interface between role and
> master playbook (named mymasterplaybook.yml) for
> > entire execution.
> >
> > Rahul
>
> Yes, and what's your question(s) ?
>
> The when condition wouldn't work that way as the value is virtually
> wrapped into a Jinja template, so try:
>
> when: dynamic_group_name in group_names
>
> Regards
> Racke
>
> >
> > --
> > 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/CAGH8rExBLxOpYKQPQMUsbXgiBt%2Bw4pgd6atCoP9TW3z%3DEUJJXg%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/ansible-project/CAGH8rExBLxOpYKQPQMUsbXgiBt%2Bw4pgd6atCoP9TW3z%3DEUJJXg%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/958b3e2e-da34-a278-3089-fc9ad0aab637%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/CAGH8rEz0zZ%2BO4Ef%2Bmi%2B0mwG4P2Gw-X-zSR7Mu_j1gL8hi4fE5A%40mail.gmail.com.


Re: [ansible-project] Need help for some logic

2020-04-22 Thread Stefan Hornburg (Racke)
On 4/22/20 9:35 AM, Rahul Kumar wrote:
> Hi Ansible Gurus,
> I have below playbook in one git repository:  mymasterplaybook.yml
> - name: Do some test
>       include_role:
>         name: mytestrole
>         tasks_from: test-server-names
>       when: "'testing-group-name' in group_names"`
> 
> Now I  invoke above playbook with a existing role named "mytestrole" and task 
> in it as "test-server-names" and group
> name is testing-group-name.It works fine.
> 
> Now what i want tasks_from , name of role and group name as dynamic : so my 
> mymasterplaybook.yml will look like as below
>   - name: Do some test
>       include_role:
>         name: {{dynamic role name}
>         tasks_from: {{dynamic task name from role}}
>       when: "{{dynamic group name}' in group_names"`  
> 
> so that any role can be plugged into that !
> So whenever some one writes roles , they write 2 things 
> 1. Role
> 2. some configuration file which contains  "dynamic role name", "dynamic task 
> name from role", "dynamic group name" as
> configurable items so that it can be plugged in master playbook named 
> mymasterplaybook.yml as shown above. 
> and this configuration file will work as an interface between role and master 
> playbook (named mymasterplaybook.yml) for
> entire execution.
> 
> Rahul

Yes, and what's your question(s) ?

The when condition wouldn't work that way as the value is virtually wrapped 
into a Jinja template, so try:

when: dynamic_group_name in group_names

Regards
Racke

> 
> -- 
> 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/CAGH8rExBLxOpYKQPQMUsbXgiBt%2Bw4pgd6atCoP9TW3z%3DEUJJXg%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/958b3e2e-da34-a278-3089-fc9ad0aab637%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[ansible-project] Need help for some logic

2020-04-22 Thread Rahul Kumar
Hi Ansible Gurus,
I have below playbook in one git repository:  mymasterplaybook.yml
- name: Do some test
  include_role:
name: mytestrole
tasks_from: test-server-names
  when: "'testing-group-name' in group_names"`

Now I  invoke above playbook with a existing role named "mytestrole" and
task in it as "test-server-names" and group name is testing-group-name.It
works fine.

Now what i want tasks_from , name of role and group name as dynamic : so my
mymasterplaybook.yml will look like as below
  - name: Do some test
  include_role:
name: {{dynamic role name}
tasks_from: {{dynamic task name from role}}
  when: "{{dynamic group name}' in group_names"`

so that any role can be plugged into that !
So whenever some one writes roles , they write 2 things
1. Role
2. some configuration file which contains  "dynamic role name", "dynamic
task name from role", "dynamic group name" as configurable items so that it
can be plugged in master playbook named mymasterplaybook.yml as shown
above.
and this configuration file will work as an interface between role and
master playbook (named mymasterplaybook.yml) for entire execution.

Rahul

-- 
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/CAGH8rExBLxOpYKQPQMUsbXgiBt%2Bw4pgd6atCoP9TW3z%3DEUJJXg%40mail.gmail.com.