Re: [ansible-project] Using include_vars and with_items with optiona files == bug?

2017-07-10 Thread Brian Coca
Well, this is not include_vars behaviour but 'merge loop results
behaviour' that affects all modules as this is result processing.

The other part of 'saving intermediate results' would also affect all tasks.

I doubt either will change in the future.


--
Brian Coca

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


Re: [ansible-project] Using include_vars and with_items with optiona files == bug?

2017-07-10 Thread Dan Linder
I'm falling back to the six tasks for now (three stat file, three include 
when exists).

In my mind this is a bug; the "ignore_errors" setting should let it keep 
the partial result.  The parallel being that the file module could 
partially succeed in setting a file owner but SELinux or other methods 
could deny the setting of the file group.

But I'll agree to disagree with you on that point. :-)

I could see the addition of the "hash_behavior" as an argument to 
"include_vars" and let it have the option of "keep_partial" as an extension 
of merge (replace, merge, merge_partial).

On Monday, July 10, 2017 at 3:39:29 PM UTC-5, Brian Coca wrote:
>
> The merge setting will affect the result of the task, but not the 
> internal iterator of the task. 
>
> You might want to make this 3 tasks or use vars_files. 
>
>
> -- 
> -- 
> Brian Coca 
>

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


Re: [ansible-project] Ansible log_path to also include the command line that invoked ansible-playbook?

2017-07-10 Thread Kai Stian Olstad

On 10. juli 2017 22:39, burns...@umn.edu wrote:

It does a great job of tracking tasks and status, but I can't see the
command itself. Would be helpful to know if a tag was skipped, command line
var was passed, or other command line change that isn't immediately clear
by the output.


I recommend taking a look at ARA: Ansible Run Analysis
https://github.com/openstack/ara

--
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/97735a47-48fd-ee92-ca00-7a1ff67a8bd9%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible Windows: Add account to group administrators FR/US

2017-07-10 Thread Jordan Borean
Hey

One thing you can do is use the win_region 
module https://docs.ansible.com/ansible/win_region_module.html to change 
the region of your hosts to a common value. If this isn't what you can do, 
you can also run an adhoc command to determine the group name based on the 
SID. Give the below tasks a shot and see if it returns what you are looking 
for.

- name: get group name from sid
>   win_command: powershell.exe "((New-Object 
> System.Security.Principal.SecurityIdentifier('S-1-5-32-544')).Translate([System.Security.Principal.NTAccount]).Value
>  
> -split '\\')[1]"
>   register: admin_group 

- debug:
> var: admin_group.stdout_lines[0]


It looks up the group name based on the SID 'S-1-5-32-544' which is the 
default SID for the local administrators group and should be consistent 
across all Windows OS'.

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/1e2becfc-23ab-405a-bd57-3fc4730d64e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible log_path to also include the command line that invoked ansible-playbook?

2017-07-10 Thread burns498
Question - Is it also possible for Ansible log_path 
to log 
the actual command that was used to invoke the ansible-playbook?

It does a great job of tracking tasks and status, but I can't see the 
command itself. Would be helpful to know if a tag was skipped, command line 
var was passed, or other command line change that isn't immediately clear 
by the output.

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/d7f7fa3a-058c-4043-89b9-bc16903a506f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Using include_vars and with_items with optiona files == bug?

2017-07-10 Thread Brian Coca
The merge setting will affect the result of the task, but not the
internal iterator of the task.

You might want to make this 3 tasks or use vars_files.


-- 
--
Brian Coca

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


Re: [ansible-project] Using include_vars and with_items with optiona files == bug?

2017-07-10 Thread Dan Linder
I forgot to add that I've defined the hash_behaviour to "merge" just for 
this express purpose of keeping and stacking/appending variables so the 
normal behavior is suppose to be modified here.

On Monday, July 10, 2017 at 2:59:22 PM UTC-5, Brian Coca wrote:
>
> Well, when you include_vars you are normally overwriting existing 
> vars, this will happen in a with_ loop or outside of it, that is 
> normal behaviour. 
>
> As for the error wiping out myvars ... the task failed, so none of the 
> work was done. The previously accumulated data in the 2 files that did 
> work is lost as the task ends up not importing any vars as it failed 
> as a whole, even if parts of it succeeded. 
>
> -- 
> Brian Coca 
>

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


[ansible-project] Re: Add user to "administrators" group or "administrateurs" group

2017-07-10 Thread 'J Hawkesworth' via Ansible Project

I suggest you run the 'setup' module against your hosts, and use one of the 
facts to find out if the machine is FS or US.

For windows hosts, ansible_facts.ansible_env.USERNAME might be enough.   If 
that isn't enough, on windows hosts you can use the Get-Culture cmdlet to 
find out which culture is current on your host.  Something like this.

- name: culture test
  hosts: 12,
  gather_facts: false
  tasks:
- name: get culture
  win_shell: Get-Culture|select Name|convertto-json -depth 1
  register: culture_raw

- name: debug culture_raw
  debug:
var: culture_raw

- name: set culture fact
  set_fact:
 culture: "{{culture_raw.stdout|from_json}}"

- name: debug culture
  debug:
var: culture

- name: do things when culture is en-US
  debug:
msg: Doing en-US things   
  when: culture.Name == 'en-US'

- name: do things when culture is something else
  debug:
msg: Doing non-en-US things   
  when: culture.Name != 'en-US'


