Re: [ansible-project] Failed to import the required Python library (python-ldap)

2020-04-20 Thread Javi Legido
Good morning.

Shame on me, I installed by mistake 'python-ldap'.

I would swear that I had installed 'python3-ldap'

Thanks a lot, that fixed my issue.

On Tue, 21 Apr 2020 at 07:24, Stefan Hornburg (Racke) 
wrote:

> On 4/21/20 7:20 AM, Javi Legido wrote:
> > Hi there.
> >
> > First of all many thanks to all the people involved in this project for
> their time.
> >
> > I'm facing an issue with ldap_entry, details here <
> https://github.com/ansible/ansible/issues/69045>. Error message:
> >
> >
> > Failed to import the required Python library (python-ldap) on
> remote_host's Python /usr/bin/python3. Please read
> > module documentation and install in the appropriate location. If the
> required library is installed, but Ansible is
> > using the wrong Python interpreter, please consult the documentation
> on ansible_python_interpreter
> >
> >
> > Any help will be appreciated.
> >
> > Thanks.
>
> Hello Javi,
>
> did you install the python3-ldap package on the target host?
>
> 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/5a8ae412-6380-4c82-9364-6faa2c8652f4%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/5a8ae412-6380-4c82-9364-6faa2c8652f4%40googlegroups.com?utm_medium=email_source=footer
> >.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/6831307c-cbc7-cd65-44fb-4645f4f556e4%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/CALbe0QWVEp27H8ST7SNRs0Hq0ST4b3RVfOiaOrPG5-mdV_6VbQ%40mail.gmail.com.


Re: [ansible-project] Failed to import the required Python library (python-ldap)

2020-04-20 Thread Stefan Hornburg (Racke)
On 4/21/20 7:20 AM, Javi Legido wrote:
> Hi there.
> 
> First of all many thanks to all the people involved in this project for their 
> time.
> 
> I'm facing an issue with ldap_entry, details here 
> . Error message:
> 
> 
> Failed to import the required Python library (python-ldap) on 
> remote_host's Python /usr/bin/python3. Please read
> module documentation and install in the appropriate location. If the 
> required library is installed, but Ansible is
> using the wrong Python interpreter, please consult the documentation on 
> ansible_python_interpreter
> 
> 
> Any help will be appreciated.
> 
> Thanks.

Hello Javi,

did you install the python3-ldap package on the target host?

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/5a8ae412-6380-4c82-9364-6faa2c8652f4%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/6831307c-cbc7-cd65-44fb-4645f4f556e4%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[ansible-project] Failed to import the required Python library (python-ldap)

2020-04-20 Thread Javi Legido
Hi there.

First of all many thanks to all the people involved in this project for 
their time.

I'm facing an issue with ldap_entry, details here 
. Error message:


> Failed to import the required Python library (python-ldap) on 
> remote_host's Python /usr/bin/python3. Please read module documentation and 
> install in the appropriate location. If the required library is installed, 
> but Ansible is using the wrong Python interpreter, please consult the 
> documentation on ansible_python_interpreter
>

Any help will be appreciated.

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/5a8ae412-6380-4c82-9364-6faa2c8652f4%40googlegroups.com.


Re: [ansible-project] How to create Multiple Guest Vms Snapshot

2020-04-20 Thread Abhijeet Kasurde
with_items is a task level parameter and not vmware_guest_snapshot
parameter. To fix, you might want to match the indentation of with_items
with delegate_to or register parameters.

Please read
https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-items

On Mon, Apr 20, 2020 at 5:04 PM Arvind kumar  wrote:

> HI, I have Created a playbook to take a snapshot before patching of
> servers but this playbook has only one Guest_vm define so it working
> perfectly for me.
>
>  *- name: Vmware guest snapshot create*
> *   hosts: test-hypervisor*
>
> *   tasks:*
>
> *  - name: Create a snapshot*
> *vmware_guest_snapshot:*
> *   hostname: test-hypervisior*
> *   username: root*
> *   password: asdfghj123**
> *   datacenter: test-hypervisior*
> *   folder: " /folder1/localhost.example.com/vm
> "*
> *   name: RJRedhat01*
> *   state: present*
> *   validate_certs: False*
> *   snapshot_name: snap55*
> *   description: Test snapshot*
> *delegate_to: localhost*
> *register: snapshot_info*
> *  - name: show the status*
> *debug:*
> *var: snapshot_info.snapshot_results*
>
>
>  Above Playbook is working fine for me',  But I have dozens of server
> and I want to create the snapshot of all nodes, I am using * with_item*
> for looping all nodes but it is not working for me.
>
>
> My Playbook for Multi vm_guest snapshot creation
>
> *- name: Vmware guest snapshot create*
> *   hosts: test-hypervisior*
> *   tasks:*
>
> *  - name: Create a snapshot*
> *vmware_guest_snapshot:*
> *   hostname: test-hypervisior*
> *   username: root*
> *   password: asdfghj123**
> *   datacenter: test-hypervisior*
> *   folder: " /folder1/localhost.example.com/vm
> "*
> *   name: "{{ item}}"*
> *   with_items:*
> *- RJCentos1*
> *- RJRedhat01*
> *- MAXFAX01*
> *   state: present*
> *   validate_certs: False*
> *   snapshot_name: snap__with_multi_vms*
> *   description: snap1_descriptioninnn*
> *delegate_to: localhost*
> *register: snapshot_info*
> *  - name: show the status*
> *debug:*
> *var: snapshot_info.snapshot_results*
>
> 
>
>  ansible-playbook vm-snap-c2.yaml -u root -k
> SSH password:
>
> PLAY [Vmware guest snapshot create]
> *
>
> TASK [Gathering Facts]
> **
> Monday 20 April 2020  07:28:44 -0400 (0:00:00.056)   0:00:00.056
> **
> ok: [test-hypervisior]
>
> TASK [Create a snapshot]
> 
> Monday 20 April 2020  07:28:46 -0400 (0:00:02.462)   0:00:02.519
> **
> fatal: [test-hypervisior]: FAILED! => {"msg": "The task includes an option
> with an undefined variable.* The error was: 'item' is undefined\n\nThe
> error *appears to be in '/home/akumar/vm/vm-snap-c2.yaml': line 5, column
> 9, but may\nbe elsewhere in the file depending on the exact syntax
> problem.\n\nThe offending line appears to be:\n\n\n  - name: Create a
> snapshot\n^ here\n"}
>
> PLAY RECAP
> **
> test-hypervisior   : ok=1changed=0unreachable=0
> failed=1skipped=0rescued=0ignored=0
>
> Monday 20 April 2020  07:28:47 -0400 (0:00:00.167)   0:00:02.687
> **
>
> ===
> Gathering Facts
> --
> 2.46s
> Create a snapshot
> 
> 0.17s
>
> --
> 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/635f419e-3788-4396-bb05-9fefae07bf3e%40googlegroups.com
> 

[ansible-project] Re: LDAP integration with ldap_entry module.

2020-04-20 Thread Javi Legido
Hi there.

I strongly suggest first try to create the user by hand, to discard errors 
such as wrong domain and so on.

Cheers.


On Wednesday, April 3, 2019 at 10:16:13 AM UTC+2, Nikhil wrote:
>
> Hi,
>
>   Am trying to interface with LDAP on Linux and creating a new user. if 
> uid doesn't exist, then it should ideally create one. However, am getting 
> below error. 
>
> My ansible playbbok is as below:
>
> - name: LDAP user check
>   hosts: LOCAL
>   tasks:
>   - name: check ldap entry
> ldap_entry:
> dn: cn=admin,dc=example,dc=com
> objectClass:
> - simpleSecurityObject
> - organizationalRole
>
>   - name: Ensure an LDAP entry exists for uid
> ldap_entry:
>server_uri: ldaps://directory.example.com:636
>bind_dn: cn=admin,dc=example,dc=com
>bind_pw: XX
>dn: uid=njain10,ou=people,dc=example,dc=com
>objectClass:
> - account
>attributes:
>uid: njain10
>
> ERROR:
> --
>
> TASK [Ensure an LDAP entry exists for uid] 
> *
> An exception occurred during task execution. To see the full traceback, 
> use -vvv. The error was: NO_SUCH_OBJECT: {'matched': u'dc=example,dc=com', 
> 'desc': u'No such object'}
> fatal: [192.168.XXX.XXX]: FAILED! => {"changed": false, "details": 
> "{'matched': u'dc=example,dc=com', 'desc': u'No such object'}", "msg": 
> "Entry action failed."}
>
>
> Appreciate anyone's help here.
>
> Regards,
> Nikhil
>

-- 
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/29180d30-dbf6-41a7-a310-03c6c8058691%40googlegroups.com.


Re: [ansible-project] How can I use the ip in a playbook when inventory has ansible_host

2020-04-20 Thread Scott Fella
Thanks for that info also. I will play around with that in the inventory or in 
the host_vars. That gives me more options I can use during a play. 

-Scott

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


Re: [ansible-project] telnet issue

2020-04-20 Thread Brian Coca
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/CACVha7d38oC83CFbLNOEytudavLiQLW2CRFcXr%3DCNwCnWb7_UA%40mail.gmail.com.


Re: [ansible-project] How can I use the ip in a playbook when inventory has ansible_host

2020-04-20 Thread Stefan Hornburg (Racke)
On 4/21/20 6:55 AM, Scott Fella wrote:
> Thank you very much!  I can't believe that I didn't scroll down that page far 
> enough, basically was looking at the magic
> variables. 
> 
> -Scott

Hello Scott,

in fact ansible_host is a special variable, but any variable you stick on the 
host line will be available as
variable later.

[aireos]
wlc2504-01 ansible_host=10.10.201.24 myvar=foo

Can be used as {{ myvar }}.

Regards
   Racke

> 
> On Monday, 20 April 2020 21:49:41 UTC-7, Dick Visser wrote:
> 
> From: 
> 
> https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html
> 
> 
> 
> 
> On Tue, 21 Apr 2020 at 06:47, Dick Visser  > wrote:
> 
> Try 'ansible_host'
> 
> On Tue, 21 Apr 2020 at 03:11, Scott Fella  > wrote:
> 
> Currently trying to see if there is a way I can grab the ip 
> defined in the ansible_host and use that in a
> playbook.  I know there is inventory_hostaname, but these for 
> example are not in dns.
> 
> hosts inventory example:
> 
> [aireos]
> wlc2504-01 ansible_host=10.10.201.24
> wlc2504-02 ansible_host=10.10.201.25
> wlc5520-01 ansible_host=10.11.201.24
> wlc5520-02 ansible_host=10.11.201.25
> 
> Here is a sample of a playbook which works if the device is 
> registered in dns but fails of course when not. 
> Is there any way I can extract the ip address so I can loop 
> through all devices in the inventory group?
> 
> ---
> - name: Check if SNMPv2 is working on remote host
> hosts: aireos
> connection: local
> gather_facts: no
> 
> tasks:
> - name: Test SNMPv2
> local_action: command snmpget -v 2c -c testSNMPxxx 
> {{inventory_hostname}} 1.3.6.1.2.1.1.5.0
> register: response
> - name: Print the complete response
> debug:
> var: response
> 
> Thanks,
> -Scott
> 
> -- 
> You received this message because you are subscribed to the 
> Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, 
> send an email to
> ansible...@googlegroups.com .
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/ansible-project/302b741d-c377-41a7-ab93-837f143446c9%40googlegroups.com
> 
> .
> 
> -- 
> Sent from a mobile device - please excuse the brevity, spelling and 
> punctuation.
> 
> -- 
> 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/bba8ccda-df65-4cde-bbc8-2e22d3fc4394%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/d55edf95-534e-6838-2f77-5e19f9c2ea16%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] How can I use the ip in a playbook when inventory has ansible_host

