[ansible-project] How to configure windows server with ansible using yml

2019-02-19 Thread rajendar t
Hi All,

1)How to turn off IE enhanced security using ansible 
2) is there any I can configure user account in Windows server by using yml


Thanks
Rajedar


-- 
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/473c88fd-0595-47e8-b703-d40cd2d308ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Hostname mismatch: node X believes its host is different

2019-02-19 Thread mrplainswalker
Oops, sorry. I sent this to the wrong place.

On Tuesday, February 19, 2019 at 12:51:57 PM UTC-8, Jordan Borean wrote:
>
> This doesn't sound like an issue with Ansible but something specific to 
> RabbitMQ. You are better off asking those communities for help with this.
>
> Thanks
>
> Jordan
>

-- 
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/83e2f227-642d-4f81-8350-946bba992fbe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] simple IP lookup plugin

2019-02-19 Thread Kai Stian Olstad
On 19.02.2019 21:31, Michael Ströder wrote:
> Is there a simple example module how to implement an ansible (connection) 
> plugin for looking up an IP address for establishing the SSH connection?
> 
> I have a deployment where no DNS entries are present prior to initial host 
> configuration, but I can access another (LDAP) database to query the IP 
> address by inventory_hostname.
> 
> Not sure whether I need a full-blown connection plugin [1] for this.

It probably easier to create[1] you own inventory plugin[2] so you can populate 
the ansible_host with the IP.


[1] https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html
[2] https://docs.ansible.com/ansible/latest/plugins/inventory.html


-- 
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 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/5e4e58de-0fd4-ccdf-1bc9-13aed770426c%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Hostname mismatch: node X believes its host is different

2019-02-19 Thread Jordan Borean
This doesn't sound like an issue with Ansible but something specific to 
RabbitMQ. You are better off asking those communities for help with this.

Thanks

Jordan

-- 
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/e417f982-a430-4f48-b5fc-e49068112bbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] simple IP lookup plugin

2019-02-19 Thread Michael Ströder

HI!

Is there a simple example module how to implement an ansible 
(connection) plugin for looking up an IP address for establishing the 
SSH connection?


I have a deployment where no DNS entries are present prior to initial 
host configuration, but I can access another (LDAP) database to query 
the IP address by inventory_hostname.


Not sure whether I need a full-blown connection plugin [1] for this.

Ciao, Michael.

[1] https://docs.ansible.com/ansible/latest/plugins/connection.html

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To 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/53a15522-4ce7-81e8-1272-82d3250be204%40stroeder.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Getting MemoryError when executing task hdfs dfs -format; how to fix / troubleshoot?

2019-02-19 Thread dgoldenberg
We have a task in our Ansible based deploy which performs formatting of 
HDFS using the hdfs dfs -format command.

This command causes a MemoryError.  We can see that there is a Python 
process on the target box which gobbles up ~32GB of memory and then the 
failure occurs.

How can we troubleshoot this further?

Also, any ideas/recommendations on how to manage Ansible's memory usage? 
I'm peeking into ansible_memtotal_mb... any config settings to look at or 
adjust?

Thanks,
- Dmitry

-- 
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/1fb8ee40-c1f6-4cf3-bb0d-e7a62d30f4aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] optional template?

2019-02-19 Thread Guy Matz
Hi!  I am installing some packages based on a list, and I would like to put
a config file in place for each package, however I would like the config
file to be optional.  For example, if I have this list of packages to
install:
pkgs:
 - a
 - b
 - c

I have code that install the pkgs, and I would like to put a template in
place for any packages that require it, which means that I would like to
loop through the pkgs var and render the templates a.conf.j2, b.conf.j2 and
c.conf.j2.  But if I add a package d, that does not require a template, I
don't want to have to put an empty template in place . . .  I could use
'failed_when: false' but that will not complain if the jinja in the
template is bad or a var is missing . . .  so is there a way to specify the
errors that are acceptable, e.g. missing template?  or a way to specify
which errors can be ignored with 'ignore_errors'?

Thanks!!

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


[ansible-project] Keys for role names in "roles:" section

2019-02-19 Thread Rich Fletcher
At some point in the past, the documentation specified that role names (for 
roles with arguments) in the roles: section were indicated by a name: key. Now, 
the documentation examples show that role names in that section are indicated 
by a "role:" key. Both syntaxes seem to work in 2.7, but: when did it change, 
is there documentation on it, and will the old syntax be deprecated?