On Monday, July 10, 2017 at 4:46:55 PM UTC+1, fanchf...@gmail.com wrote:
>
> Hello,
>
> I would like to create a playbook that adds a user to the administrators 
> group. This action is simple and is an example. But my problem is that I 
> have servers in FR and the group is not administrators but administrators.
>
> I saw that you could make conditions in the playbooks but I do not know 
> how to test if I am on an OS FR or US.
>
> Could you advise me?
>
> Thank you beforehand.
>
> Regards
>

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


Re: [ansible-project] Using include_vars and with_items with optiona files == bug?

2017-07-10 Thread Brian Coca
Well, when you include_vars you are normally overwriting existing
vars, this will happen in a with_ loop or outside of it, that is
normal behaviour.

As for the error wiping out myvars ... the task failed, so none of the
work was done. The previously accumulated data in the 2 files that did
work is lost as the task ends up not importing any vars as it failed
as a whole, even if parts of it succeeded.

--
Brian Coca

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


[ansible-project] Using include_vars and with_items with optiona files == bug?

2017-07-10 Thread Dan Linder
I'm trying to setup a hierarchical set of variable files so that different 
teams can setup value, permitting more specific instances to override 
generic ones.  The key is that the more specific instances may not be 
defined in all cases.  I thought I solved it with a combination of 
"include_vars" and "with_items" and using "ignore_errors" to skip a missing 
file.

But, when any of the include files are missing the entire set of included 
values are lost.  It appears that any ignored failure in the include_vars 
deletes the entire data structure when it continues on.

Here's a sample playbook and variable files.  (For what it's worth this is 
Ansible 2.2.0.0 on RHEL 6)
*teststackvars.yml*

#!/usr/bin/env ansible-playbook
# Run like this:
# ANSIBLE_HASH_BEHAVIOUR=merge ./teststackvars.yml -i localhost, -l 
localhost --check
# or set hash behavior in ansible.cfg and run without variable.
---
- hosts: all
  gather_facts: False

  tasks:
  - name: Include the variables in precedence
include_vars:
  file: "{{ item }}"
  name: myvars
with_items:
  - info_a.yml
  - info_b.yml
  - info_{{ inventory_hostname }}.yml
ignore_errors: True

  - debug:
  msg: "{{ myvars }}"


And these three vars files:

*vars/info_a.yml*

---
var_from_info_a: from info_a.yml
some_var: value from info_a

 

*vars/info_b.yml*

---
var_from_info_b: from info_b.yml
some_var: value from info_b


*vars/info_localhost.yml*

---
var_from_info_localhost: from info_localhost.yml
some_var: value from info_localhost


When I run it with all files defined it works just fine:

*$ ./teststackvars.yml -i localhost, -l localhost --check*

*PLAY [all] 
**

*TASK [Include the variables in precedence] 
**
*ok: [localhost] => (item=info_a.yml)*
*ok: [localhost] => (item=info_b.yml)*
*ok: [localhost] => (item=info_localhost.yml)*

*TASK [debug] 

*ok: [localhost] => {*
*"msg": {*
*"some_var": "value from info_localhost",*
*"var_from_info_a": "from info_a.yml",*
*"var_from_info_b": "from info_b.yml",*
*"var_from_info_localhost": "from info_localhost.yml"*
*}*
*}*

*PLAY RECAP 
**
*localhost  : ok=2changed=0unreachable=0   
 failed=0*


That looks good - all the unique variables from info_a/b/localhost are 
defined, and the common "some_var" is overwritten by the last file.

When I rename one of the YML files, the entire "myvars" variable structure 
goes away:

*$ mv vars/info_localhost.yml vars/info_localhost.yml.disabled*
*$ ./teststackvars.yml -i localhost, -l localhost --check*

*PLAY [all] 
**

*TASK [Include the variables in precedence] 
**
*ok: [localhost] => (item=info_a.yml)*
*ok: [localhost] => (item=info_b.yml)*
*fatal: [localhost]: FAILED! => {"failed": true, "msg": "Unable to find 
'info_localhost.yml' in expected paths."}*
*...ignoring*

*TASK [debug] 

*fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' 
has an invalid value, which appears to include a variable that is 
undefined. The error was: 'myvars' is undefined\n\nThe error appears to 
have been in '/home/dan/teststackvars/teststackvars.yml': line 20, column 
5, but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\n\n  - debug:\n^ 
here\n"}*
*to retry, use: --limit 
@/home/dan/teststackvars/teststackvars.retry*

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

*$*


I searched the group and Google in general for "with_items" and 
"include_vars" but didn't see anything that seems to pertain to this. 
 Shouldn't this work - at least let the variables that were in the "myvars" 
stay in-spite of the missing variable file?

Thanks,
Dan

-- 
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/5993f7b5-764c-4276-81e2-e11eb27d57e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Connecting to Cisco IOS device through Cisco terminal server (29xx)

2017-07-10 Thread coolcps
I would like Ansible to connect to the console port of IOS devices to 
provision them.  I have set up a Cisco 29xx terminal server to use SSH. 
 The issue is that in order to access the device, you must now go through 
two prompts.  The first prompt username/password, then hit Enter to bring 
up the second prompt.  From here it is like logging into the device as 
normal.


Is there anyway to use the current ios modules (facts, command, config, 
etc) to login in this manner?  Or are there any other solutions?  Thanks 
for any assistance!

-- 
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/5df83e91-73a1-48bc-a29d-17b56c3e7ec9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Cisco switch unreachable

2017-07-10 Thread Phil F
Yeah I should have done a search first - thanks, fixed :-)