2020-04-20 Thread Scott Fella
Thank you very much!  I can't believe that I didn't scroll down that page 
far enough, basically was looking at the magic variables.  

-Scott

On Monday, 20 April 2020 21:49:41 UTC-7, Dick Visser wrote:
>
> From: 
>
> https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html
>
>
> On Tue, 21 Apr 2020 at 06:47, Dick Visser  > wrote:
>
>> Try 'ansible_host'
>>
>> On Tue, 21 Apr 2020 at 03:11, Scott Fella > 
>> wrote:
>>
>>> Currently trying to see if there is a way I can grab the ip defined in 
>>> the ansible_host and use that in a playbook.  I know there is 
>>> inventory_hostaname, but these for example are not in dns.
>>>
>>> hosts inventory example:
>>>
>>> [aireos]
>>> wlc2504-01 ansible_host=10.10.201.24
>>> wlc2504-02 ansible_host=10.10.201.25
>>> wlc5520-01 ansible_host=10.11.201.24
>>> wlc5520-02 ansible_host=10.11.201.25
>>>
>>> Here is a sample of a playbook which works if the device is registered 
>>> in dns but fails of course when not.  Is there any way I can extract the ip 
>>> address so I can loop through all devices in the inventory group?
>>>
>>> ---
>>> - name: Check if SNMPv2 is working on remote host
>>> hosts: aireos
>>> connection: local
>>> gather_facts: no
>>>
>>> tasks:
>>> - name: Test SNMPv2
>>> local_action: command snmpget -v 2c -c testSNMPxxx 
>>> {{inventory_hostname}} 1.3.6.1.2.1.1.5.0
>>> register: response
>>> - name: Print the complete response
>>> debug:
>>> var: response
>>>
>>> Thanks,
>>> -Scott
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to ansible...@googlegroups.com .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/302b741d-c377-41a7-ab93-837f143446c9%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>> -- 
>> Sent from a mobile device - please excuse the brevity, spelling and 
>> punctuation.
>>
> -- 
> 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/bba8ccda-df65-4cde-bbc8-2e22d3fc4394%40googlegroups.com.


Re: [ansible-project] How can I use the ip in a playbook when inventory has ansible_host

2020-04-20 Thread Dick Visser
From:
https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html


On Tue, 21 Apr 2020 at 06:47, Dick Visser  wrote:

> Try 'ansible_host'
>
> On Tue, 21 Apr 2020 at 03:11, Scott Fella  wrote:
>
>> Currently trying to see if there is a way I can grab the ip defined in
>> the ansible_host and use that in a playbook.  I know there is
>> inventory_hostaname, but these for example are not in dns.
>>
>> hosts inventory example:
>>
>> [aireos]
>> wlc2504-01 ansible_host=10.10.201.24
>> wlc2504-02 ansible_host=10.10.201.25
>> wlc5520-01 ansible_host=10.11.201.24
>> wlc5520-02 ansible_host=10.11.201.25
>>
>> Here is a sample of a playbook which works if the device is registered in
>> dns but fails of course when not.  Is there any way I can extract the ip
>> address so I can loop through all devices in the inventory group?
>>
>> ---
>> - name: Check if SNMPv2 is working on remote host
>> hosts: aireos
>> connection: local
>> gather_facts: no
>>
>> tasks:
>> - name: Test SNMPv2
>> local_action: command snmpget -v 2c -c testSNMPxxx
>> {{inventory_hostname}} 1.3.6.1.2.1.1.5.0
>> register: response
>> - name: Print the complete response
>> debug:
>> var: response
>>
>> Thanks,
>> -Scott
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ansible-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/302b741d-c377-41a7-ab93-837f143446c9%40googlegroups.com
>> 
>> .
>>
> --
> Sent from a mobile device - please excuse the brevity, spelling and
> punctuation.
>
-- 
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/CAL8fbwPSV3h4gO3NS4ZPtDRH1q5B%2Bs-ZvpfY3jN9tAAB1%2BuQjw%40mail.gmail.com.


Re: [ansible-project] How can I use the ip in a playbook when inventory has ansible_host

2020-04-20 Thread Dick Visser
Try 'ansible_host'

On Tue, 21 Apr 2020 at 03:11, Scott Fella  wrote:

> Currently trying to see if there is a way I can grab the ip defined in the
> ansible_host and use that in a playbook.  I know there is
> inventory_hostaname, but these for example are not in dns.
>
> hosts inventory example:
>
> [aireos]
> wlc2504-01 ansible_host=10.10.201.24
> wlc2504-02 ansible_host=10.10.201.25
> wlc5520-01 ansible_host=10.11.201.24
> wlc5520-02 ansible_host=10.11.201.25
>
> Here is a sample of a playbook which works if the device is registered in
> dns but fails of course when not.  Is there any way I can extract the ip
> address so I can loop through all devices in the inventory group?
>
> ---
> - name: Check if SNMPv2 is working on remote host
> hosts: aireos
> connection: local
> gather_facts: no
>
> tasks:
> - name: Test SNMPv2
> local_action: command snmpget -v 2c -c testSNMPxxx {{inventory_hostname}}
> 1.3.6.1.2.1.1.5.0
> register: response
> - name: Print the complete response
> debug:
> var: response
>
> Thanks,
> -Scott
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/302b741d-c377-41a7-ab93-837f143446c9%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/CAL8fbwP2E-qy4bx4ozgp5hOEpzeWEYusymVptmQFXrGr5OR9OA%40mail.gmail.com.