-- 
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/dca44545-b92a-48a7-b7fd-44746829ed6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Hostname mismatch: node X believes its host is different

2019-02-19 Thread mrplainswalker
Hi All,

I realize that this topic is incredibly popular and I've gone through about 
10 others talking about the same thing, but nothing they suggest seems to 
work, so here's another one...

I have Erlang OTP 20.2 and RabbitMQ 3.7.3 installed on 2 fresh virtual 
machines running Windows Server 2016 with all latest updates. I copy the 
cookie file from {machine1} at C:\Windows\System32\config\systemprofile to 
machine 1 at C:Users\{User}. I also copy the cookie file to those same 
directories on {machine2}. I restart the machines (I probably only need to 
restart the process, but just to be sure). I triple check to make sure all 
the cookie files are identical. They are.

I run rabbitmqctl stop_app on {machine1}. I run rabbitmqctl join_cluster 
rabbit@{machine2}. I get the following output:

Clustering node rabbit@{machine1} with rabbit@{machine2}
Error: unable to perform an operation on node 'rabbit@{machine2}'. Please 
see diagnostics information and suggestions below.

Most common reasons for this are:

 * Target node is unreachable (e.g. due to hostname resolution, TCP 
connection or firewall issues)
 * CLI tool fails to authenticate with the server (e.g. due to CLI tool's 
Erlang cookie not matching that of the server)
 * Target node is not running

In addition to the diagnostics info below:

 * See the CLI, clustering and networking guides on 
http://rabbitmq.com/documentation.html to learn more
 * Consult server logs on node rabbit@{machine2}

DIAGNOSTICS
===

attempted to contact: ['rabbit@{machine2}']

rabbit@{machine2}:
  * connected to epmd (port 4369) on {machine2}
  * epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool 
traffic
  * TCP connection succeeded but Erlang distribution failed

  * Hostname mismatch: node "rabbit@{machine2}" believes its host is 
different. Please ensure that hostnames resolve the same way locally and on 
"rabbit@{machine2}"


Current node details:
 * node name: 'rabbitmqcli40@{machine1}'
 * effective user's home directory: C:\Users\{username}
 * Erlang cookie hash: {cookiehash}


I've also triple checked that the machine names are correct by running the 
"hostname" command and also by running "echo %computername%. I've also 
tried connecting in the other direction, and I've verified that the cookies 
have the same hash in the output. Nothing works. I cannot understand what 
the problem is. Does anybody have any idea what's going on, or could at 
least suggest a checklist of things to look for? I've read the entire page 
about clustering. It didn't help.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/51874508-20bf-4010-b243-d68c29cdb064%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Getting error in using register module

2019-02-19 Thread sajal tiwari
Below is the output from the command.

DEFAULT_MODULE_PATH(/etc/ansible/ansible.cfg) = [u'/usr/share/my_modules', 
u'/opt/rh/python27/root/usr/lib/python2.7/site-packages/icontrol', 
u'/usr/lib/python2.7/site-packages/ansible/utils/module_docs_fragments'] 

DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = [u'/etc/ansible/roles', 
u'/usr/share/ansible/roles'] 
PARAMIKO_HOST_KEY_AUTO_ADD(/etc/ansible/ansible.cfg) = True 

On Tuesday, February 19, 2019 at 10:37:53 PM UTC+5:30, Matt Martz wrote:
>
> The problem for whatever reason, is that ansible has been instructed to 
> look in 
> /opt/rh/python27/root/usr/lib/python2.7/site-packages/setuptools/command/ 
> for ansible modules.
>
> It located a file named register.py in that directory, and it is causing 
> issues with ansible.
>
> You may have some misconfiguration that is causing this, and using 
> `ansible-config dump --only-changed` may reveal the issue.
>
> On Tue, Feb 19, 2019 at 11:03 AM sajal tiwari  > wrote:
>
>> The script being used.
>>
>> # For Cisco Devices
>>  - hosts: Cisco_SW
>>gather_facts: true
>>connection: local
>>
>>
>>tasks:
>>  - name: show run
>>ios_command:
>>  commands:
>>- show run
>>  host: "{{ ansible_host }}"
>>  username: "{{ un }}"
>>  password: "{{ pwd }}"
>>register: config
>>
>>  - name: save output to /etc/ansible/backups
>>copy:
>>  content: "{{ config.stdout[0] }}"
>>  dest: "/etc/ansible/backups/show_run_{{ inventory_hostname 
>> }}_{{ansible_date_time.date}}.txt"
>>
>>
>> On Tuesday, February 19, 2019 at 10:24:27 PM UTC+5:30, sajal tiwari wrote:
>>>
>>> Hello,
>>> I am getting below error while using register module with network 
>>> modules(ios_command & nxos_command).
>>> Can someone help on the issue.
>>>
>>> ERROR! Module "register" shadows the name of a reserved keyword. Please 
>>> rename or remove this module. Found at 
>>> /opt/rh/python27/root/usr/lib/python2.7/site-packages/setuptools/command/register.py
>>>
>> -- 
>> 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-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/4499d37c-b9f8-4c85-ab3f-e2a608f4dbf2%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/303266db-adc6-4b70-ba54-5b4dccde6aeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Loop over two lists variables in inventory file via jinja2 -- similar to zip() function in python