On Monday, 10 July 2017 17:46:52 UTC+2, Phil F wrote:
>
> Hi,
>
> I have just installed Ansible for the first time and am attempting to 
> connect to a Cisco switch, this needs to be with username and password.
>
> From both an Ubuntu server and my Mac I can ssh to the box with the same 
> username and password I have configured in the ansible inventory.
>
> I have attempted from an Ubuntu host and my Mac, however I am receiving 
> the following error:
>
> ===
>
> :/etc/ansible$ ansible -m ping all 
>
>  | UNREACHABLE! => { 
>
> "changed": false, 
>
> "msg": "Failed to connect to the host via ssh: Connection to 
> 192.168.10.200 closed by remote host.\r\nConnection closed\r\n", 
>
> "unreachable": true 
>
> }
>
> ===
>
> Ansible config:
>
> host1 ansible_host=192.168.10.200 ansible_user= ansible_ssh_pass=
>
> Debug from switch shows the succesful authentication and subsequent 
> closing of the connection:
>
> *Jul  8 06:20:52.804: SSH2 1: MAC compared for #8 :ok
> *Jul  8 06:20:52.804: SSH2 1: input: padlength 37 bytes
> *Jul  8 06:20:52.808: SSH2 1: send:packet of  length 16 (length also 
> includes padlen of 10)
> *Jul  8 06:20:52.808: SSH2 1: computed MAC for sequence no.#8 type 52
> *Jul  8 06:20:52.808: SSH2 1: authentication successful for ansibleuser
> *Jul  8 06:20:52.814: SSH2 1: ssh_receive: 64 bytes received 
> *Jul  8 06:20:52.814: SSH2 1: input: total packet length of 48 bytes
> *Jul  8 06:20:52.814: SSH2 1: partial packet length(block size)16 
> bytes,needed 32 bytes,
>maclen 16
> *Jul  8 06:20:52.814: SSH2 1: MAC compared for #9 :ok
> *Jul  8 06:20:52.814: SSH2 1: input: padlength 19 bytes
> *Jul  8 06:20:52.814: SSH2 1: channel open request
> *Jul  8 06:20:52.815: SSH2 1: send:packet of  length 32 (length also 
> includes padlen of 10)
> *Jul  8 06:20:52.815: SSH2 1: computed MAC for sequence no.#9 type 91
> *Jul  8 06:20:52.818: SSH2 1: ssh_receive: 144 bytes received 
> *Jul  8 06:20:52.818: SSH2 1: input: total packet length of 48 bytes
> *Jul  8 06:20:52.818: SSH2 1: partial packet length(block size)16 
> bytes,needed 32 bytes,
>maclen 16
> *Jul  8 06:20:52.818: SSH2 1: MAC compared for #10 :ok
> *Jul  8 06:20:52.818: SSH2 1: input: padlength 7 bytes
> *Jul  8 06:20:52.818: SSH2 1: env request
> *Jul  8 06:20:52.819: SSH2 1: input: total packet length of 64 bytes
> *Jul  8 06:20:52.819: SSH2 1: partial packet length(block size)16 
> bytes,needed 48 bytes,
>maclen 16
> *Jul  8 06:20:52.819: SSH2 1: MAC compared for #11 :ok
> *Jul  8 06:20:52.819: SSH2 1: input: padlength 11 bytes
> *Jul  8 06:20:52.819: SSH2 1: send:packet of  length 16 (length also 
> includes padlen of 6)
> *Jul  8 06:20:52.819: SSH2 1: computed MAC for sequence no.#10 type 99
> *Jul  8 06:20:52.819: SSH2 1: exec request
> *Jul  8 06:20:52.819: SSH2 1: exec message received
> *Jul  8 06:20:52.819: SSH2 1: starting shell for vty
> *Jul  8 06:20:52.821: SSH2 1: send:packet of  length 96 (length also 
> includes padlen of 19)
> *Jul  8 06:20:52.821: SSH2 1: computed MAC for sequence no.#11 type 94
> *Jul  8 06:20:52.926: SSH2 1: send:packet of  length 48 (length also 
> includes padlen of 18)
> *Jul  8 06:20:52.926: SSH2 1: computed MAC for sequence no.#12 type 98
> *Jul  8 06:20:52.927: SSH2 1: send:packet of  length 16 (length also 
> includes padlen of 6)
> *Jul  8 06:20:52.927: SSH2 1: computed MAC for sequence no.#13 type 96
> *Jul  8 06:20:52.927: SSH2 1: send:packet of  length 16 (length also 
> includes padlen of 6)
> *Jul  8 06:20:52.927: SSH2 1: computed MAC for sequence no.#14 type 97
> *Jul  8 06:20:52.927: SSH1: Session terminated normally
>
> Using a playbook:
>
>
> :~/ansible/playbooks$ ansible-playbook tst.yml 
>
>
>
>
> PLAY [testdevices] 
> 
>  
>
>
>
>
>
> TASK [Gathering Facts] 
> 
>  
>
>
> fatal: [host1]: UNREACHABLE! => {"changed": false, "msg": "Failed to 
> connect to the host via ssh: Connection closed\r\nConnection to 
> 192.168.10.200 closed by remote host.\r\n", "unreachable": true} 
>
> to retry, use: --limit @/home/exinadmin/ansible/playbooks/tst.retry 
>
>
>
>
> PLAY RECAP 
> 
>  
>
>
>    : ok=0 changed=0 unreachable=1 failed=0 
>
> Any help will be greatly appreciated !
>
> Phil.
>
>
>
>
>
>
>
>
>
>

-- 
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 

Re: [ansible-project] Not able to use ec2_vpc_endpoint module

2017-07-10 Thread Kai Stian Olstad

On 10. juli 2017 12:35, shuvam jha wrote:

Hi ,
I am using ansible 2.3.1.0 , python version = 2.7.5 . When i am trying to
use ec2_vpc_endpoint module it is giving error  , but i am able to run
other ec2 or aws  modules . I have checked the list of module by running
ansible-doc -l ,  ec2_vpc_endpoint was not there . How to include that , i
have updated the ansible .


From the documentation
https://docs.ansible.com/ansible/ec2_vpc_endpoint_module.html

"New in version 2.4."

So it's coming in the next main version of 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 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/471da7e7-4b58-024a-149d-73ec29b02cee%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible dynamic variable

2017-07-10 Thread Kai Stian Olstad

On 10. juli 2017 00:50, Kethzer Docteur wrote:



Im trying to have ansible Update variable value base on OS distribution, but Im 
faling when I insert the rules in a template.
Any idea how to solve this?

---
- hosts: fansible,cansible
   vars:
 nagios_freebsd_load: -w 75,70,65 -c 90,85,80
 nagios_centos_load: -w 15,10,5 -c 30,25,20
 nagios_server_load: vars['nagios_{{ ansible_distribution|lower }}_load']


To make it work use
nagios_server_load: "{{ vars['nagios_' ~ ansible_distribution|lower ~ 
'_load'] }}"