Re: [ansible-project] Concatenate strings using with_items and assign to a variable in Ansible

2020-04-20 Thread Dick Visser
Few things come to mind when looking at your code

1. Why are you using iptables? Security groups would take away a lot of
problems especially the dynamics that you seem to working around with
iptables.

2. If you need to restrict access between ec2 instances, why do you use
public interfaces for communication?

If you let us know what high level goal you are trying to achieve with your
playbook? There might be better/easier ways to achieve it.

Dick

On Mon, 20 Mar 2017 at 16:02,  wrote:

> I need to save two 2 IPs to a variable in a vars_file when launching
> ec2_instances, which are used later during deployment.
>
>
> This is how I am saving a single server ip:
>
>
> - name: Save server public IP to vars file
>   lineinfile: line="server_public_ip{{':'}} {{ item.public_ip }}"
>   dest="{{ansible_env.HOME}}/dynamic_ips_{{ec2_environment}}"
>   with_items: server.instances  #server is registered in previous task
>
>
> The output I have in dynamic_ips file is *server_public_ip: xxx.xxx.xx.x*
>
>
> Now I have 2 servers launched and registered as servers.
>
>
> I need to save this as *server_public_ips: xxx.xx.x.xx , xxx.x.xx.x*
>
>
> I tried to declare an empty string and append ips to it, something like
> this, but I am getting errors.
>
>
> set_fact:
>ips: ""
> set_fact:
>ips: " {{ ips }} + {{ item.public_ip}} "
> with_items: servers.instances  #servers is registered in previous task
> lineinfile: line="server_public_ips{{':'}} {{ ips }}"
> dest="{{ansible_env.HOME}}/dynamic_ips_{{ec2_environment}}"
>
>
> I think it can be done using lineinfile insertafter and regex.
>
>
> Finally, I need this to do this in a different server,
>
>
> - name: Restrict access to outside world
>   command: iptables INPUT {{ item }} ACCEPT
>   with_items: {{ server_public_ips }}.split(,) #grant access for each ip
>   command: iptables INPUT DROP
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/409799bb-9288-4c2d-b484-801dad1f4c0c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
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/CAL8fbwOwWnJwZmAuSaiWnBNRiFgLDcMiHbC_afUQQxzFOijg1A%40mail.gmail.com.


[ansible-project] fortigate backup cfg

2020-04-20 Thread Sandy Hung
Dear All:

I have some problem, I ran ansible fortigate backup cfg 
it's file have in path but ansible have error msg 
{ "msg": "Failed while reading configuration backup"}
I don't know what happened

This is my ansible
---
- hosts: localhost
  gather_facts: no

  vars_files:
   - fortikey.yml
  tasks:
- name: backup system config
  fortios_config:
host: "{{host}}"
username: "{{username}}"
password: "{{password}}"
backup: yes
backup_path: "/tmp/fortigate/"
backup_filename: "backup_config.cfg"

-- 
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/7a4acba3-b37a-4ae9-b377-3635dd3ddc51%40googlegroups.com.


[ansible-project] How can I use the ip in a playbook when inventory has ansible_host

2020-04-20 Thread Scott Fella
Currently trying to see if there is a way I can grab the ip defined in the 
ansible_host and use that in a playbook.  I know there is 
inventory_hostaname, but these for example are not in dns.

hosts inventory example:

[aireos]
wlc2504-01 ansible_host=10.10.201.24
wlc2504-02 ansible_host=10.10.201.25
wlc5520-01 ansible_host=10.11.201.24
wlc5520-02 ansible_host=10.11.201.25

Here is a sample of a playbook which works if the device is registered in 
dns but fails of course when not.  Is there any way I can extract the ip 
address so I can loop through all devices in the inventory group?

---
- name: Check if SNMPv2 is working on remote host
hosts: aireos
connection: local
gather_facts: no

tasks:
- name: Test SNMPv2
local_action: command snmpget -v 2c -c testSNMPxxx {{inventory_hostname}} 
1.3.6.1.2.1.1.5.0
register: response
- name: Print the complete response
debug:
var: response

Thanks,
-Scott

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


[ansible-project] Re: Concatenate strings using with_items and assign to a variable in Ansible

2020-04-20 Thread Harsh Agarwal
why dont you..concatenate strings to a list and then join the list instead 
to make the string?


On Monday, March 20, 2017 at 11:02:39 AM UTC-4, charan@zemosolabs.com 
wrote:
>
> I need to save two 2 IPs to a variable in a vars_file when launching 
> ec2_instances, which are used later during deployment.
>
>
> This is how I am saving a single server ip:
>
>
> - name: Save server public IP to vars file
>   lineinfile: line="server_public_ip{{':'}} {{ item.public_ip }}"
>   dest="{{ansible_env.HOME}}/dynamic_ips_{{ec2_environment}}"
>   with_items: server.instances  #server is registered in previous task
>
>
> The output I have in dynamic_ips file is *server_public_ip: xxx.xxx.xx.x*
>
>
> Now I have 2 servers launched and registered as servers.
>
>
> I need to save this as *server_public_ips: xxx.xx.x.xx , xxx.x.xx.x*
>
>
> I tried to declare an empty string and append ips to it, something like 
> this, but I am getting errors.
>
>
> set_fact:
>ips: ""
> set_fact:
>ips: " {{ ips }} + {{ item.public_ip}} "
> with_items: servers.instances  #servers is registered in previous task
> lineinfile: line="server_public_ips{{':'}} {{ ips }}"
> dest="{{ansible_env.HOME}}/dynamic_ips_{{ec2_environment}}"
>
>
> I think it can be done using lineinfile insertafter and regex.
>
>
> Finally, I need this to do this in a different server,
>
>
> - name: Restrict access to outside world
>   command: iptables INPUT {{ item }} ACCEPT
>   with_items: {{ server_public_ips }}.split(,) #grant access for each ip 
>   command: iptables INPUT DROP
>
>

-- 
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/782f65bb-8e06-45cc-b023-cebd47cc6e6e%40googlegroups.com.


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