2019-02-19 Thread Ansar Sahit
Just to add/explain more.

The jinja2 template should create an yaml with two stanzas per host, with
first stanza containing first value of var1 n var2

And second stanza with second value of var1 n var2.

So entire yaml generated in this way will have two stanza per host

---
yamlinput:
- Stanza1
- stanza2
Etc


On Feb 19, 2019 11:02 PM,  wrote:

> my inventory file is like below with more additional group_vars and
> host_vars that I havent mentioned here for simplicity:
>  I dont want to use host_vars as of now.
>
> [qa]
> host1 var1='["hi" , "xy"]' var2=[435345, 3425634]
> host1 var2='["asd" , "er"]' var2=[212, 456]
> host1 var3='["zxc" , "ghhj"]' var2=[567, 80]
> host1 var4='["hi" , "hhj"]' var2=[435, 980]
>
> Im trying to create a yml file out of this via jinja2
>
> {{% for host in groups['qa'] %}}
> host: {{ host }}
> params:
> {{% for i,j in zip(var1,var2) %}} --> Im not sure how to achieve something
> like this in jinja2. Can someone please guide?
>  app: {{ i }
>  port: {{ j }}
>
>
>
>
> --
> 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/7198676d-a907-4b81-af69-85a75628cafa%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Loop over two lists variables in inventory file via jinja2 -- similar to zip() function in python

2019-02-19 Thread Ansar Sahit
Just to add/explain more.

The jinja2 template with create an yaml with two stanzas per host, with
first stanza containing first value of var1 n var2

And second stanza with second value of var1 n var2.

So entire yaml generated in this way will have two stanza per host

---
yamlinput:
- Stanza1
- stanza2
Etc


On Feb 19, 2019 11:02 PM,  wrote:

my inventory file is like below with more additional group_vars and
host_vars that I havent mentioned here for simplicity:
 I dont want to use host_vars as of now.

[qa]
host1 var1='["hi" , "xy"]' var2=[435345, 3425634]
host1 var2='["asd" , "er"]' var2=[212, 456]
host1 var3='["zxc" , "ghhj"]' var2=[567, 80]
host1 var4='["hi" , "hhj"]' var2=[435, 980]

Im trying to create a yml file out of this via jinja2

---

yamlinput:
- {{% for host in groups['qa'] %}}

   host: {{ host }}
   params:
   {{% for i,j in zip(var1,var2) %}} --> Im not sure how to achieve
something like this in jinja2. Can someone please guide?
   app: {{ i }
   port: {{ j }}




-- 
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/7198676d-a907-4b81-af69-85a75628cafa%40googlegroups.
com

.
For more options, visit https://groups.google.com/d/optout.

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


[ansible-project] Loop over two lists variables in inventory file via jinja2 -- similar to zip() function in python

2019-02-19 Thread sahitansar
my inventory file is like below with more additional group_vars and 
host_vars that I havent mentioned here for simplicity:
 I dont want to use host_vars as of now.

[qa]
host1 var1='["hi" , "xy"]' var2=[435345, 3425634]
host1 var2='["asd" , "er"]' var2=[212, 456]
host1 var3='["zxc" , "ghhj"]' var2=[567, 80]
host1 var4='["hi" , "hhj"]' var2=[435, 980]

Im trying to create a yml file out of this via jinja2

{{% for host in groups['qa'] %}}
host: {{ host }}
params:
{{% for i,j in zip(var1,var2) %}} --> Im not sure how to achieve something 
like this in jinja2. Can someone please guide?
 app: {{ i }
 port: {{ j }}




-- 
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/7198676d-a907-4b81-af69-85a75628cafa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Getting error in using register module

2019-02-19 Thread Matt Martz
The problem for whatever reason, is that ansible has been instructed to
look in
/opt/rh/python27/root/usr/lib/python2.7/site-packages/setuptools/command/
for ansible modules.

It located a file named register.py in that directory, and it is causing
issues with ansible.

You may have some misconfiguration that is causing this, and using
`ansible-config dump --only-changed` may reveal the issue.

On Tue, Feb 19, 2019 at 11:03 AM sajal tiwari  wrote:

> The script being used.
>
> # For Cisco Devices
>  - hosts: Cisco_SW
>gather_facts: true
>connection: local
>
>
>tasks:
>  - name: show run
>ios_command:
>  commands:
>- show run
>  host: "{{ ansible_host }}"
>  username: "{{ un }}"
>  password: "{{ pwd }}"
>register: config
>
>  - name: save output to /etc/ansible/backups
>copy:
>  content: "{{ config.stdout[0] }}"
>  dest: "/etc/ansible/backups/show_run_{{ inventory_hostname
> }}_{{ansible_date_time.date}}.txt"
>
>
> On Tuesday, February 19, 2019 at 10:24:27 PM UTC+5:30, sajal tiwari wrote:
>>
>> Hello,
>> I am getting below error while using register module with network
>> modules(ios_command & nxos_command).
>> Can someone help on the issue.
>>
>> ERROR! Module "register" shadows the name of a reserved keyword. Please
>> rename or remove this module. Found at
>> /opt/rh/python27/root/usr/lib/python2.7/site-packages/setuptools/command/register.py
>>
> --
> 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/4499d37c-b9f8-4c85-ab3f-e2a608f4dbf2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

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


[ansible-project] Re: Getting error in using register module

2019-02-19 Thread sajal tiwari
The script being used.

# For Cisco Devices
 - hosts: Cisco_SW
   gather_facts: true
   connection: local


   tasks:
 - name: show run
   ios_command:
 commands:
   - show run
 host: "{{ ansible_host }}"
 username: "{{ un }}"
 password: "{{ pwd }}"
   register: config

 - name: save output to /etc/ansible/backups
   copy:
 content: "{{ config.stdout[0] }}"
 dest: "/etc/ansible/backups/show_run_{{ inventory_hostname 
}}_{{ansible_date_time.date}}.txt"