--
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/7b6866cf-bef5-fc41-25c3-996e3b961645%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Cisco switch unreachable

2017-07-10 Thread Kai Stian Olstad

On 08. juli 2017 13:17, Phil F wrote:

Hi,

I have just installed Ansible for the first time and am attempting to
connect to a Cisco switch, this needs to be with username and password.

 From both an Ubuntu server and my Mac I can ssh to the box with the same
username and password I have configured in the ansible inventory.

I have attempted from an Ubuntu host and my Mac, however I am receiving the
following error:

===

:/etc/ansible$ ansible -m ping all

 | UNREACHABLE! => {

"changed": false,

"msg": "Failed to connect to the host via ssh: Connection to 192.168.10.200
closed by remote host.\r\nConnection closed\r\n",

"unreachable": true

}


This is one of the more asked and answered question so I just gona give 
you a link.


https://groups.google.com/d/msg/ansible-project/KR1DDD4Avr8/o4lw-YpuAgAJ


--
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/ff47b078-c3cb-6647-4577-2a3b5353b559%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Role tag?

2017-07-10 Thread Dick Visser
Hi

I'm often finding myself having to run a specific role from some of
our playbooks.
Currently I'm using the '--tags' option for ansible-playbook, and we
tag the role in our playbook like this:


roles:
  - somerole
  - another_role
  - { role: myrole, tags: myrole }
  - yetanotherrole


But now we'd have to add the tag to each invocation in every playbook,
which is not ideal.

For our inhouse developed roles we're "abusing" main.yml to wrap
another task file so that we can tag all the tasks in the entire role:


myrole/tasks/main.yml:

- include: myrole.yml
  tags: myrole


This works better, we can just use the role as is without defining
tags in the playbooks, and still use --limit when running
ansible-playbook. So far so good.

But the wrapper task file still feel a bit clumsy.
Is there any way to define tags in a role itself?

PS I realise we can also wrap all tasks in a 'block' but that's not
ideal either

I think I'm looking for something like a tags/ directory inside a role
where I can define tags that apply to all tasks in a role..?

Thanks!

Dick





-- 
Dick Visser
Sr. System & Network Engineer
GÉANT

Want to join us? We're hiring: https://www.geant.org/jobs

-- 
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/CAL8fbwOgJyPCNiUHrAW75Hg1%2Bm-VrAY7L3p0%2BKuOmfrk%2By%2BTqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to put an array in a json object.

2017-07-10 Thread VenomMsk
Hi,

I have a varible that contains an array:

  "AuthenticationHTTPheader": [
"iv-user",
"iv-groups"
],
  

I need to pass this walue as a JSON-element in a body of a Request sent by 
URI module. So,

body: 
'{
...
"remote_http_header": "{{ 
item.AuthenticationHTTPheader|default (d_remhed) }}",
...
}'

in the output I see that URI module sends the following to the server:

"remote_http_header": "[u'iv-user', u'iv-groups']",

here -> 
https://stackoverflow.com/questions/41521138/ansible-template-adds-u-to-array-in-template
 
<- I read, that " | to_json" could solve the problem, but in my case using 
this breaks down the whole json of the body, it's no more a json, but a 
string with escaped quotes:

..., \"remote_http_header\": \"[\"iv-user\", \"iv-groups\"]\",...

how can I send to the server this array? I need this to be sent to the 
server:


"remote_http_header": [ "iv-user", "iv-groups"]


Thanks to everybody!

-- 
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/b097f4b8-31d1-44e9-872d-959c1e4ad27a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible to assign an IAM role to an existing instance

2017-07-10 Thread Bond
Hi,

I am trying to assign an IAM role to a bunch of existing EC2 instances 
using Ansible modules. I couldn't find an appropriate module for that same 
and wasn't sure if that is possible since this feature came out recently.  
Any suggestions?

-- 
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/e8c51a7c-53d1-4474-bbb6-633d78295c02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible customization on vmware environment

2017-07-10 Thread Alessio Dini


Hello,
I'm working on ansible using vmware_guest module. Actually customer makes 
new vms using powercli utility leaving them: 
- running 
- with nic interfaces ( no ip, netmask, gw, etc.etc. ) 
- with multiple disks