2020-04-20 Thread Kai Stian Olstad
On Fri, Apr 17, 2020 at 12:59:09AM -0700, 'Spoonless' via Ansible Project wrote:
> Hi again,
> 
> Thanks for the tip in the right direction:
> 
> I now have this:
> 
>   tasks:
> - name: Set the required enabled repo information as facts
>   shell: "yum repolist -v | grep {{item}} | awk -F\": \" '{print $2}'"
>   with_items:
> - "Repo-id"
> - "Repo-updated"
> - "Repo-pkgs"
> - "Repo-size"
> - "Repo-name"
> - "Repo-baseurl"
> - "Repo-filename"
>   register: output  
> - set_fact:
> repoid: "{{ output.results.0.stdout }}"
> #repoupdated: "{{ output.results.1.stdout }}"
> #repopkgs: "{{ output.results.2.stdout }}"
> #reposize: "{{ output.results.3.stdout }}"
> reponame: "{{ output.results.4.stdout }}"
> repobaseurl: "{{ output.results.5.stdout }}"
> repofilename: "{{ output.results.6.stdout }}"
> 
> - debug:
> msg: "{{reponame}} is an illegal url"
>   when: repobaseurl is search("ftp://somehostname.*;)
>   
> 
> 
> ==
> 
> But..
> My debug output is now showing all of the repo's and not filtering.
> ?

Yes, the stdout will contain everything.

output.results.0.stdout_lines.0 will contain the repo-id for the first one.
output.results.0.stdout_lines.1 will contain the repo-id for the second one.

output.results.5.stdout_lines.0 will contain the repo-baseurl for the first one.
output.results.5.stdout_lines.1 will contain the repo-baseurl for the second 
one.


It isn't easy to parse text in Ansible, i would create a script that did the
parsing and returned a json that you can use a lot easier in Ansible.


-- 
Kai Stian Olstad

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


[ansible-project] Conditional Delegation to a host for synchronize module

2020-04-20 Thread Raj V
Hello,

I am a newbie to Ansible and trying to figure out how to synchronize 
between 3 hosts based on condition. Below are details:
There are 3 nodes and based on which node is primary (I was able to get a 
custom fact set for it) need to delegate to that host (which runs 
synchronize from that host to other two hosts).
Custom fact basically is  value 1 or 0 (1 means Primary/Master and 0 means 
not).
I am unable to get the hostname (primary hostname) value to include into 
the synchronize steps. Below is the playbook I have. How do I make 
synchronize read the "primary" hostname value to run the next steps.

---

- name: Playbook for rsync
  become: yes
  hosts: clients
  gather_facts: True

  tasks:
  - name: Task to rsync from Primary server
synchronize:
  src: "{{ item.source }}"
  dest: "{{ item.dest }}"
with_items:
  - { source: '/rsynctest/', dest: '/rsynctest/' }
  - { source: '/rsynctest1/', dest: '/rsynctest1/' }
delegate_to: "{{ ansible_hostname }}"
when:
  - ansible_local.determine.isprimary  == "1" 


Thanks
-Raj

-- 
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/8db34741-fc8b-43b6-90e4-5ff78d6b8e9c%40googlegroups.com.


[ansible-project] Re: Help with a Windows target node

2020-04-20 Thread NoobSkywalker
Anyone able to help with this?  I can provide any other information to aid 
in the debug if I've omitted anything ...


On Tuesday, April 14, 2020 at 1:41:19 PM UTC-4, NoobSkywalker wrote:
>
>
> -
> Ansible control node:  CentOS Linux release 8.1.1911 (Core)
>
> -
> Ansible version:
> *ansible 2.9.5*
>   config file = /local1/cnxbuild/ansible/ansible.cfg
>   configured module search path = 
> ['/usr/lib/python3.6/site-packages/ansible/modules']
>   ansible python module location = /usr/lib/python3.6/site-packages/ansible
>   executable location = /usr/bin/ansible
>   python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 
> 20190507 (Red Hat 8.3.1-4)]
>
> -
> Ansible target node:  Windows 2019 Datacenter 10.0.17763 Build 17763
>
> -
> From the Ansible control node, I'm able to SSH into the target node 
> without issue:
>
> [cnxbuild@fakeHost ansible]$ ssh -i /etc/ansible/ansible_private_key 
> cnxbu...@xxx.xxx.xxx.xxx
> FIPS mode initialized
>
> Microsoft Windows [Version 10.0.17763.1131]
> 
>
> (c) 2018 Microsoft Corporation. All rights reserved.  
> 
>
> cnxbuild@FAKEHOST C:\Users\cnxbuild>hostname  
> 
>  
> fakeHost
>
> -
> Command running from the control node:
>
> *ansible-playbook - test.yaml -i fakeHost.fake.domain.com 
> ,*
>
> -
> Contents of test.yaml:
>
> *---*
>
> *- hosts: fakeHost.fake.domain.com *
> *  #remote_user: cnxbuild*
> *  remote_user: **fakeHost**\cnxbuild*
> *  #remote_user: **fakeHost**\Administrator*
> *  #remote_user: **fakeHost**\\cnxbuild*
>
> *  tasks:*
> *- name: Save the result of 'whoami' in 'whoami_out'*
> *  win_command: whoami*
> *  register: whoami_out*
>  
>
> -
>
> Output below shows that the connection to the Windows node's OpenSSH 
> server was successful, but the Ansible command fails ... any insight would 
> be greatly appreciated:
>
> [cnxbuild@fakeHost ansible]$ *ansible-playbook - test.yaml -i 
> fakeHost.fake.domainName,*
> ansible-playbook 2.9.5
>   config file = /local1/cnxbuild/ansible/ansible.cfg
>   configured module search path = 
> ['/usr/lib/python3.6/site-packages/ansible/modules']
>   ansible python module location = /usr/lib/python3.6/site-packages/ansible
>   executable location = /usr/bin/ansible-playbook
>   python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 
> 20190507 (Red Hat 8.3.1-4)]
> Using /local1/cnxbuild/ansible/ansible.cfg as config file
> setting up inventory plugins
> Parsed fakeHost.fake.domainName, inventory source with host_list plugin
> Loading callback plugin default of type stdout, v2.0 from 
> /usr/lib/python3.6/site-packages/ansible/plugins/callback/default.py
>
> PLAYBOOK: test.yaml 
> **
> Positional arguments: test.yaml
> verbosity: 4
> private_key_file: /etc/ansible/ansible_private_key
> connection: smart
> timeout: 10
> become_method: sudo
> tags: ('all',)
> inventory: ('fakeHost.fake.domainName,',)
> forks: 5
> 1 plays in test.yaml
>
> PLAY [fakeHost.fake.domainName] 
> ***
>
> TASK [Gathering Facts] 
> ***
> task path: /local1/cnxbuild/ansible/test.yaml:4
>  ESTABLISH SSH CONNECTION FOR USER: 
> fakeHost\cnxbuild
>  SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o 
> ControlPersist=60s -o 'IdentityFile="/etc/ansible/ansible_private_key"' -o 
> 

[ansible-project] Re: REST API to add host to inventory for Ansible Tower is Not working!

2020-04-20 Thread Phil Griffiths
Hi Vivek

As Stefan mentioned this list is not for AWX/Tower queries, BUT please take 
a look at either the tower-cli or awx-cli depending on your version and 
also the tower specific modules for doing such tasks. For instance, 
https://docs.ansible.com/ansible/latest/modules/tower_host_module.html#tower-host-module

Regards
Phil.

On Friday, 17 April 2020 14:40:27 UTC+1, Vivek Mandal wrote:
>
> Hi,
>I have been trying to execute a REST API to
> Add a host to an inventory.Below is the API.
>
> /api/v2/inventories/{id}/hosts/
>
> Unfortunately, This API doesn't work. It gives the response as 200(Ok). 
> But only displays the existing host. Its the same response when you run GET 
> method for the same API call. Can someone please help me rectifying the 
> error.
>
> Thanks,
> Vivek
>
>

-- 
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/d2d6791b-4585-4b2e-b7f6-b9f3de965012%40googlegroups.com.


Re: [ansible-project] Re: Relation between Ansible and SDN

2020-04-20 Thread Phil Griffiths
Nabil

As with everything Ansible it comes down to the modules- this is a link to 
the complete list: 
https://docs.ansible.com/ansible/latest/modules/list_of_all_modules.html
Have a look through there for anything SDN related for the solution you're 
looking for. There is no such generic 'sdn' module(s) so you need to look 
at vendor specific ones (if they exist)

Regards
Phil.

On Monday, 20 April 2020 15:44:08 UTC+1, nabil hama wrote:
>
>
> Hello Albert,
>
> Thanks a lot for your feedback.
>
> Please do know how it works (using Ansible for SDN automation)? if not, do 
> you know where can I find this details?
>
> Thanks in advance
>
> BR
> Le lundi 20 avril 2020 15:36:20 UTC+1, Albert Short a écrit :
>>
>> There are a number of vendors that use Ansible for SDN automation.
>>
>> Cisco as you mentioned for ACI & or traditional networking
>> Cumulus Networks also uses Ansible
>> If you wanted you could use it for NSX but vRa may help you there.
>>
>> There are git repositories, just need to know where to look :)
>>
>>
>> On Monday, 20 April 2020 15:59:52 UTC+2, nabil hama wrote:
>>>
>>> Hello Karl,
>>>
>>> Effectively, I google it, I understood for Ansible but not the relation 
>>> between it and SDN.  Apart Cisco who talked about this topic, no other 
>>> person talking about this subject.
>>>
>>> Many thanks for feedback, which very helpful for me.
>>>
>>> best regards   
>>>
>>> Le lundi 20 avril 2020 14:09:04 UTC+1, Karl Auer a écrit :

 Hullo Nabil.

 On Mon, 20 Apr 2020 at 13:44, nabil hama  wrote:>
> I have confusion between the utilization of Ansible and  SDN,   As 
> long as the 

 SDN offers network automation, optimization and high flexibility, what 
> is the 

 role of Ansible in that network?  are two different subjects and work 
> totally 

 separately?