On Tuesday, February 19, 2019 at 10:24:27 PM UTC+5:30, sajal tiwari wrote:
>
> Hello,
> I am getting below error while using register module with network 
> modules(ios_command & nxos_command).
> Can someone help on the issue.
>
> ERROR! Module "register" shadows the name of a reserved keyword. Please 
> rename or remove this module. Found at 
> /opt/rh/python27/root/usr/lib/python2.7/site-packages/setuptools/command/register.py
>

-- 
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/4499d37c-b9f8-4c85-ab3f-e2a608f4dbf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Getting error in using register module

2019-02-19 Thread Karthik Chandrashekar
If you could show your code that would be much better to understand.

On Tue, 19 Feb, 2019, 10:24 PM sajal tiwari  Hello,
> I am getting below error while using register module with network
> modules(ios_command & nxos_command).
> Can someone help on the issue.
>
> ERROR! Module "register" shadows the name of a reserved keyword. Please
> rename or remove this module. Found at
> /opt/rh/python27/root/usr/lib/python2.7/site-packages/setuptools/command/register.py
>
> --
> 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/cfc7b1ce-928f-4bcb-bfcd-75fb4ce0dc76%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


[ansible-project] Getting error in using register module

2019-02-19 Thread sajal tiwari
Hello,
I am getting below error while using register module with network 
modules(ios_command & nxos_command).
Can someone help on the issue.

ERROR! Module "register" shadows the name of a reserved keyword. Please 
rename or remove this module. Found at 
/opt/rh/python27/root/usr/lib/python2.7/site-packages/setuptools/command/register.py

-- 
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/cfc7b1ce-928f-4bcb-bfcd-75fb4ce0dc76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
Thank you so much for the explanation.

-- 
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/a7efc837-e763-4e1d-b4d4-3789c7f91849%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Kai Stian Olstad

On 19.02.2019 17:07, Pandu jh wrote:
If possible could you please explain the syntax, It will be very 
helpful