I want to use ansible configuring ip address,hostname,gw and dns server on 
the newly created vms. How can I do this? I'm testing vmware_guest module 
but actually I don't need to clone a new vm because I already have them 
ready. I just need to customize them. Do you have any idea? Is 
vmware_vm_shell the only solution?

Thank you for your time 
Regards 
Alessio Dini 

-- 
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/ff290ccb-ed18-477c-a5e1-af696bb20534%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Windows: Add account to group administrators FR/US

2017-07-10 Thread fanchfanch44
Hello,

I'm starting with Ansible. I would like to know in a playbook how to test 
if the windows computer is in version FR or US. Following the test, I would 
add account users to the local "Administrators" or "Administrateurs" group.

By default:

- name: Add a user
   Hosts: windows_tst
   Gather_facts: false
   tasks:
 - name: Add User
   win_user:
 Name: admintest
 Password: "mypassword"
 State: present
 Groups: Administrators

But if I am on a computer in French, the group administrors does not exist.

How I can solve this problem.

Thank you in advance for your assistance.
Regards

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


[ansible-project] Re: Cisco IOS backup and write to file with timestamp

2017-07-10 Thread Murugan Gan
Hi Team,

I have created sh running config getting output but have 150 routers but it 
triggered one notepad text it include all config output any chance to get 
trigger each host name with each text output.

Regards,

S.Manivannan