>

 They are two different subjects and work totally separately. However, 
 if you can find (or write!) Ansible modules that manipulate SDNs, you 
 could 
 then use Ansible to do that.

 Regards, K.



 -- 

 *Karl Auer* { manager, systems support }
 P: 1300 759 975
 E: ka...@2pisoftware.com
 2pisoftware.com

 GPG/PGP : DF6A 43E5 FB9D D884 C6CA CD7F 5278 212D E80F C107
 Previous: 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E

>>>

-- 
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/a63afb1f-c4e1-4920-927b-0213d469aade%40googlegroups.com.


[ansible-project] I can read the key from KV but cannot pass it on as a private key.

2020-04-20 Thread Ali Shaik


At the time of running the playbook, ansible should be able to source the 
key from Azure Key Vault and use that key to log in to the hosts.


With managed keys  in KV it is possible to capture the key at the run time, 
but how do I pass that as an *ansible_ssh_private_key*


   - hosts: tested1
   tasks:
  - name: Install Apache and PHP
  vars:
  url: 'https://demkeyvault.vault.azure.net/'
  secretname: 'adminPassword'
  ansible_ssh_private_key: 
  "{{lookup('azure_keyvault_secret',secretname,vault_url=url, 
  client_id=client_id, secret=secret, tenant_id=tenant)}}"
  yum: name=httpd,php state=installed
   
Ansible version is 2.9

-- 
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/74b42c6c-758c-4446-836c-c7f01f02a7d5%40googlegroups.com.


Re: [ansible-project] DNS Update (AD)

2020-04-20 Thread Dick Visser
Doesn't the win_dns_record module just do everything already?

Just one task and be done with it?




On Mon, 20 Apr 2020 at 15:26, Renato Marcandier 
wrote:

> Hello guys,
>
>
> I am trying to run a playbook that does the following situation:
>
>
> I want to update a current A record with a new IP address; if it doesn't
> exist, it will create a new A record.
>
>
> My current playbook does the following tasks:
>
>
> Check if the A record inside our DNS Manager exists.
>
>- If it doesn't, my playbook will create a new A record.
>- If it does, it will delete the current A record and recreate with a
>new IP address.
>
>
> Just want to check if there is a better way to achieve it without delete
> and recreate the A record, I couldn't figure out a way to only update the
> current A record using "Set-DnsServerResourceRecord".
>
>
> ---
>
>
> - hosts: all
>
>   gather_facts: true
>
>   vars:
>
> dns_name: "test_01"
>
> ip: "10.10.10.13"
>
>
>   tasks:
>
>
>   - name: "Check a DNS record"
>
> win_shell: |
>
>   try {
>
>   (Get-DnsServerResourceRecord `
>
> -ZoneName "{{ dns_domain }}" `
>
> -name "{{ dns_name }}" `
>
> -RRType 'A' `
>
> -ErrorAction stop `
>
> -ComputerName "{{ dns_server
> }}").RecordData.IPv4Address.IPAddressToString
>
>   } catch {
>
> write-host "failed"
>
>   }
>
> delegate_to: "{{ mgmt_server }}"
>
> changed_when: false
>
> register: check_out
>
>
>   - name: DNS output
>
> debug:
>
>   var: check_out.stdout_lines[0]
>
>
>- name: Remove static record
>
>  win_dns_record:
>
>name: "{{ dns_name }}"
>
>type: "A"
>
>state: absent
>
>zone: "{{ dns_domain }}"
>
>
>- name: Register
>
>  win_shell: |
>
>Add-DnsServerResourceRecordA `
>
>-ZoneName "{{ dns_domain }}" `
>
>-name "{{ dns_name }}" `
>
>-AllowUpdateAny `
>
>-IPv4Address "{{ ip }}" `
>
>-ComputerName "{{ dns_server }}"
>
>  delegate_to: "{{ mgmt_server }}"
>
>  register: change_out
>
>  throttle: 1
>
>
>   - name: Change output
>
> debug:
>
>   var: change_out
>
> --
> 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/83b926d6-ecef-427d-8744-3483379410a0%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/CAL8fbwM55viynhpSsTFUojf1A9CQDuqCvDTE2P%2Bei4ELJtrqfA%40mail.gmail.com.


Re: [ansible-project] Re: Relation between Ansible and SDN

2020-04-20 Thread nabil hama

Hello Albert,

Thanks a lot for your feedback.

Please do know how it works (using Ansible for SDN automation)? if not, do 
you know where can I find this details?

Thanks in advance

BR
Le lundi 20 avril 2020 15:36:20 UTC+1, Albert Short a écrit :
>
> There are a number of vendors that use Ansible for SDN automation.
>
> Cisco as you mentioned for ACI & or traditional networking
> Cumulus Networks also uses Ansible
> If you wanted you could use it for NSX but vRa may help you there.
>
> There are git repositories, just need to know where to look :)
>
>
> On Monday, 20 April 2020 15:59:52 UTC+2, nabil hama wrote:
>>
>> Hello Karl,
>>
>> Effectively, I google it, I understood for Ansible but not the relation 
>> between it and SDN.  Apart Cisco who talked about this topic, no other 
>> person talking about this subject.
>>
>> Many thanks for feedback, which very helpful for me.
>>
>> best regards   
>>
>> Le lundi 20 avril 2020 14:09:04 UTC+1, Karl Auer a écrit :
>>>
>>> Hullo Nabil.
>>>
>>> On Mon, 20 Apr 2020 at 13:44, nabil hama  wrote:>
 I have confusion between the utilization of Ansible and  SDN,   As long 
 as the 
>>>
>>> SDN offers network automation, optimization and high flexibility, what 
 is the 
>>>
>>> role of Ansible in that network?  are two different subjects and work 
 totally 
>>>
>>> separately?

>>>
>>> They are two different subjects and work totally separately. However, if 
>>> you can find (or write!) Ansible modules that manipulate SDNs, you could 
>>> then use Ansible to do that.
>>>
>>> Regards, K.
>>>
>>>
>>>
>>> -- 
>>>
>>> *Karl Auer* { manager, systems support }
>>> P: 1300 759 975
>>> E: ka...@2pisoftware.com
>>> 2pisoftware.com
>>>
>>> GPG/PGP : DF6A 43E5 FB9D D884 C6CA CD7F 5278 212D E80F C107
>>> Previous: 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E
>>>
>>

-- 
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/b30e7dc3-8a61-4c44-9dc0-a309baad1ad1%40googlegroups.com.


Re: [ansible-project] Re: Relation between Ansible and SDN

2020-04-20 Thread Albert Short
There are a number of vendors that use Ansible for SDN automation.

Cisco as you mentioned for ACI & or traditional networking
Cumulus Networks also uses Ansible
If you wanted you could use it for NSX but vRa may help you there.

There are git repositories, just need to know where to look :)


On Monday, 20 April 2020 15:59:52 UTC+2, nabil hama wrote:
>
> Hello Karl,
>
> Effectively, I google it, I understood for Ansible but not the relation 
> between it and SDN.  Apart Cisco who talked about this topic, no other 
> person talking about this subject.
>
> Many thanks for feedback, which very helpful for me.
>
> best regards   
>
> Le lundi 20 avril 2020 14:09:04 UTC+1, Karl Auer a écrit :
>>
>> Hullo Nabil.
>>
>> On Mon, 20 Apr 2020 at 13:44, nabil hama  wrote:>
>>> I have confusion between the utilization of Ansible and  SDN,   As long 
>>> as the 
>>
>> SDN offers network automation, optimization and high flexibility, what is 
>>> the 
>>
>> role of Ansible in that network?  are two different subjects and work 
>>> totally 
>>
>> separately?
>>>
>>
>> They are two different subjects and work totally separately. However, if 
>> you can find (or write!) Ansible modules that manipulate SDNs, you could 
>> then use Ansible to do that.
>>
>> Regards, K.
>>
>>
>>
>> -- 
>>
>> *Karl Auer* { manager, systems support }
>> P: 1300 759 975
>> E: ka...@2pisoftware.com
>> 2pisoftware.com
>>
>> GPG/PGP : DF6A 43E5 FB9D D884 C6CA CD7F 5278 212D E80F C107
>> Previous: 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E
>>
>

-- 
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/a35582cd-269d-4da6-b310-8026edefd6dd%40googlegroups.com.


Re: [ansible-project] Re: Relation between Ansible and SDN

2020-04-20 Thread nabil hama
Hello Karl,

Effectively, I google it, I understood for Ansible but not the relation 
between it and SDN.  Apart Cisco who talked about this topic, no other 
person talking about this subject.