for me to use it in other cases.


I could try, not sure if it's understandable

Just split it in multiple lines

[1] {{ host_fqdn
[2] if 'lab.com' in host_fqdn
[3] else
[4] host_fqdn ~ '.lab.com' }}

[2]
If the variable host_fqdn contains the string lab.com the choose [1].

[3]
If the variable host_fqdn dosen't contains the string lab.com the choose 
[4]


[4]
Tilde is used to concatenate two strings.
So this will concatenate the content of variable fqdn_host with the 
string .lab.com



You can also use the Ansible ternary filter

{{ ('lab.com' in host_fqdn) | ternary(host_fqdn, host_fqdn ~ '.lab.com') 
}}



--
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 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/4d72e2a2bf89f1adcfcb3799fef1413e%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
If possible could you please explain the syntax, It will be very helpful 
for me to use it in other cases.

On Tuesday, 19 February 2019 21:36:41 UTC+5:30, Pandu jh wrote:
>
> Sorry my bad, it missed it. it's working perfectly now, Thanks much !!
>
> TASK [debug] 
> ***
> ok: [rchtest01] => {
> "host_fqdn": "rchtest01.lab.com"
> }
>
>
>
> On Tuesday, 19 February 2019 21:33:26 UTC+5:30, Kai Stian Olstad wrote:
>>
>> On 19.02.2019 16:57, Pandu jh wrote: 
>> > This was the error. 
>> > 
>> > TASK [set_fact] 
>> > 
>> 
>>  
>>
>> > fatal: [rchtest01]: FAILED! => {"msg": "template error while templating 
>> > string: expected token 'end of print statement', got 'string'. String: 
>> > {{ 
>> > host_fqdn if 'lab.com' in host_fqdn else host_fqdn  '.lab.com' }}"} 
>>
>> You are missing the tilde ~ in you syntax, check my previous mail and 
>> you'll see the tilde. 
>>
>> -- 
>> 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 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/4dce5b45-2afe-4867-8fc9-eddd67bfa137%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
Sorry my bad, it missed it. it's working perfectly now, Thanks much !!

TASK [debug] 
***
ok: [rchtest01] => {
"host_fqdn": "rchtest01.lab.com"
}



On Tuesday, 19 February 2019 21:33:26 UTC+5:30, Kai Stian Olstad wrote:
>
> On 19.02.2019 16:57, Pandu jh wrote: 
> > This was the error. 
> > 
> > TASK [set_fact] 
> > 
> 
>  
>
> > fatal: [rchtest01]: FAILED! => {"msg": "template error while templating 
> > string: expected token 'end of print statement', got 'string'. String: 
> > {{ 
> > host_fqdn if 'lab.com' in host_fqdn else host_fqdn  '.lab.com' }}"} 
>
> You are missing the tilde ~ in you syntax, check my previous mail and 
> you'll see the tilde. 
>
> -- 
> 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 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/61fbdefb-837b-4ada-a621-0a747bdfdd30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Kai Stian Olstad

On 19.02.2019 16:57, Pandu jh wrote:

This was the error.

TASK [set_fact]

fatal: [rchtest01]: FAILED! => {"msg": "template error while templating
string: expected token 'end of print statement', got 'string'. String: 
{{

host_fqdn if 'lab.com' in host_fqdn else host_fqdn  '.lab.com' }}"}


You are missing the tilde ~ in you syntax, check my previous mail and 
you'll see the tilde.


--
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 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/495b809fe117dedde1771376525a6fdb%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
This was the error.

TASK [set_fact] 

fatal: [rchtest01]: FAILED! => {"msg": "template error while templating 
string: expected token 'end of print statement', got 'string'. String: {{ 
host_fqdn if 'lab.com' in host_fqdn else host_fqdn  '.lab.com' }}"}


On Tuesday, 19 February 2019 21:24:38 UTC+5:30, Kai Stian Olstad wrote:
>
> On 19.02.2019 16:49, Pandu jh wrote: 
> > Can you please confirm, if the below syntax is correct. I am getting 
> > error. 
> > 
> > vars_prompt: 
> >   - name: host_fqdn 
> > prompt: Enter Hostname of a new VM 
> > private:  no 
> > tasks: 
> >   - set_fact: 
> >   host_fqdn:  "{{ host_fqdn if 'lab.com' in host_fqdn else 
> > host_fqdn '.lab.com' }}" 
> >   - debug:  var=host_fqdn 
>
> What is the error then? We are not psychic. 
>
> -- 
> 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 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/1470cf8c-13b1-4755-9a75-44310bf3dfb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Kai Stian Olstad

On 19.02.2019 16:49, Pandu jh wrote:
Can you please confirm, if the below syntax is correct. I am getting 
error.


vars_prompt:
  - name: host_fqdn
prompt: Enter Hostname of a new VM
private:  no
tasks:
  - set_fact:
  host_fqdn:  "{{ host_fqdn if 'lab.com' in host_fqdn else
host_fqdn '.lab.com' }}"
  - debug:  var=host_fqdn