On Friday, September 30, 2016 at 3:25:22 PM UTC-7, Jimbo wrote:
>
> I am relatively knew to ansible and need a little assistance. We are 
> trying to use ansible to backup our Cisco configuration. I figured that 
> this would be fairly simple and I have made some progress but I am stuck at 
> the moment.
>
> I want to be able to run this playbook and have it output the 
> configuration of the cisco router to a simple text file on the ansible 
> server. The file name needs to be the current time when it ran in the 
> format MMDD. I want to deposit the file in a folder that is the 
> hostname of the switch defined in the inventory file.
>
> I can get the playbook to run when I use the hostname for the file name 
> and do not include the directory based on hostname, but the timestamp from 
> the ansible server is failing due to the length of the filename being to 
> long. Also the text of the configuration file is devoid of formatting so it 
> is in a single line with quotation around each entry from the config. Here 
> is a snippet from the file output:
>
> {"changed": false, "cisco.stdout_lines": [["Building configuration...", 
> "", "Current configuration : 3389 bytes", "!", "version 12.2", "no service 
> pad",
>
> So the items I need help with are:
>
>1. Format the show run so that we can use it for a copy paste restore 
>at some point
>2. Attach the local timestamp to the filename
>3. Attach the hostname to the folder that the backup is placed
>
> Running ansible 2.1.2
>
> Here is my playbook so far (or what I thought would work)...
> =
> ---
> - hosts: switches
>   connection: local
>   vars:
> cli:
>   host: "{{ inventory_hostname }}"
>   username: circle
>   password: Circle86
>   transport: cli
>   backup: yes
>   tasks:
> - name: timestamp
>   local_action: command date +%Y%m%d
>   register: timestamp
>
> - name: run show running-config on remote devices
>   ios_command:
> commands: show running
> provider: "{{ cli }}"
>   register: cisco
>   
> - name: debug
>   debug:
> var: cisco.stdout_lines
>   register: debug
>   
> - copy: content={{ debug }} 
> dest=/home/james/ansible/Cisco/test3/backups/{{ inventory_hostname }}/{{ 
> timestamp }}
>
> =
>
> While I know there are other methods of doing this through SCP or FTP and 
> the archive command on cisco, we are trying to keep this centralized within 
> Ansible since we manage many linux servers from there as well.
>
> Thoughts?
>
> 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/affb2fd7-0d69-4c75-9b2b-d0d51236369c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Configuration property - executable and quoting

2017-07-10 Thread etcshadow
Hello, 
I would like to ask if there is a why to set "executable=" configuration 
property to nothing as I don't want to spawn another shell for the sudo 
elevation. Cause I am not allowed to.

The issue I faced is related to the quotes followed by the executable which 
makes Ansible not being able to execute any commands.

Thank you

-- 
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/aaddbff1-168c-4be1-b1ff-0c2a4737753f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to do parameterized ansible-variable attribute-lookups?

2017-07-10 Thread moe_22

This is best explained by this simple example:
--- 
- name: getattr 
hosts: 127.0.0.1 
connection: local 
vars: 
  - foo: 
  bar: "bar" 
  baz: "baz" 
  - bee: "bar" 
tasks: 
  - name: get foo.bar 
debug: 
  msg: "{{ foo|attr(bee) }}"
...


This fails, why?

-- 
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/bafb1619-6a7b-468a-8b22-fce639db97b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Add user to administrators or administrateurs group

2017-07-10 Thread fanchfanch44
Hello,

I would like to create a playbook that adds a user to the "administrators" 
group. 
his action is simple and is an example. But my problem is that I have 
servers in FR and the group is not "administrators" but "administrateurs".

I saw that we could make conditions in the playbooks but I don't know how 
to test, if I am on an OS FR or US.

Could you advise me?

Thank you beforehand.
cordially

-- 
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/22be7248-1a0e-4214-8621-fe84ef4a4b9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Why parameterized attribute lookup on ansible variables fail?

2017-07-10 Thread moe_22
This is best explained by this example:

--- 
- name: getattr 
hosts: 127.0.0.1 
connection: local 
vars: 
  - foo: 
   bar: "bar" 
   baz: "baz" 
  - bee: "bar" 
tasks: 
  - name: get foo.bar 
debug: 
  msg: "{{ foo|attr(bee) }}"

...

This fails, whay?

-- 
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/03374717-1e57-4958-884a-791987a2138c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible dynamic variable

2017-07-10 Thread Kethzer Docteur


Im trying to have ansible Update variable value base on OS distribution, but Im 
faling when I insert the rules in a template.
Any idea how to solve this?

---
- hosts: fansible,cansible
  vars:
nagios_freebsd_load: -w 75,70,65 -c 90,85,80
nagios_centos_load: -w 15,10,5 -c 30,25,20
nagios_server_load: vars['nagios_{{ ansible_distribution|lower }}_load']
  tasks:
- name: Print server load variable 
  debug: msg="{{ nagios_server_load }}"
- name: Print server load variable 
  debug: var="{{ nagios_server_load }}"
- name: Copying file
  template:
src: ~/ansitrial/load.conf
dest: /tmp/load.conf

cat ~/ansitrial/load.conf 
{{ nagios_server_load }}


TASK [Print server load variable] 
***
ok: [fansible] => {
"msg": "vars['nagios_freebsd_load']"
}
ok: [cansible] => {
"msg": "vars['nagios_centos_load']"
}

TASK [Print server load variable] 
***
ok: [fansible] => {
"vars['nagios_freebsd_load']": "-w 75,70,65 -c 90,85,80"
}
ok: [cansible] => {
"vars['nagios_centos_load']": "-w 15,10,5 -c 30,25,20"
}

TASK [Copying file] 
*
changed: [cansible]
changed: [fansible]

PLAY RECAP 
**
cansible   : ok=4changed=1unreachable=0failed=0   
fansible  : ok=4changed=1unreachable=0failed=0



remote@fansible:~ % cat /tmp/load.conf 
vars['nagios_freebsd_load']

[remote@cansible ~]$ cat /tmp/load.conf 
vars['nagios_centos_load']

-- 
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/62a93229-25e0-4d8d-ac3f-7b81dc9db26c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Cisco switch unreachable

2017-07-10 Thread Phil F
Hi,

I have just installed Ansible for the first time and am attempting to 
connect to a Cisco switch, this needs to be with username and password.

>From both an Ubuntu server and my Mac I can ssh to the box with the same 
username and password I have configured in the ansible inventory.

I have attempted from an Ubuntu host and my Mac, however I am receiving the 
following error:

===

:/etc/ansible$ ansible -m ping all 

 | UNREACHABLE! => { 

"changed": false, 

"msg": "Failed to connect to the host via ssh: Connection to 192.168.10.200 
closed by remote host.\r\nConnection closed\r\n", 

"unreachable": true 

}

===

Ansible config:

host1 ansible_host=192.168.10.200 ansible_user= ansible_ssh_pass=

Debug from switch shows the succesful authentication and subsequent closing 
of the connection:

*Jul  8 06:20:52.804: SSH2 1: MAC compared for #8 :ok
*Jul  8 06:20:52.804: SSH2 1: input: padlength 37 bytes
*Jul  8 06:20:52.808: SSH2 1: send:packet of  length 16 (length also 
includes padlen of 10)
*Jul  8 06:20:52.808: SSH2 1: computed MAC for sequence no.#8 type 52
*Jul  8 06:20:52.808: SSH2 1: authentication successful for ansibleuser
*Jul  8 06:20:52.814: SSH2 1: ssh_receive: 64 bytes received 
*Jul  8 06:20:52.814: SSH2 1: input: total packet length of 48 bytes
*Jul  8 06:20:52.814: SSH2 1: partial packet length(block size)16 
bytes,needed 32 bytes,
   maclen 16
*Jul  8 06:20:52.814: SSH2 1: MAC compared for #9 :ok
*Jul  8 06:20:52.814: SSH2 1: input: padlength 19 bytes
*Jul  8 06:20:52.814: SSH2 1: channel open request
*Jul  8 06:20:52.815: SSH2 1: send:packet of  length 32 (length also 
includes padlen of 10)
*Jul  8 06:20:52.815: SSH2 1: computed MAC for sequence no.#9 type 91
*Jul  8 06:20:52.818: SSH2 1: ssh_receive: 144 bytes received 
*Jul  8 06:20:52.818: SSH2 1: input: total packet length of 48 bytes
*Jul  8 06:20:52.818: SSH2 1: partial packet length(block size)16 
bytes,needed 32 bytes,
   maclen 16
*Jul  8 06:20:52.818: SSH2 1: MAC compared for #10 :ok
*Jul  8 06:20:52.818: SSH2 1: input: padlength 7 bytes
*Jul  8 06:20:52.818: SSH2 1: env request
*Jul  8 06:20:52.819: SSH2 1: input: total packet length of 64 bytes
*Jul  8 06:20:52.819: SSH2 1: partial packet length(block size)16 
bytes,needed 48 bytes,
   maclen 16
*Jul  8 06:20:52.819: SSH2 1: MAC compared for #11 :ok
*Jul  8 06:20:52.819: SSH2 1: input: padlength 11 bytes
*Jul  8 06:20:52.819: SSH2 1: send:packet of  length 16 (length also 
includes padlen of 6)
*Jul  8 06:20:52.819: SSH2 1: computed MAC for sequence no.#10 type 99
*Jul  8 06:20:52.819: SSH2 1: exec request
*Jul  8 06:20:52.819: SSH2 1: exec message received
*Jul  8 06:20:52.819: SSH2 1: starting shell for vty
*Jul  8 06:20:52.821: SSH2 1: send:packet of  length 96 (length also 
includes padlen of 19)
*Jul  8 06:20:52.821: SSH2 1: computed MAC for sequence no.#11 type 94
*Jul  8 06:20:52.926: SSH2 1: send:packet of  length 48 (length also 
includes padlen of 18)
*Jul  8 06:20:52.926: SSH2 1: computed MAC for sequence no.#12 type 98
*Jul  8 06:20:52.927: SSH2 1: send:packet of  length 16 (length also 
includes padlen of 6)
*Jul  8 06:20:52.927: SSH2 1: computed MAC for sequence no.#13 type 96
*Jul  8 06:20:52.927: SSH2 1: send:packet of  length 16 (length also 
includes padlen of 6)
*Jul  8 06:20:52.927: SSH2 1: computed MAC for sequence no.#14 type 97
*Jul  8 06:20:52.927: SSH1: Session terminated normally

Using a playbook:


:~/ansible/playbooks$ ansible-playbook tst.yml 




PLAY [testdevices] 

 





TASK [Gathering Facts] 

 


fatal: [host1]: UNREACHABLE! => {"changed": false, "msg": "Failed to 
connect to the host via ssh: Connection closed\r\nConnection to 
192.168.10.200 closed by remote host.\r\n", "unreachable": true} 

to retry, use: --limit @/home/exinadmin/ansible/playbooks/tst.retry 




PLAY RECAP 

 


   : ok=0 changed=0 unreachable=1 failed=0 

Any help will be greatly appreciated !

Phil.









-- 
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/a9342ded-8f5f-4ac9-b972-6978a4bc436e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Not able to use ec2_vpc_endpoint

2017-07-10 Thread shuvam jha
Hi , 
I am using ansible 2.3.1.0 , python version = 2.7.5.
I am trying to use ec2_vpc_endpoint  module , but it is giving error. I 
have use other ec2 or aws module . I have updated the ansible . I have run 
ansible_doc -l to check list of module it was not there . 
Error :

ERROR! no action detected in task. This often indicates a misspelled module 
name, or incorrect module path.The error appears to have been in 
'/home/user/demoendpointtest.yml': line 4, column 7, but maybe elsewhere in 
the file depending on the exact syntax problem.The offending line appears 
to be:

 tasks:
- name: Ce new vpc endpoint
  ^ here


The error appears to have been in '/home/dhoni/demoendpointtest.yml': line 4, 
column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
- name: Ce new vpc endpoint
  ^ here






















-- 
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/9d07f395-ed24-43a7-b2ea-a66d5d5a332e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Migrating from Serena to Ansible

2017-07-10 Thread manasi
Hi All , 
We are planning on migrating to Ansible. But need to know like How to 
migrate from Serena deployment automation to Ansible and how to go about 
it? What dependencies need to be handled and things that need to be 
converted? 

Thank you.
Manasi

-- 
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/91841713-3abf-4fe2-96a5-905dfa9bce72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Attach an IAM role to existing EC2 instances

2017-07-10 Thread Bond
Hi,
I am trying to attach and IAM role to a set of existing EC2 instances based 
on the Tag value. Is there a module readily available in Ansible now? Any 
suggestions?

-- 
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/4447583f-9ddc-4a02-8031-ecbba8213455%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Add user to "administrators" group or "administrateurs" group

2017-07-10 Thread fanchfanch44
Hello,

I would like to create a playbook that adds a user to the administrators 
group. This action is simple and is an example. But my problem is that I 
have servers in FR and the group is not administrators but administrators.

I saw that you could make conditions in the playbooks but I do not know how 
to test if I am on an OS FR or US.

Could you advise me?

Thank you beforehand.

Regards

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


[ansible-project] vmware - Managing several portgroups on a cluster

2017-07-10 Thread Drew Merryman
Hey all, 
I'm new to Ansible but I'm really liking it so far. However, I think what 
I'm trying to do is a bit more advanced, or perhaps Ansible isn't the right 
tool? Here is the problem:

Currently I have several datacenters with a varying amount of clusters on 
each. On the clusters are some ESXi hosts with some vSwitches. These 
vSwitches are configured with Vlans and other things. I would like to 
manage these with Ansible. The goal would ideally be to (within a single 
cluster) make sure all the vSwitches on each host are running the same 
config. I.e. vSwitch1 on someServer01 has the same configuration as 
vSwitch1 on someServer02 within someCluster. Currently some of the 
portgroups get messed up between hosts, usually some vSwitches will be 
missing a Vlan, or maybe have the right number of Vlans but use the wrong 
number scheme. I would like to designate one portgroup as the "right one" 
and merely copy this config to the other vSwitches. 

I have read the documentation 
under http://docs.ansible.com/ansible/list_of_cloud_modules.html#vmware and 
looked at the vmware_portgroup and the vmware_dvs_portgroup modules, 
however these seem to only deal with explicitly creating/removing 
portgroups. Is there a way I could see the configuration of a portgroup, or 
even look at an existing vSwitch? 

If someone could point me in the right direction, that would be awesome. 
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/d17ccfcf-89d3-49de-9589-03ac7e11316d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Not able to use ec2_vpc_endpoint module

2017-07-10 Thread shuvam jha
Hi , 
I am using ansible 2.3.1.0 , python version = 2.7.5 . When i am trying to 
use ec2_vpc_endpoint module it is giving error  , but i am able to run 
other ec2 or aws  modules . I have checked the list of module by running 
ansible-doc -l ,  ec2_vpc_endpoint was not there . How to include that , i 
have updated the ansible .

Error :

ERROR! no action detected in task. This often indicates a misspelled 
module name, or incorrect module path.

The error appears to have been in '/home/user/demoendpointtest.yml': line 4, 
column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
- name: Ce new vpc endpoint
  ^ here


The error appears to have been in '/home/user/demoendpointtest.yml': line 4, 
column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
- name: Ce new vpc endpoint
  ^ here

-- 
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/02eea353-b0e9-4dd0-bfa5-24170dc68a04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] dynamic inventory not working properly

2017-07-10 Thread Babatunde Busari
Original post https://github.com/ansible/ansible/issues/26574

ANSIBLE VERSION

ansible 2.3.1.0
config file = /projects/robomation/ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.5 (default, Aug 2 2016, 04:20:16) [GCC 4.8.5 20150623 
(Red Hat 4.8.5-4)]

I have several resources running and when i run

ec2.py --list

{
  "_meta": {
"hostvars": {}
  }
}

Also when i try to run ansible playbooks targeting hosts with certain tags, 
i get this

[WARNING]: Found both group and host with same name: localhost
...
...
...
skipping: no hosts matched

I am having issues setting up dynamic inventory to work properly. I have my 
ec2.ini and ec2.py files and ec2.py is set to be executable and i believe i 
have setup right. Also command does not return error only it returns 
nothing in body.

What do i do to troubleshoot dynamic inventory?



I have also tried what @Deepakkothandan 

Still doesn't work

[root@robomation robomation]# env | grep ANSIBLE
ANSIBLE_HOSTS=/projects/robomation/inventory/ec2.py

[root@robomation robomation]# env | grep EC2_INI
EC2_INI_PATH=/projects/robomation/inventory/ec2.ini

[root@robomation robomation]# env | grep AWS
AWS_REGION=us-west-2

[root@robomation robomation]# inventory/ec2.py --list
{
  "_meta": {
"hostvars": {}
  }
}

[root@robomation robomation]# ansible --version
ansible 2.3.1.0
  config file = /projects/robomation/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.5 (default, Aug  2 2016, 04:20:16) [GCC 4.8.5 20150623 
(Red Hat 4.8.5-4)]

-- 
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/dfabee3f-39ea-4ebc-b307-1b475ddbeb70%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Dynamic group from static groups

2017-07-10 Thread B Holmes
Hi,

I have an inventory file:
[dev]
dev_server1

[uat]
uat_server1

[prod]
prod_server1

variables file:
env_lists:
-  env_list: env_list1
   envs:
 - dev
 - uat
 - prod
-  env_list: env_list2
   envs:
 - prod
-  env_list: env_list3
   envs:
 - dev
 - prod

I'm trying to run a task on each env_list.  Eg
- hosts: env_list2*
  tasks:
  - include: a_task_that_will_run_on_prod_server1_only.yml

My best guess is to construct new groups using group_by:
- hosts: all
  tasks:
  group_by: key={{item.0.env_list}}_{{item.1}}
  with_subelements:
- "{{ env_lists }}"
- envs

- debug: var=group_names

This correctly outputs the right group names, eg:
env_list2_prod

But env_list2_prod contains all servers instead of just prod_server1.  In 
other words, when I run a task on hosts: env_list2*, it runs on all the 
servers.  I know I could use a Dynamic Inventory Script, but would be a 
fair amount of work.  Hoping there's a group_by way.  Any ideas?

Many 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/8f1acf79-b0b9-4db3-a3e7-00f9fbe0e7a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] backward incompatible change in module find in ansible 2.3

2017-07-10 Thread Renaud Michel
on 2017-07-06 at 20:27, Kai Stian Olstad wrote:
> On 06. juli 2017 13:33, Renaud Michel wrote:
> > I suppose it is too late to report this as a bug, as ansible 2.3 has been
> > released for some time already, changing it to be compatible with previous
> > versions would break it for people who stated using it with ansible 2.3.  
> 
> It seams that the find module become stable in 2.3 so i guess this is OK.

Oh, sorry I missed that.
So that's why it wasn't mentioned in the changelog.


-- 
Renaud MICHEL
defimedia S.A.

-- 
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/20170707124344.0da99a79%40portux2.dfm.contraste.loc.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Playbook Failys atc copying ssh keys

2017-07-10 Thread Dick Visser
On 10 July 2017 at 04:39, Anfield  wrote:
> Yes. Definitely. I even remove the variables in that part, and just put in
> /home/dave/.ssh/id_rsa.pub
>
> Generated the same errors.

Permissions perhaps?
Keep in mind that you are able to use elevated privileges on the
target host, so you have no problem writing files to user's home
directories.
But it's likely that your own local account (the one you run your
playbook as) usually does *not* have permission to access other local
accounts (such as /home/dave) for obvious reasons.


Dick

-- 
Dick Visser
Sr. System & Network Engineer
GÉANT

Want to join us? We're hiring: https://www.geant.org/jobs

-- 
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/CAL8fbwO97Z-a%3DZ2aTAccExBZLkiug-Qao0-M%3Do4tYzGpt7tAcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Nested variables and Regex...

2017-07-10 Thread rene via Ansible Project
Thanks for helping me out. :)

Sadly it looks like that the construct itself is the issue and not the 
regex. After I resolved the "recursive loop detected in template" issue, I 
ran into another one. I have to dig into that one first to resolve 
this entirely.

Nevertheless thanks for your help. :)

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