Many thanks for feedback, which very helpful for me.

best regards   

Le lundi 20 avril 2020 14:09:04 UTC+1, Karl Auer a écrit :
>
> Hullo Nabil.
>
> On Mon, 20 Apr 2020 at 13:44, nabil hama > 
>> wrote:>
>> I have confusion between the utilization of Ansible and  SDN,   As long 
>> as the 
>
> SDN offers network automation, optimization and high flexibility, what is 
>> the 
>
> role of Ansible in that network?  are two different subjects and work 
>> totally 
>
> separately?
>>
>
> They are two different subjects and work totally separately. However, if 
> you can find (or write!) Ansible modules that manipulate SDNs, you could 
> then use Ansible to do that.
>
> Regards, K.
>
>
>
> -- 
>
> *Karl Auer* { manager, systems support }
> P: 1300 759 975
> E: ka...@2pisoftware.com 
> 2pisoftware.com
>
> GPG/PGP : DF6A 43E5 FB9D D884 C6CA CD7F 5278 212D E80F C107
> Previous: 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E
>

-- 
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/c9022d79-2bb3-4dcb-9b34-43e0082f36c0%40googlegroups.com.


[ansible-project] DNS Update (AD)

2020-04-20 Thread Renato Marcandier


Hello guys,


I am trying to run a playbook that does the following situation:


I want to update a current A record with a new IP address; if it doesn't 
exist, it will create a new A record.


My current playbook does the following tasks:


Check if the A record inside our DNS Manager exists.

   - If it doesn't, my playbook will create a new A record.
   - If it does, it will delete the current A record and recreate with a 
   new IP address.


Just want to check if there is a better way to achieve it without delete 
and recreate the A record, I couldn't figure out a way to only update the 
current A record using "Set-DnsServerResourceRecord".


---


- hosts: all

  gather_facts: true

  vars: 

dns_name: "test_01"

ip: "10.10.10.13"


  tasks:


  - name: "Check a DNS record"