What is the error then? We are not psychic.

--
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 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/d61a6547cb616a7751bb148fec5f0d05%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
Can you please confirm, if the below syntax is correct. I am getting error.

vars_prompt:
  - name: host_fqdn
prompt: Enter Hostname of a new VM
private:  no
tasks:
  - set_fact:
  host_fqdn:  "{{ host_fqdn if 'lab.com' in host_fqdn else 
host_fqdn '.lab.com' }}"
  - debug:  var=host_fqdn


On Tuesday, 19 February 2019 21:11:59 UTC+5:30, Kai Stian Olstad wrote:
>
> On 19.02.2019 15:41, Pandu jh wrote: 
> > Search keyword in "host_fqdn" variable. If the value has "lab.com" 
> > keyword 
> > in it, it should directly store the value to "host_fqdn" again 
> > or else it should add "lab.com" keyword to the value and store it to 
> > "host_fqdn" variable. Please assist. 
> > 
> > vars: 
> > host_fqdn:  server 
> > host_fqdn: | 
> > {%  if  'lab.com' in {{  host_fqdn }} %} 
> > {%  host_fqdn = "{{ host_fqdn }}" %} 
> > {% else %} 
> > {%  host_fqdn = "{{ host_fqdn }}.lab.com" %} 
> > {%  endif %} 
>
> I'm pretty sure you can't use Jinja in vars like that, but you can have 
> a set_fact task like this 
>
>- set_fact: 
>host_fqdn: "{{ host_fqdn if 'lab.com' in host_fqdn else host_fqdn 
> ~ '.lab.com' }}" 
>
> -- 
> 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 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/35da7c17-d4f7-44c7-bb34-ff49247c894e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Kai Stian Olstad

On 19.02.2019 15:41, Pandu jh wrote:
Search keyword in "host_fqdn" variable. If the value has "lab.com" 
keyword

in it, it should directly store the value to "host_fqdn" again
or else it should add "lab.com" keyword to the value and store it to
"host_fqdn" variable. Please assist.

vars:
host_fqdn:  server
host_fqdn: |
{%  if  'lab.com' in {{  host_fqdn }} %}
{%  host_fqdn = "{{ host_fqdn }}" %}
{% else %}
{%  host_fqdn = "{{ host_fqdn }}.lab.com" %}
{%  endif %}


I'm pretty sure you can't use Jinja in vars like that, but you can have 
a set_fact task like this


  - set_fact:
  host_fqdn: "{{ host_fqdn if 'lab.com' in host_fqdn else host_fqdn 
~ '.lab.com' }}"


--
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 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/7fee47a5a5e95025751d0e7b0d05206a%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] If condition in ansible jinja2 template

2019-02-19 Thread Pandu jh
Search keyword in "host_fqdn" variable. If the value has "lab.com" keyword 
in it, it should directly store the value to "host_fqdn" again
or else it should add "lab.com" keyword to the value and store it to  
"host_fqdn" variable. Please assist.

vars:
host_fqdn:  server
host_fqdn: |
{%  if  'lab.com' in {{  host_fqdn }} %}
{%  host_fqdn = "{{ host_fqdn }}" %}
{% else %}
{%  host_fqdn = "{{ host_fqdn }}.lab.com" %}
{%  endif %}

-- 
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/760684e2-abe8-446b-8204-285210683548%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Having problems with a variable in vars_files

2019-02-19 Thread Adrian Sebastian Dutu
Can you run your playbook with -vvv then post the output? It's probably 
going to be a lot, so use https://pastebin.com/ .
Check if beforehand for any sensitive information.

-- 
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/d9df9905-0b23-4609-bee3-898970ed1f56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible vs. multiple Azure subscriptions