win_shell: |

  try {

  (Get-DnsServerResourceRecord `

-ZoneName "{{ dns_domain }}" `

-name "{{ dns_name }}" `

-RRType 'A' `

-ErrorAction stop `

-ComputerName "{{ dns_server 
}}").RecordData.IPv4Address.IPAddressToString

  } catch {

write-host "failed"

  }

delegate_to: "{{ mgmt_server }}"

changed_when: false

register: check_out


  - name: DNS output

debug:

  var: check_out.stdout_lines[0]


   - name: Remove static record

 win_dns_record:

   name: "{{ dns_name }}"

   type: "A"

   state: absent

   zone: "{{ dns_domain }}"


   - name: Register

 win_shell: |

   Add-DnsServerResourceRecordA `

   -ZoneName "{{ dns_domain }}" `

   -name "{{ dns_name }}" `

   -AllowUpdateAny `

   -IPv4Address "{{ ip }}" `

   -ComputerName "{{ dns_server }}"

 delegate_to: "{{ mgmt_server }}"

 register: change_out

 throttle: 1


  - name: Change output

debug:

  var: change_out

-- 
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/83b926d6-ecef-427d-8744-3483379410a0%40googlegroups.com.


Re: [ansible-project] Re: Relation between Ansible and SDN

2020-04-20 Thread Karl Auer
Hullo Nabil.

On Mon, 20 Apr 2020 at 13:44, nabil hama  wrote:>
> I have confusion between the utilization of Ansible and  SDN,   As long as
> the

SDN offers network automation, optimization and high flexibility, what is
> the

role of Ansible in that network?  are two different subjects and work
> totally

separately?
>

They are two different subjects and work totally separately. However, if
you can find (or write!) Ansible modules that manipulate SDNs, you could
then use Ansible to do that.

Regards, K.



-- 

*Karl Auer* { manager, systems support }
P: 1300 759 975
E: ka...@2pisoftware.com
2pisoftware.com

GPG/PGP : DF6A 43E5 FB9D D884 C6CA CD7F 5278 212D E80F C107
Previous: 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E

-- 
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/CA%2B%2BT08QiQWrSZ67CRtCBVfKvQxroAXGAY2SmZzq9v667cUH4gA%40mail.gmail.com.


Re: [ansible-project] Relation between Ansible and SDN

2020-04-20 Thread Karl Auer
There is no relationship between Ansible and SDN.

Ansible is a general tool. There may be Ansible modules that allow you to
manipulate particular SDNs.

I suggest you start by googling "Ansible SDN" and see where the journey
takes you.

Regards, K.


On Mon, Apr 20, 2020 at 8:25 PM nabil hama  wrote:

> Hello,
>
> Please, could explain to me, that is the relation between Ansible and SDN,
> how it can work together? with what architecture?
>
> thanks in advance
>
> BR
>
> --
> 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/832c2de3-2a05-4e01-9d16-1bcb6201f5a9%40googlegroups.com
> 
> .
>


-- 

*Karl Auer* { manager, systems support }
P: 1300 759 975
E: ka...@2pisoftware.com
2pisoftware.com

GPG/PGP : DF6A 43E5 FB9D D884 C6CA CD7F 5278 212D E80F C107
Previous: 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E

-- 
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/CA%2B%2BT08SYWKGeYZ_G5oGQAKFdT-89p2wqz1DBi6jwwkZgQAR%2BfA%40mail.gmail.com.


[ansible-project] Re: Loop functionality is failing when i use add_host module inventory in other playbook

2020-04-20 Thread Suresh Karpurapu
I hope that it might be design of the add_host module. Is there any ways to 
disable the BYPASS_HOST_LOOP = True parameter in add_host module to enable 
the iteration or please suggest me if there any other ways to achieve my 
requirement

Regards,
Suresh

On Friday, April 17, 2020 at 7:36:37 PM UTC+5:30, Suresh Karpurapu wrote:
>
> Hi Ansible team,
>
> I am using the CSV file as below for nfs volume migration as we have 1000 
> servers with 100 volumes. Hence, i would like to make to host inventory 
> using add_host file instead using inventory file. However, the loop is 
> failing when i use add_host module, if the server has more than one 
> volume . would anyone please help me on this request as i would like to 
> mount all the volumes on respective servers as per CSV input?
>
> # cat mounts.csv
> host,remote_path,mnt_path,python
>
> host1,nfsflr01:/volahcstg_www_masup_stg_data_01,/myasup/stg/data,/usr/bin/python2.6
>
> host1,nfsflr02:/volahcstg_www_masup_stg_app_01,/myasup/stg/app,/usr/bin/python2.6
>
> host2,nfsflr01:/volahcstg_www_masup_stg_data_01,/myasup/stg/data,/usr/bin/python2.6
>
> host2,nfsflr02:/volahcstg_www_masup_stg_app_01,/myasup/stg/app,/usr/bin/python2.6
>
>
> # cat mounts.yml
> ---
> - name: mount the nfsshare in client side
>   hosts: localhost
>   gather_facts: false
>   become: yes
>   tasks:
> - name: reading volume info from csv
>   read_csv:
> path: "{{ playbook_dir }}/mounts.csv"
>   register: sources
> - name: Grouping host and volume information
>   add_host:
> name: "{{ item.0 }}"
> groups: nfsgroup
> var1: "{{ item.1|json_query('[].remote_path') }}"
> var2: "{{ item.1|json_query('[].mnt_path') }}"
> ansible_python_interpreter: "{{ item.1.0.python }}"
>   loop: "{{ sources.list|groupby('host') }}"
> - name: list the volumes
>   hosts: nfsgroup
>   become: yes
>   gather_facts: false
>   tasks:
> - name: debug output
>   debug:
> msg:
>   - "{{ inventory_hostname }}"
>   - "{{ var1 }}"
>   - "{{ var2 }}"
> - name: mounting the volume in the fstab file
>   hosts: nfsgroup
>   gather_facts: false
>   become: yes
>   tasks:
> - name: mounting the volume in the fstab file
>   mount:
> fstype: nfs
> opts: 
> "rw,bg,hard,rsize=65536,wsize=65536,vers=3,actimeo=0,nointr,suid,timeo=600,tcp"
> dump: "0"
> passno: "0"
> src: "{{ var1[0] }}"
> path: "{{ var2[0] }}"
> state: mounted
>   delegate_to: "{{ inventory_hostname }}"
> ...
>
>
> Result:
>
>
> TASK [Grouping host and volume information] 
> *
> task path: /suresh/suresh_playbooks/mounts.yml:12
>
> creating host via 'add_host': hostname=host1
> changed: [localhost] => (item=[u'host1', [{u'python': 
> u'/usr/bin/python2.6', u'host': u'host1', u'mnt_path': u'/myasup/stg/data', 
> u'remote_path': u'nfsflr01:/volahcstg_www_masup_stg_data_01'}, {u'python': 
> u'/usr/bin/python2.6', u'host': u'host1', u'mnt_path': u'/myasup/stg/app', 
> u'remote_path': u'nfsflr02:/volahcstg_www_masup_stg_app_01'}]]) => {
>
> "add_host": {
> "groups": [
> "nfsgroup"
> ],
> "host_name": "host1",
> "host_vars": {
> "ansible_python_interpreter": "/usr/bin/python2.6",
> "var1": [
> "nfsflr01:/volahcstg_www_masup_stg_data_01",
> "nfsflr02:/volahcstg_www_masup_stg_app_01"
> ],
> "var2": [
> "/myasup/stg/data",
> "/myasup/stg/app"
> ]
>
> }
> },
> "ansible_loop_var": "item",
> "changed": true,
> "item": [
> "host1",
> [
> {
> "host": "host1",
> "mnt_path": "/myasup/stg/data",
> "python": "/usr/bin/python2.6",
> "remote_path": "nfsflr01:/volahcstg_www_masup_stg_data_01"
> },
> {
> "host": "host1",
> "mnt_path": "/myasup/stg/app",
> "python": "/usr/bin/python2.6",
> "remote_path": "nfsflr02:/volahcstg_www_masup_stg_app_01"
> }
> ]
> ]
>
> }
> creating host via 'add_host': hostname=host2
> changed: [localhost] => (item=[u'host2', [{u'python': 
> u'/usr/bin/python2.6', u'host': u'host2', u'mnt_path': u'/myasup/stg/data', 
> u'remote_path': u'nfsflr01:/volahcstg_www_masup_stg_data_01'}, {u'python': 
> u'/usr/bin/python2.6', u'host': u'host2', u'mnt_path': u'/myasup/stg/app', 
> u'remote_path': u'nfsflr02:/volahcstg_www_masup_stg_app_01'}]]) => {
>
> "add_host": {
> "groups": [
> "nfsgroup"
> ],
> "host_name": "host2",
> "host_vars": {
> "ansible_python_interpreter": "/usr/bin/python2.6",
> "var1": [
>  

Re: [ansible-project] Re: Relation between Ansible and SDN

2020-04-20 Thread Dick Visser
Hi

To me this is still too generic.
I'll leave it to someone else to answer.

On Mon, 20 Apr 2020 at 13:44, nabil hama  wrote:
>
>
>
> Le lundi 20 avril 2020 11:25:37 UTC+1, nabil hama a écrit :
>>
>> Hello,
>>
>> Thanks Dick for your feedback.
>
>
> my question is as follow :
>
> I have confusion between the utilization of Ansible and  SDN,   As long as 
> the SDN offers network automation, optimization and high flexibility, what is 
> the role of Ansible in that network?  are two different subjects and work 
> totally separately?
>
> Hope I was more clear
>
> Many thanks in advance
>
>>
>> BR
>
> --
> 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/e3d74e94-40b3-4e96-af87-d2ff6ff3d1e4%40googlegroups.com.



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

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


[ansible-project] How to create Multiple Guest Vms Snapshot

2020-04-20 Thread Arvind kumar
HI, I have Created a playbook to take a snapshot before patching of servers 
but this playbook has only one Guest_vm define so it working perfectly for 
me.

 *- name: Vmware guest snapshot create*
*   hosts: test-hypervisor*

*   tasks:*

*  - name: Create a snapshot*
*vmware_guest_snapshot:*
*   hostname: test-hypervisior*
*   username: root*
*   password: asdfghj123**
*   datacenter: test-hypervisior*
*   folder: " /folder1/localhost.example.com/vm"*
*   name: RJRedhat01*
*   state: present*
*   validate_certs: False*
*   snapshot_name: snap55*
*   description: Test snapshot*
*delegate_to: localhost*
*register: snapshot_info*
*  - name: show the status*
*debug:*
*var: snapshot_info.snapshot_results*


 Above Playbook is working fine for me',  But I have dozens of server 
and I want to create the snapshot of all nodes, I am using * with_item*  
for looping all nodes but it is not working for me. 


My Playbook for Multi vm_guest snapshot creation

*- name: Vmware guest snapshot create*
*   hosts: test-hypervisior*
*   tasks:*

*  - name: Create a snapshot*
*vmware_guest_snapshot:*
*   hostname: test-hypervisior*
*   username: root*
*   password: asdfghj123**
*   datacenter: test-hypervisior*
*   folder: " /folder1/localhost.example.com/vm"*
*   name: "{{ item}}"*
*   with_items:*
*- RJCentos1*
*- RJRedhat01*
*- MAXFAX01*
*   state: present*
*   validate_certs: False*
*   snapshot_name: snap__with_multi_vms*
*   description: snap1_descriptioninnn*
*delegate_to: localhost*
*register: snapshot_info*
*  - name: show the status*
*debug:*
*var: snapshot_info.snapshot_results*



 ansible-playbook vm-snap-c2.yaml -u root -k
SSH password:

PLAY [Vmware guest snapshot create] 
*

TASK [Gathering Facts] 
**
Monday 20 April 2020  07:28:44 -0400 (0:00:00.056)   0:00:00.056 
**
ok: [test-hypervisior]

TASK [Create a snapshot] 

Monday 20 April 2020  07:28:46 -0400 (0:00:02.462)   0:00:02.519 
**
fatal: [test-hypervisior]: FAILED! => {"msg": "The task includes an option 
with an undefined variable.* The error was: 'item' is undefined\n\nThe 
error *appears to be in '/home/akumar/vm/vm-snap-c2.yaml': line 5, column 
9, but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\n\n  - name: Create a 
snapshot\n^ here\n"}

PLAY RECAP 
**
test-hypervisior   : ok=1changed=0unreachable=0
failed=1skipped=0rescued=0ignored=0

Monday 20 April 2020  07:28:47 -0400 (0:00:00.167)   0:00:02.687 
**
===
Gathering Facts 
--
 
2.46s
Create a snapshot 

 
0.17s

-- 
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/635f419e-3788-4396-bb05-9fefae07bf3e%40googlegroups.com.


[ansible-project] win_regedit software restriction HKCU

2020-04-20 Thread Kumaresh kulal
I am working on win_regedit playbook to restrict software.

So far the win_regedit playbook gets created for HKEY_LOCAL_MACHINE below 
is the playbook:

---


- hosts: windows


  tasks:


   - name: Creating a registry


 win_regedit:


  path: 
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun


   - name: Modifying a registry, adding name and data


 win_regedit:


  path: 
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun


  value: 1


  datatype: string


  data: 'cmd.exe'



But Registry is not getting created for HKEY_CURRENT_USER


---


- hosts: windows


  tasks:


   - name: Creating a registry


 win_regedit:


  
path: 
HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun


   - name: Modifying a registry, adding name and data


 win_regedit:


  
path: 
HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun


  value: 1


  datatype: string


  data: 'cmd.exe'



Even tried writing simple registry 


---


- hosts: windows


  tasks:


   - name: Creating a registry


 win_regedit:

  path: HKCU:\Software\MyCompany


Thanks in Advance!!


--

Kumaresh



-- 
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/241948d9-974c-426d-bcb2-917af7f324cd%40googlegroups.com.


[ansible-project] Re: How generate dynamic host file with only IP of concrete vendor (by MAC)

2020-04-20 Thread David Foley
I'm using the following Playbook, which is taken the IP Address Entered 
from the Jenkins Pipeline:

---
  - name: Running Appened To Ansible Host File Playbook
hosts: localhost
connection: local
tasks:
- name: Adding The IP Address of the Newly Created Server to Ansible 
Host File
  blockinfile:
path: /etc/ansible/hosts
block: |

  [win]
  "{{ ip }}"

  [win:vars]
  ansible_user="{{ service }}"
  ansible_password="{{ service_pass}}"
  ansible_connection=winrm
  ansible_winrm_transport=credssp
  ansible_winrm_server_cert_validation=ignore

-- 
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/3af699c5-544b-4251-afee-2594ca969abc%40googlegroups.com.


[ansible-project] Re: Relation between Ansible and SDN

2020-04-20 Thread nabil hama


Le lundi 20 avril 2020 11:25:37 UTC+1, nabil hama a écrit :
>
> Hello,
>
> Thanks Dick for your feedback. 
>

my question is as follow :

I have confusion between the utilization of Ansible and  SDN,   As long as 
the SDN offers network automation, optimization and high flexibility, what 
is the role of Ansible in that network?  are two different subjects and 
work totally separately?
 
Hope I was more clear

Many thanks in advance
 

> BR
>

-- 
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/e3d74e94-40b3-4e96-af87-d2ff6ff3d1e4%40googlegroups.com.


[ansible-project] How to define a register per server

2020-04-20 Thread דודו דודו
Hi,
Have a task that disables Ipv6.  The task should run only if the ipv6 
folder exists.

In order to implement the above, I have 2 tasks, 
the first task checks if a folder exists and saves the output to a 
register, the second task is to disable IPv6 and will run only if the 
register from the last task = true.

If I will run the 2 tasks everything will work because the register will 
reflect the status of the server.  If I will run it on multi-server, my 
*assumption 
*is that the first task will run on all servers and will include the status 
of the lastest te server and the second task will run according to the last 
output.

How can I define a register per server? or maybe my assumption is wrong





- hosts:

  - master
  - gw
  - kafka


  become: true
  gather_facts: False
  tasks:




- name: verify if IPv6 folderexists
  stat:
path: /proc/sys/net/ipv6/
  register: ipv6

- name: diable IPv6 in conf
  sysctl:
name: net.ipv6.conf.all.disable_ipv6
value: '1'
sysctl_set: yes
  when: ipv6.stat.exists == True

- name: diable IPv6 in default
  sysctl:
name: net.ipv6.conf.default.disable_ipv6
value: '1'
sysctl_set: yes
  when: ipv6.stat.exists == True

- name: remove dracut-config-generic
  shell: yum -y remove dracut-config-generic
  register: a
  when: "'master' in group_names" and ipv6.stat.exists == True

- name: Rebuild the initramfs
  shell: dracut -v -f
  register: b
  when: "'master' in group_names" and ipv6.stat.exists == True

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


Re: [ansible-project] How generate dynamic host file with only IP of concrete vendor (by MAC)

2020-04-20 Thread Dick Visser
Take a look at 
https://docs.ansible.com/ansible/latest/plugins/inventory/nmap.html

On Mon, 20 Apr 2020 at 11:56, Michal Šiman  wrote:
>
> Hello to everybody. I would like run ansible playbook on all RPi (raspberry) 
> in our network (at this moment we have around 300 pieces). All RPi have a IP 
> dynamic from DHCP server. My idea is scann complete network found all live 
> IP, get MAC of IP, filter only MAC with RPi vendor and from this IP create a 
> list, dynamic host file. I have ansible on Linux for shure. What you recomend 
> for quick solution? Nmap? Ping by sh from python? I all ready tried some 
> solution but is too slow and non comfortable ... maybe somebody solving 
> similar problem in history. Thx
>
> --
> 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/3bcd8201-71db-4d15-be49-1aa97a700a4d%40googlegroups.com.



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

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


Re: [ansible-project] Relation between Ansible and SDN

2020-04-20 Thread Dick Visser
That is a very generic question - can you be (a lot) more specific?

On Mon, 20 Apr 2020 at 12:25, nabil hama  wrote:
>
> Hello,
>
> Please, could explain to me, that is the relation between Ansible and SDN, 
> how it can work together? with what architecture?
>
> thanks in advance
>
> BR
>
> --
> 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/832c2de3-2a05-4e01-9d16-1bcb6201f5a9%40googlegroups.com.



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

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


[ansible-project] Relation between Ansible and SDN

2020-04-20 Thread nabil hama
Hello,

Please, could explain to me, that is the relation between Ansible and SDN, 
how it can work together? with what architecture?

thanks in advance

BR

-- 
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/832c2de3-2a05-4e01-9d16-1bcb6201f5a9%40googlegroups.com.


[ansible-project] How generate dynamic host file with only IP of concrete vendor (by MAC)

2020-04-20 Thread Michal Šiman
Hello to everybody. I would like run ansible playbook on all RPi 
(raspberry) in our network (at this moment we have around 300 pieces). All 
RPi have a IP dynamic from DHCP server. My idea is scann complete network 
found all live IP, get MAC of IP, filter only MAC with RPi vendor and from 
this IP create a list, dynamic host file. I have ansible on Linux for 
shure. What you recomend for quick solution? Nmap? Ping by sh from python? 
I all ready tried some solution but is too slow and non comfortable ... 
maybe somebody solving similar problem in history. Thx

-- 
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/3bcd8201-71db-4d15-be49-1aa97a700a4d%40googlegroups.com.


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

2020-04-20 Thread Dick Visser
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 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: 

Re: [ansible-project] After failed task on 99% of my server , the rest of the playbook is running only on the 1% servers that passed the tasks

2020-04-20 Thread Stefan Hornburg (Racke)
On 4/20/20 8:33 AM, דודו דודו wrote:
> Hi , 
> I have a main playbook that uses "include" to call other playbooks.
> 
> In one of the playbooks, I have 5 tasks. The second task falls on all my 
> servers except for one server - From that
> point, the entire playbook (main) is running only on that server

That's the normal procedure.

> 
> 1. If a task failed on a server - how can I stop the entire process
> 2. In my case, why the playbook continues to run only on the server that was 
> passed the specific task?
> 

You can abort the whole process on a single failure with

  any_errors_fatal: true

Documentation: 
https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-the-play

Regards
 Racke

> 
> 
> - hosts:
> - postgres1
> - cloudera_manager
> - worker
> - master
> - gw
> - kafka
> - repository
> - kafka_master
> become: true
> vars_files:
> - ./cloudera_environment.yml
> 
> tasks:
> 
> - name: update hostname
> include: hostname-update.yml
> 
> - name: create maintenance user
> include: create_maintenance_user.yml
> 
> - name: OS update for supporting cloudera best practice In this playbook task 
> number 2 is faild on all my servers except
> one server
> 
> include: redhat7_bigdata_best_practice.yml Starting task 3 in till the end of 
> the palybook all tasks are running on that
> specific server
> - name: update repository file
> include: update-yum-repo.yml
> 
> - name: Install rpm packages
> include: install-package.yml
> 
> 
> ## Install Openjdk 11 ##
> - hosts:
> - postgres1
> - cloudera_manager
> - worker
> - master
> - gw
> - repository
> 
> become: true
> vars_files:
> - ./cloudera_environment.yml
> 
> tasks:
> 
> - name: Install rpm packages
> include: install-java11-package.yml
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/384caf13-5c89-4edd-acbf-f10b70312f68%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/a3d991c5-5fdc-f371-d52d-0f0fb6e5e3ea%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[ansible-project] After failed task on 99% of my server , the rest of the playbook is running only on the 1% servers that passed the tasks

2020-04-20 Thread דודו דודו
Hi , 
I have a main playbook that uses "include" to call other playbooks.

In one of the playbooks, I have 5 tasks. The second task falls on all my 
servers except for one server - From that point, the entire playbook (main) 
is running only on that server

1. If a task failed on a server - how can I stop the entire process
2. In my case, why the playbook continues to run only on the server that 
was passed the specific task?



- hosts:
- postgres1
- cloudera_manager
- worker
- master
- gw
- kafka
- repository
- kafka_master
  become: true
  vars_files:
- ./cloudera_environment.yml

  tasks:

  - name: update hostname
include: hostname-update.yml

  - name: create maintenance user
include: create_maintenance_user.yml

  - name: OS update for supporting cloudera best practice  In this playbook 
task number 2 is faild on all my servers except one server

include: redhat7_bigdata_best_practice.yml Starting task 3 
in till the end of the palybook all tasks are running on that
   specific server
  - name: update repository file
include: update-yum-repo.yml

  - name: Install rpm packages
include: install-package.yml


## Install Openjdk 11 ##
- hosts:
- postgres1
- cloudera_manager
- worker
- master
- gw
- repository

  become: true
  vars_files:
- ./cloudera_environment.yml

  tasks:

  - name: Install rpm packages
include: install-java11-package.yml

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