2019-02-19 Thread Wawrzek Niewodniczanski
On Tue, 19 Feb 2019 at 11:08, ameya agashe  wrote:
> On Tue, Feb 19, 2019 at 8:47 PM Wawrzek Niewodniczanski  
> wrote:
[...]
>> I have Azure with multiple subscriptions and I wonder what's the best
>> way to switch between them.
[...]
>> How do you deal with this?

> Not sure how you deal but for me Azure CLI az login works best, login and 
> just choose current subscription which you want to work on. Just change the 
> current default subscription. Did you try with this approach? I liked this 
> one. From memory, I don't think I created Service Principal for Ansible but 
> yes for Terraform.

Thanks for suggestions. For now, I added my SP to another
subscription. Now can switch between them using `AZURE_PROFILE`
environment variable. A powerful (and scary) thing is that I can have
two different subscriptions in two different shells.

Thanks,
Wawrzek

-- 
Dr  Wawrzyniec Niewodniczańskior Wawrzek for short
  PhD in Quantum Chemistry  & MSc in Molecular Engineering
   WWW: http://wawrzek.name E-MAIL: j...@wawrzek.name
  Linux User #177124

-- 
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/CAC7-vpCT4F1oBKn3%2BEN%2B3Oi7dn-PzdD44g6VpW%3D7-yw97C75GQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible vs. multiple Azure subscriptions

2019-02-19 Thread Jean-Yves LENHOF

Le 2019-02-19 10:46, Wawrzek Niewodniczanski a écrit :

Hi,

I have Azure with multiple subscriptions and I wonder what's the best
way to switch between them. The main two methods described in docs
are:
- password, but I don't see a way to distinguish subscription
- service principal, I still trying to figure out if I can use the
same SP in many subscriptions.

How do you deal with this?

Wawrzek




Hi,

Perhaps, you can use environment to pass the good variables to the 
relevant parts of your playbooks :

https://docs.ansible.com/ansible/latest/user_guide/playbooks_environment.html

Regards,

JYL

--
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/dcfd5c10dd196a8d435864fcd91d912a%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible vs. multiple Azure subscriptions

2019-02-19 Thread ameya agashe
Not sure how you deal but for me Azure CLI az login works best, login and
just choose current subscription which you want to work on. Just change the
current default subscription. Did you try with this approach? I liked this
one. From memory, I don't think I created Service Principal for Ansible but
yes for Terraform.

Ameya

On Tue, Feb 19, 2019 at 8:47 PM Wawrzek Niewodniczanski 
wrote:

> Hi,
>
> I have Azure with multiple subscriptions and I wonder what's the best
> way to switch between them. The main two methods described in docs
> are:
> - password, but I don't see a way to distinguish subscription
> - service principal, I still trying to figure out if I can use the
> same SP in many subscriptions.
>
> How do you deal with this?
>
> Wawrzek
>
> Link to docs:
>
> https://docs.ansible.com/ansible/latest/scenario_guides/guide_azure.html#providing-credentials-to-azure-modules
>
> --
> Dr  Wawrzyniec Niewodniczańskior Wawrzek for short
>   PhD in Quantum Chemistry  & MSc in Molecular Engineering
>WWW: http://wawrzek.name E-MAIL: j...@wawrzek.name
>   Linux User #177124
>
> --
> 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/CAC7-vpCXuF2BfM71md9yP2ukg8GAnBnbpd6zPXgvSHvYM%2BfWwA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


[ansible-project] Ansible vs. multiple Azure subscriptions

2019-02-19 Thread Wawrzek Niewodniczanski
Hi,

I have Azure with multiple subscriptions and I wonder what's the best
way to switch between them. The main two methods described in docs
are:
- password, but I don't see a way to distinguish subscription
- service principal, I still trying to figure out if I can use the
same SP in many subscriptions.

How do you deal with this?

Wawrzek

Link to docs:
https://docs.ansible.com/ansible/latest/scenario_guides/guide_azure.html#providing-credentials-to-azure-modules

-- 
Dr  Wawrzyniec Niewodniczańskior Wawrzek for short
  PhD in Quantum Chemistry  & MSc in Molecular Engineering
   WWW: http://wawrzek.name E-MAIL: j...@wawrzek.name
  Linux User #177124

-- 
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/CAC7-vpCXuF2BfM71md9yP2ukg8GAnBnbpd6zPXgvSHvYM%2BfWwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.