Re: [ansible-project] Custom Fact - Drill down into each variable

2017-07-04 Thread Anfield
Thanks. It works now

Changed the playbook line to this and it works fine ->  debug: msg="Custom 
facts are  {{ansible_local.preference.general.material}}"

Output  - 
PLAY [localhost] 
***

TASK [Gathering Facts] 
*
ok: [localhost]

TASK [Display custom facts] 

ok: [localhost] => {
"changed": false,
"msg": "Custom facts are  concrete"

-- 
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/ae2c97a3-4bb6-46b2-aef9-c597d87aa1b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Custom Fact - Drill down into each variable

2017-07-04 Thread Kai Stian Olstad

On 04.07.2017 19:58, Anfield wrote:

Created a custom fact which only seems to work when not executable -
etc/ansible/facts.d/preference.fact

[new facts]
material =  concrete
structure = square


I highly recommend against using spaces in fact keys.
You must likely will have a lot of problems if you do.


When the preference.fact is set to executable I get the following error 
-


TASK [Gathering Facts]
*
fatal: [localhost]: FAILED! => {"changed": false, "cmd":
"/etc/ansible/facts.d/preference.fact", "failed": true, "msg": "[Errno 
8]

Exec format error", "rc": 8}

Fixed that by setting the fact to not executable and the playbook runs 
fine


This is as expected.
If a file is executable Ansible will try to run the file, and it need to 
a valid program/script.

When the file is not an executable Ansible will read it content.



My second question is how to drill into the fact to reference each fact
separately if i need to ?
 I cant seem to drill in any further than -  debug: msg="Custom facts 
are

{{ansible_local.preference}}


Playbook
---
- hosts: localhost
  gather_facts: on
  tasks:
- name: Display custom facts
  debug: msg="Custom facts are  {{ansible_local.preference.new 
facts}}"


The space is causing the the problem.
To make it work with space you would need to use square brackets and not 
the dot notation.


{{ ansible_local.preference.['new facts'] }}


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


[ansible-project] Re: Playbook that uses become only if root user not specified?

2017-07-04 Thread ajay jiwanand
A very simple fix was to just change become:true to become:yes and root 
authentication works as long as you dont specify sudo password in command 
line (-K) and specify root account with -u

On Tuesday, July 4, 2017 at 1:46:05 PM UTC-4, ajay jiwanand wrote:
>
> Hey Daniel,
>
> That definitely looks like it can work but that would mean that I would 
> have to specify one password for sudo accross all devices? As there are 
> tons of devices and tons of "admin" accounts for users who are able to 
> perform these action it wont be possible for me to place one password under 
> ansible_become_pass. Is it possible for the password to be taken from the 
> password entered when running the playbook or for the playbook to skip 
> become all together when ansible_user != 'root'?
>
> I've tried this:
>
> become: true
> when: ansible_user != 'root'
>
> no luck
>
> On Tuesday, July 4, 2017 at 2:05:37 AM UTC-4, Daniel JD wrote:
>>
>> You could use something like the following:
>>
>> - name: Set sudo Passwort
>>   set_fact:
>> ansible_become_pass: "{{ my_encrypted_password }}"
>>   when: ansible_user == 'non-root-user'
>>
>> Am Dienstag, 4. Juli 2017 05:03:08 UTC+2 schrieb ajay jiwanand:
>>>
>>> I am writing a playbook that will cover a wide ranged of hosts some that 
>>> is integrated into AD with sudo privileges and others with just a local 
>>> "root" account. I currently have the playbook written with the become 
>>> module and it works fine for AD integrated hosts but when i specify a root 
>>> user it throws the error "needs sudo password" when I set become_user: root 
>>> it works fine for root accounts but it gives sudo errors when using AD 
>>> integrated users. Is it possible to have a playbook use sudo passwords when 
>>> the user specified (through command line -u) is not root?
>>>
>>>
>>>

-- 
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/81610892-5fe5-498a-96be-695934846899%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Custom Fact - Drill down into each variable

2017-07-04 Thread Anfield
 Created a custom fact which only seems to work when not executable - 
etc/ansible/facts.d/preference.fact

[new facts]
material =  concrete
structure = square

When the preference.fact is set to executable I get the following error - 

TASK [Gathering Facts] 
*
fatal: [localhost]: FAILED! => {"changed": false, "cmd": 
"/etc/ansible/facts.d/preference.fact", "failed": true, "msg": "[Errno 8] 
Exec format error", "rc": 8}

Fixed that by setting the fact to not executable and the playbook runs fine

My second question is how to drill into the fact to reference each fact 
separately if i need to ?
 I cant seem to drill in any further than -  debug: msg="Custom facts are  
{{ansible_local.preference}}


Playbook
---
- hosts: localhost
  gather_facts: on
  tasks:
- name: Display custom facts
  debug: msg="Custom facts are  {{ansible_local.preference.new facts}}"

-- 
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/2e05e042-981b-4654-ab10-2cb1446013fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Custom fat drill down, and error message

2017-07-04 Thread Anfield
I have a custom fact as follows - /etc/ansible/facts.d/preference.fact

[new facts]
material =  concrete
structure = square

When this is not executable, it works, when it is executable it throws an 
error (shown below)


TASK [Gathering Facts] 
*
fatal: [localhost]: FAILED! => {"changed": false, "cmd": 
"/etc/ansible/facts.d/preference.fact", "failed": true, "msg": "[Errno 8] 
Exec format error", "rc": 8}

Trying to run a simple playbook to see if I can drill down into the 
specific facts. I can get it to work fine if I stop at -> debug: 
msg="Custom facts are  {{ansible_local.preference}}"

But I cannot seem to drill down any further. The error above will not throw 
when the fact is set to not executable, but will throw when the fact is 
executable..

Any ideas on those 2 items? 1) How to drill down into a fact 2) How to 
create the fact properly so that it doesnt throw an error? Maybe these are 
related.


Playbook - 
---
- hosts: localhost
  gather_facts: on
  tasks:
- name: Display custom facts
  debug: msg="Custom facts are  {{ansible_local.preference.new facts}}"








-- 
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/3070eea1-2e84-4318-bbad-0441f0ff1652%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Playbook that uses become only if root user not specified?

2017-07-04 Thread ajay jiwanand
Hey Daniel,

That definitely looks like it can work but that would mean that I would 
have to specify one password for sudo accross all devices? As there are 
tons of devices and tons of "admin" accounts for users who are able to 
perform these action it wont be possible for me to place one password under 
ansible_become_pass. Is it possible for the password to be taken from the 
password entered when running the playbook or for the playbook to skip 
become all together when ansible_user != 'root'?

I've tried this:

become: true
when: ansible_user != 'root'

no luck

On Tuesday, July 4, 2017 at 2:05:37 AM UTC-4, Daniel JD wrote:
>
> You could use something like the following:
>
> - name: Set sudo Passwort
>   set_fact:
> ansible_become_pass: "{{ my_encrypted_password }}"
>   when: ansible_user == 'non-root-user'
>
> Am Dienstag, 4. Juli 2017 05:03:08 UTC+2 schrieb ajay jiwanand:
>>
>> I am writing a playbook that will cover a wide ranged of hosts some that 
>> is integrated into AD with sudo privileges and others with just a local 
>> "root" account. I currently have the playbook written with the become 
>> module and it works fine for AD integrated hosts but when i specify a root 
>> user it throws the error "needs sudo password" when I set become_user: root 
>> it works fine for root accounts but it gives sudo errors when using AD 
>> integrated users. Is it possible to have a playbook use sudo passwords when 
>> the user specified (through command line -u) is not root?
>>
>>
>>

-- 
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/2e724034-8195-43fa-98e0-e32425382247%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] getting key:value from fact

2017-07-04 Thread Jan Mattsson
I am trying to get back into some Ansible automation after some absence but 
get stuck immediately trying to get the IP address of an Azure VM from 
ansible facts:

ok: [localhost] => {
"*interface_facts.ansible_facts.azure_networkinterfaces*": [
{
"etag": "W/\"a4csdf-b1120d-5c9fb31354129\"",
"id": 
"/subscriptions/a444df-b1120d-5c9fb31-354129-2gbf3e5b/resourceGroups/testRG/providers/Microsoft.Network/networkInterfaces/testvm1-eth0",
"location": "westeurope",
"*properties*": {
"dnsSettings": {
"appliedDnsServers": [],
"dnsServers": [],
"internalDomainNameSuffix": 
"kttxupoc3ofsdf25452peia.ax.internal.cloudapp.net"
},
"enableIPForwarding": false,
"*ipConfigurations*": [
{
"etag": 
"W/\"ae60d652-3b57-4cfd-b10d-5c9fb11296e6\"",
"id": 
"/subscriptions/a444df-b1120d-5c9fb31-354129-2gbf3e5b/resourceGroups/testRG/providers/Microsoft.Network/networkInterfaces/testvm1-eth0/ipConfigurations/default",
"name": "default",
"*properties*": {
"privateIPAddress": "192.168.1.2",
*"privateIPAddressVersion": "IPv4",*
"privateIPAllocationMethod": "Dynamic",
"provisioningState": "Succeeded",
"subnet": {
"id": 
"/subscriptions/a444df-b1120d-5c9fb31-354129-2gbf3e5b/resourceGroups/testRG/providers/Microsoft.Network/virtualNetworks/IaaS-Vnet/subnets/IaaS-Test-FE-Subnet"
}
}
}
],
"macAddress": "0E-0D-3E-29-FE-AF",
"networkSecurityGroup": {
"id": 
"/subscriptions/a4csdf-b1120d-5c9fb31354129/resourceGroups/testRG/providers/Microsoft.Network/networkSecurityGroups/testvm1-eth001"
},
"primary": true,
"provisioningState": "Succeeded",
"resourceGuid": "a7182a83-61bc-3bed-9758-2d72f251952d",
"virtualMachine": {
"id": 
"/subscriptions/1a4csdf-b1120d-5c9fb31329-e5b/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/testvm1"
}
}
}
]
}


I Thought that I could get the IP by using 
"interface_facts.ansible_facts.azure_networkinterfaces.properties,ipConfigurations.properties.privateIPAddress

But no amounts of dots and square brackets gets me past the 
interface_facts.ansible_facts.azure_networkinterfaces level, anything below 
just responds "VARIABLE IS NOT DEFINED!"

I am pretty sure this is just a YAML list/dict noob issue, but after hours 
of searching I am still lost.

Can anyone please point me in the right direction?





-- 
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/a71513d7-57a7-425b-8733-2bc96aecb978%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Join the first Ansible Windows Sprint

2017-07-04 Thread 'jhawkesworth' via Ansible Project
Just a little reminder this is happening later today (well its later today 
in my timezone)

Hope you can join us.

Jon

On Wednesday, June 28, 2017 at 9:47:44 AM UTC+1, Dag Wieers wrote:
>
> Hi, 
>
> So one of the problems we want to tackle with Ansible Sprints is to 
> bring down the number of open issues and open PRs. The idea of doing 
> Sprints that have a strong focus on advancing and closing issues/PRs is 
> something we have been thinking about for some time. 
>
>
> Now is the time to see if this works well. If you are interested in 
> Ansible and Windows, and have some time to spare, join this event at: 
>
>  https://github.com/ansible/community/wiki/Windows:-sprints 
>
> Sign yourself up and celebrate with us the completion of the very first 
> Ansible Windows Sprint next week Tuesday 2017-07-04 at 19:00 UTC ! 
>
> No prior knowledge needed, we will learn as we go. 
>
>
> And wo knows, if this proves to be a working concept, Ansible Sprints may 
> come to a technology domain near you ;-) 
>
> Kind regards, 
> -- 
> Dag 
>

-- 
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/23ce5570-2cbf-4305-8538-563a7f4d6f6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Facing Ansible bug & how to use the most recent Ansible branch with fixed code ?

2017-07-04 Thread jean-yves
Perhaps related to :

https://github.com/ansible/ansible/pull/24768

Le 4 juillet 2017 16:00:43 GMT+02:00, P  a écrit :
>Anyone experiencing the same bug ? Or not ?
>
>On Friday, June 23, 2017 at 9:26:54 AM UTC+1, P wrote:
>>
>> Sorry - I haven't sent any update but after I sent this post did the
>same 
>> test with devel branch and have the same error.
>> Raised a bug: https://github.com/ansible/ansible/issues/25967
>>
>> On Wednesday, June 21, 2017 at 6:04:30 PM UTC+1, Brian Coca wrote:
>>>
>>> But in your error you were using (detached from v2.3.1.0-1)? 
>>>
>>>
>>> -- 
>>> 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/7f30add5-187a-43aa-a99b-6ae390eea0a4%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
Envoyé de mon appareil Android avec K-9 Mail. Veuillez excuser ma brièveté.

-- 
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/FCED2BA5-C634-42CF-8F12-04C9FEA9EDF6%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Alternative Directory Layout fails to load group_vars with -i inventories

2017-07-04 Thread Vasco Barroso
Thanks for the answer.
The group_vars and host_vars directories are adjacent to the hosts file, so 
it should work right ?
Not sure I fully understand your point about 'recursive directory'. 

I've finally solved the issue by putting individual inventories in separate 
top level directories (not under inventories): 

my-setup-1/
|-- group_vars
|   |-- group1
|   `-- group2
|-- hosts
`-- host_vars
`-- my-server1.com
my-setup-2/
|-- group_vars
|   |-- group1
|   `-- group2
|-- hosts
`-- host_vars
`-- my-server2.com


Still not optimal from my point of view, but does the job.
Funny thing, running the debug module with -i inventories 
says "inventory_file": null.
But Ansible still picks up the list of hosts (not the vars) somehow. 

Cheers,
Vasco




On Monday, July 3, 2017 at 4:21:43 PM UTC+2, Brian Coca wrote:

> The docs state that these directories must be 'adjacent to the 
> inventory file', the problem here is the 'recursive directory' as the 
> assumption when using a directory is that the inventory files are 
> contained in THAT directory and that any recursion should be added to 
> 'that file' as a multifile dir. 
>
>
> -- 
> 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/ef0374c2-9279-44ff-baa0-be99ac80ff69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Facing Ansible bug & how to use the most recent Ansible branch with fixed code ?

2017-07-04 Thread P
Anyone experiencing the same bug ? Or not ?

On Friday, June 23, 2017 at 9:26:54 AM UTC+1, P wrote:
>
> Sorry - I haven't sent any update but after I sent this post did the same 
> test with devel branch and have the same error.
> Raised a bug: https://github.com/ansible/ansible/issues/25967
>
> On Wednesday, June 21, 2017 at 6:04:30 PM UTC+1, Brian Coca wrote:
>>
>> But in your error you were using (detached from v2.3.1.0-1)? 
>>
>>
>> -- 
>> 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/7f30add5-187a-43aa-a99b-6ae390eea0a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: AWS Ansible

2017-07-04 Thread Dick Davies
No, just keep it simple and set the environment variables; then you
can't accidentally
commit credentials to a repo or use the wrong account.

http://docs.ansible.com/ansible/guide_aws.html


On 4 July 2017 at 11:33, Suporter  wrote:
> Sorry, i dont really know where to start,
> Should i save the keys in some file and refer that fiile in the playbook as
> a variable?
>
> On Tuesday, July 4, 2017 at 3:53:38 PM UTC+5:30, Dick Davies wrote:
>>
>> Sorry I thought you wanted to know about file lookups (in this case
>> it's ssh keys).
>>
>> If the -e 'credentials=/path/to/credentials' , you just need to lookup
>> the file and
>> read it's contents. Or just set environment variables before you run
>> the playbook, I
>> thought the aws related modules read the environment fine.
>>
>> On 4 July 2017 at 09:07, Suporter  wrote:
>> > Oh my god, my head is spinning. I have 3 accounts in AWS, i need to
>> > create a
>> > file for each account? and then i need to give that name in playbook?
>> >
>> > i am expecting something like this
>> >
>> > ansible-playbook newmachine.yml --extra-vars "account=myaccount"   and i
>> > want the new ec2 instance to be spinned up in that account. how can i do
>> > this?
>> >
>> > On Thursday, June 29, 2017 at 11:28:59 AM UTC+5:30, Suporter wrote:
>> >>
>> >> Hi Ansiblers,
>> >>How can i use same playbook for multiple aws accounts, can i
>> >> give
>> >> the access key and secret key as command line paramters in playbook?
>> >
>> > --
>> > 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/387b9c74-48a7-403d-b1b9-651c81b2312e%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/CAK5eLPQyV1%2Be0b4q0RWu3PZh6B-A6-L%2BuP2_o7OpWR2wVaMYBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: SSL error with gce_instance_template and ansible

2017-07-04 Thread sushrismita . mishra
If anyone is facing the same issue , hope this will solve the issue

the certifi==2015.04.28 version fixed the issue with google modules.  Not 
sure at this point , if it broke anything else.

Reference URL: https://github.com/omab/python-social-auth/issues/566

On Monday, June 19, 2017 at 9:05:29 PM UTC+5:30, sushrismi...@citrix.com 
wrote:
>
> Hi 
> I am a new bee in Ansible. I am trying to manage and create google cloud 
> properties using  ansible. However I am getting SSL related errors while 
> connecting. 
>
> I tried
> 1.. downloading the latest  cacert.pem from 
> https://curl.haxx.se/docs/caextract.html and set the variable 
> SSL_CERT_FILE. 
> 2. Downoading cacert from *googleapis.google.com with no success
>
> But no success. Could someone please let me know what SSL cert I need to 
> set to get this working ?
>
> Playbook details:
>
> - hosts: localhost
>
>   tasks:
>
> - name: create instance template
>
>   gce_instance_template: 
>
> name: case_mgmt_template
>
> size: n1-standard-2
>
> image_family: centos-7-v20170523
>
> state: present
>
> project_id: "{{ project_id }}"
>
> credentials_file: "{{ credentials_file }}"
>
> service_account_email: "{{ service_account_email }}"
>
>
> Error Details:
>
> fatal: [localhost]: FAILED! => {
>
> "changed": false, 
>
> "failed": true
>
> }
>
>
> MSG:
>
>
> Unexpected response: ([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify 
> failed (_ssl.c:579)). Detail: Traceback (most recent call last):
>
>   File 
> "/tmp/ansible_M7On7q/ansible_modlib.zip/ansible/module_utils/gcp.py", line 
> 267, in gcp_connect
>
> project=creds['project_id'])
>
>   File 
> "/usr/lib/python2.7/site-packages/apache_libcloud-2.0.0-py2.7.egg/libcloud/compute/drivers/gce.py",
>  
> line 1795, in __init__
>
> super(GCENodeDriver, self).__init__(user_id, key, **kwargs)
>
>   File 
> "/usr/lib/python2.7/site-packages/apache_libcloud-2.0.0-py2.7.egg/libcloud/common/base.py",
>  
> line 948, in __init__
>
> self.connection = self.connectionCls(*args, **conn_kwargs)
>
>   File 
> "/usr/lib/python2.7/site-packages/apache_libcloud-2.0.0-py2.7.egg/libcloud/compute/drivers/gce.py",
>  
> line 99, in __init__
>
> credential_file=credential_file, **kwargs)
>
>   File 
> "/usr/lib/python2.7/site-packages/apache_libcloud-2.0.0-py2.7.egg/libcloud/common/google.py",
>  
> line 765, in __init__
>
> user_id, key, auth_type, credential_file, scopes, **kwargs)
>
>   File 
> "/usr/lib/python2.7/site-packages/apache_libcloud-2.0.0-py2.7.egg/libcloud/common/google.py",
>  
> line 660, in __init__
>
> self.token = self.oauth2_conn.get_new_token()
>
>   File 
> "/usr/lib/python2.7/site-packages/apache_libcloud-2.0.0-py2.7.egg/libcloud/common/google.py",
>  
> line 537, in get_new_token
>
> return self._token_request(request)
>
>   File 
> "/usr/lib/python2.7/site-packages/apache_libcloud-2.0.0-py2.7.egg/libcloud/common/google.py",
>  
> line 368, in _token_request
>
> data=data)
>
>   File 
> "/usr/lib/python2.7/site-packages/apache_libcloud-2.0.0-py2.7.egg/libcloud/common/base.py",
>  
> line 603, in request
>
> headers=headers, stream=stream)
>
>   File 
> "/usr/lib/python2.7/site-packages/apache_libcloud-2.0.0-py2.7.egg/libcloud/http.py",
>  
> line 215, in request
>
> verify=self.verification
>
>   File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 461, 
> in request
>
> resp = self.send(prep, **send_kwargs)
>
>   File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 573, 
> in send
>
> r = adapter.send(request, **kwargs)
>
>   File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 431, 
> in send
>
> raise SSLError(e, request=request)
>
> SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 
> (_ssl.c:579)  
>
>
>
> Regards,
>
> Sushri
>

-- 
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/ae16150a-05b3-4795-af89-566436d0ec8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: AWS Ansible

2017-07-04 Thread Suporter
Sorry, i dont really know where to start, 
Should i save the keys in some file and refer that fiile in the playbook as 
a variable?

On Tuesday, July 4, 2017 at 3:53:38 PM UTC+5:30, Dick Davies wrote:
>
> Sorry I thought you wanted to know about file lookups (in this case 
> it's ssh keys). 
>
> If the -e 'credentials=/path/to/credentials' , you just need to lookup 
> the file and 
> read it's contents. Or just set environment variables before you run 
> the playbook, I 
> thought the aws related modules read the environment fine. 
>
> On 4 July 2017 at 09:07, Suporter > 
> wrote: 
> > Oh my god, my head is spinning. I have 3 accounts in AWS, i need to 
> create a 
> > file for each account? and then i need to give that name in playbook? 
> > 
> > i am expecting something like this 
> > 
> > ansible-playbook newmachine.yml --extra-vars "account=myaccount"   and i 
> > want the new ec2 instance to be spinned up in that account. how can i do 
> > this? 
> > 
> > On Thursday, June 29, 2017 at 11:28:59 AM UTC+5:30, Suporter wrote: 
> >> 
> >> Hi Ansiblers, 
> >>How can i use same playbook for multiple aws accounts, can i 
> give 
> >> the access key and secret key as command line paramters in playbook? 
> > 
> > -- 
> > 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/387b9c74-48a7-403d-b1b9-651c81b2312e%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/9463c552-7f3b-4287-9c6d-c09ad2360a2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: AWS Ansible

2017-07-04 Thread Dick Davies
Sorry I thought you wanted to know about file lookups (in this case
it's ssh keys).

If the -e 'credentials=/path/to/credentials' , you just need to lookup
the file and
read it's contents. Or just set environment variables before you run
the playbook, I
thought the aws related modules read the environment fine.

On 4 July 2017 at 09:07, Suporter  wrote:
> Oh my god, my head is spinning. I have 3 accounts in AWS, i need to create a
> file for each account? and then i need to give that name in playbook?
>
> i am expecting something like this
>
> ansible-playbook newmachine.yml --extra-vars "account=myaccount"   and i
> want the new ec2 instance to be spinned up in that account. how can i do
> this?
>
> On Thursday, June 29, 2017 at 11:28:59 AM UTC+5:30, Suporter wrote:
>>
>> Hi Ansiblers,
>>How can i use same playbook for multiple aws accounts, can i give
>> the access key and secret key as command line paramters in playbook?
>
> --
> 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/387b9c74-48a7-403d-b1b9-651c81b2312e%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/CAK5eLPSw1XxCzH9HHohP23my-tH1qx%3DnypXCqEEn_rEdEp%2BJkA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: AWS Ansible

2017-07-04 Thread Suporter
Oh my god, my head is spinning. I have 3 accounts in AWS, i need to create 
a file for each account? and then i need to give that name in playbook?

i am expecting something like this

ansible-playbook newmachine.yml --extra-vars "account=myaccount"   and i 
want the new ec2 instance to be spinned up in that account. how can i do 
this?

On Thursday, June 29, 2017 at 11:28:59 AM UTC+5:30, Suporter wrote:
>
> Hi Ansiblers,
>How can i use same playbook for multiple aws accounts, can i give 
> the access key and secret key as command line paramters in playbook?
>

-- 
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/387b9c74-48a7-403d-b1b9-651c81b2312e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: starting karaf with ansble

2017-07-04 Thread fanvalt
Sorry I finally found out the issue was not in the start command and then 
happens in both ways , manually and with ansible.
Don't pay attention to this ticket, I will keep searching about the issue 
but it has no link with an ansible issue.

Thank you for your help,
Regards

Le mardi 4 juillet 2017 09:48:50 UTC+2, Dick Davies a écrit :
>
> Is this an init script? It sounds like it relies on something in the 
> environment. 
> Does it start at boot cleanly? If not, that's almost certainly the 
> issue, you might 
> find setting some variables explicitly in the init script sorts things 
> out. 
>
> On 4 July 2017 at 08:31, fanvalt > 
> wrote: 
> > I did display the variables when running the 
> > start command and I cannot find out which variable would be a problem. 
> > Any clue ? 
> > Regards 
> > 
> > Here are the variables set when the error message is displayed: 
> > A__z='"*SHLVL="*TMOUT' 
> > BASH=/bin/sh 
> > 
> BASHOPTS=cmdhist:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
>  
>
> > BASH_ALIASES=() 
> > BASH_ARGC=([0]="1" [1]="2") 
> > BASH_ARGV=([0]="/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/setenv" 
> > [1]="clean" [2]="server") 
> > BASH_CMDS=() 
> > BASH_LINENO=([0]="12" [1]="0") 
> > BASH_SOURCE=([0]="/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/setenv" 
> > [1]="/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/foryou") 
> > BASH_VERSINFO=([0]="4" [1]="2" [2]="46" [3]="1" [4]="release" 
> > [5]="x86_64-redhat-linux-gnu") 
> > BASH_VERSION='4.2.46(1)-release' 
> > CURRENTDIR=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin 
> > DIRNAME=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin 
> > DIRSTACK=() 
> > EDITOR=vi 
> > EUID=21175 
> > FCEDIT=vi 
> > GROUPS=() 
> > HISTEDIT=vi 
> > HISTFILESIZE=1000 
> > HISTSIZE=128 
> > HOME=/home/4you 
> > HOSTNAME=server1 
> > HOSTTYPE=x86_64 
> > IFS=' 
> > ' 
> > KARAF_SCRIPT=foryou 
> > LOG=/shr_4you/current/logs 
> > LOGNAME=4you 
> > MACHINE=x86_64-unknown-linux-gnu 
> > MACHTYPE=x86_64-redhat-linux-gnu 
> > MAIL=/var/spool/mail/4you 
> > MANPATH=/usr/share/man:/sopra/tools/man 
> > OLDPWD=/shr_4you 
> > OPTERR=1 
> > OPTIND=1 
> > OSTYPE=linux-gnu 
> > PAGER=more 
> > 
> PATH=/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/doi/pjunix/4.1/usrbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/sopra/tools/bin:/sopra/tools/sbin
>  
>
> > PIPESTATUS=([0]="0") 
> > POSIXLY_CORRECT=y 
> > PPID=1 
> > PROGNAME=foryou 
> > PS4='+ ' 
> > SHELL=/usr/bin/ksh 
> > SHELLOPTS=braceexpand:hashall:interactive-comments:posix 
> > SHLVL=5 
> > SIGACS=/shr_4you 
> > SSH_CLIENT='172.21.18.35 49739 22' 
> > SSH_CONNECTION='172.21.18.35 49739 10.7.1.4 22' 
> > SSH_TTY=/dev/pts/2 
> > TERM=xterm 
> > TMOUT=7200 
> > TMP=/shr_4you/current/temp 
> > UID=21175 
> > UNZIP_HOME=/hrasdlcusers/build-tools/unzip/current 
> > USER=4you 
> > _=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin 
> > http_proxy=None 
> > https_proxy=None 
> > 
> > Here are the variables set when the start command is running withour 
> error 
> > message: 
> > _=*3622*/usr/bin/env 
> > EDITOR=vi 
> > FCEDIT=vi 
> > HISTEDIT=vi 
> > HISTFILESIZE=1000 
> > HISTSIZE=128 
> > HOME=/home/4you 
> > HOSTNAME=server1 
> > JAVACMD=/hrasdlcusers/build-tools/java/current/bin/java 
> > JAVA_HOME=/hrasdlcusers/build-tools/java/current 
> > LOG=/shr_4you/current/logs 
> > LOGNAME=4you 
> > MACHINE=x86_64-unknown-linux-gnu 
> > MAIL=/var/spool/mail/4you 
> > MANPATH=/usr/share/man:/sopra/tools/man 
> > PAGER=more 
> > 
> PATH=/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/doi/pjunix/4.1/usrbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/sopra/tools/bin:/sopra/tools/sbin
>  
>
> > SHELL=/usr/bin/ksh 
> > SHLVL=1 
> > SIGACS=/shr_4you 
> > SSH_CLIENT=172.21.18.35 49739 22 
> > SSH_CONNECTION=172.21.18.35 49739 10.7.1.4 22 
> > SSH_TTY=/dev/pts/2 
> > TERM=xterm 
> > TMOUT=7200 
> > TMP=/shr_4you/current/temp 
> > UNZIP_HOME=/hrasdlcusers/build-tools/unzip/current 
> > USER=4you 
> > A__z="*SHLVL="*TMOUT 
> > 
> > Le mercredi 28 juin 2017 17:04:40 UTC+2, J Hawkesworth a écrit : 
> >> 
> >> 
> >> Maybe your application needs some environment variables which aren't 
> set 
> >> when ansible runs the command. 
> >> 
> >> You can set specific environment variables though - see 
> >> http://docs.ansible.com/ansible/playbooks_environment.html 
> >> 
> >> Jon 
> >> On Wednesday, June 28, 2017 at 3:20:21 PM UTC+1, fanvalt wrote: 
> >>> 
> >>> Hello, 
> >>> 
> >>> If I run karaf manually with the start command, I have no error. 
> >>> But if I run the start command in a ansible task, I have the following 
> >>> command: 
> >>> 
> >>> 347 [sshd-SshClient[7a4ccb53]-nio2-thread-1] WARN 
> >>> org.apache.sshd.client.session.ClientSessionImpl - Exception caught 
> >>> java.lang.I

Re: [ansible-project] Re: starting karaf with ansble

2017-07-04 Thread Dick Davies
Is this an init script? It sounds like it relies on something in the
environment.
Does it start at boot cleanly? If not, that's almost certainly the
issue, you might
find setting some variables explicitly in the init script sorts things out.

On 4 July 2017 at 08:31, fanvalt  wrote:
> I did display the variables when running the
> start command and I cannot find out which variable would be a problem.
> Any clue ?
> Regards
>
> Here are the variables set when the error message is displayed:
> A__z='"*SHLVL="*TMOUT'
> BASH=/bin/sh
> BASHOPTS=cmdhist:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
> BASH_ALIASES=()
> BASH_ARGC=([0]="1" [1]="2")
> BASH_ARGV=([0]="/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/setenv"
> [1]="clean" [2]="server")
> BASH_CMDS=()
> BASH_LINENO=([0]="12" [1]="0")
> BASH_SOURCE=([0]="/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/setenv"
> [1]="/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/foryou")
> BASH_VERSINFO=([0]="4" [1]="2" [2]="46" [3]="1" [4]="release"
> [5]="x86_64-redhat-linux-gnu")
> BASH_VERSION='4.2.46(1)-release'
> CURRENTDIR=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin
> DIRNAME=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin
> DIRSTACK=()
> EDITOR=vi
> EUID=21175
> FCEDIT=vi
> GROUPS=()
> HISTEDIT=vi
> HISTFILESIZE=1000
> HISTSIZE=128
> HOME=/home/4you
> HOSTNAME=server1
> HOSTTYPE=x86_64
> IFS='
> '
> KARAF_SCRIPT=foryou
> LOG=/shr_4you/current/logs
> LOGNAME=4you
> MACHINE=x86_64-unknown-linux-gnu
> MACHTYPE=x86_64-redhat-linux-gnu
> MAIL=/var/spool/mail/4you
> MANPATH=/usr/share/man:/sopra/tools/man
> OLDPWD=/shr_4you
> OPTERR=1
> OPTIND=1
> OSTYPE=linux-gnu
> PAGER=more
> PATH=/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/doi/pjunix/4.1/usrbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/sopra/tools/bin:/sopra/tools/sbin
> PIPESTATUS=([0]="0")
> POSIXLY_CORRECT=y
> PPID=1
> PROGNAME=foryou
> PS4='+ '
> SHELL=/usr/bin/ksh
> SHELLOPTS=braceexpand:hashall:interactive-comments:posix
> SHLVL=5
> SIGACS=/shr_4you
> SSH_CLIENT='172.21.18.35 49739 22'
> SSH_CONNECTION='172.21.18.35 49739 10.7.1.4 22'
> SSH_TTY=/dev/pts/2
> TERM=xterm
> TMOUT=7200
> TMP=/shr_4you/current/temp
> UID=21175
> UNZIP_HOME=/hrasdlcusers/build-tools/unzip/current
> USER=4you
> _=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin
> http_proxy=None
> https_proxy=None
>
> Here are the variables set when the start command is running withour error
> message:
> _=*3622*/usr/bin/env
> EDITOR=vi
> FCEDIT=vi
> HISTEDIT=vi
> HISTFILESIZE=1000
> HISTSIZE=128
> HOME=/home/4you
> HOSTNAME=server1
> JAVACMD=/hrasdlcusers/build-tools/java/current/bin/java
> JAVA_HOME=/hrasdlcusers/build-tools/java/current
> LOG=/shr_4you/current/logs
> LOGNAME=4you
> MACHINE=x86_64-unknown-linux-gnu
> MAIL=/var/spool/mail/4you
> MANPATH=/usr/share/man:/sopra/tools/man
> PAGER=more
> PATH=/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/doi/pjunix/4.1/usrbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/sopra/tools/bin:/sopra/tools/sbin
> SHELL=/usr/bin/ksh
> SHLVL=1
> SIGACS=/shr_4you
> SSH_CLIENT=172.21.18.35 49739 22
> SSH_CONNECTION=172.21.18.35 49739 10.7.1.4 22
> SSH_TTY=/dev/pts/2
> TERM=xterm
> TMOUT=7200
> TMP=/shr_4you/current/temp
> UNZIP_HOME=/hrasdlcusers/build-tools/unzip/current
> USER=4you
> A__z="*SHLVL="*TMOUT
>
> Le mercredi 28 juin 2017 17:04:40 UTC+2, J Hawkesworth a écrit :
>>
>>
>> Maybe your application needs some environment variables which aren't set
>> when ansible runs the command.
>>
>> You can set specific environment variables though - see
>> http://docs.ansible.com/ansible/playbooks_environment.html
>>
>> Jon
>> On Wednesday, June 28, 2017 at 3:20:21 PM UTC+1, fanvalt wrote:
>>>
>>> Hello,
>>>
>>> If I run karaf manually with the start command, I have no error.
>>> But if I run the start command in a ansible task, I have the following
>>> command:
>>>
>>> 347 [sshd-SshClient[7a4ccb53]-nio2-thread-1] WARN
>>> org.apache.sshd.client.session.ClientSessionImpl - Exception caught
>>> java.lang.IllegalStateException: Unable to negotiate key exchange for kex
>>> algorithms (client:
>>> ecdh-sha2-nistp256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp384,ecdh-sha2-nistp521,ecdh-sha2-nistp521
>>> / server:
>>> diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1)
>>> at
>>> org.apache.sshd.common.session.AbstractSession.negotiate(AbstractSession.java:1159)
>>> at
>>> org.apache.sshd.common.session.AbstractSession.doHandleMessage(AbstractSession.java:388)
>>> at
>>> org.apache.sshd.common.session.AbstractSession.handleMessage(AbstractSession.java:326)
>>> at
>>> org.apache.sshd.client.session.ClientSessionImpl.handleMessage(ClientSessionImpl.java:306)
>>> at

Re: [ansible-project] Re: AWS Ansible

2017-07-04 Thread Dick Davies
Yes, you can use lookups, like this

- name: set authorized_keys
authorized_key: user={{ item }} exclusive=yes
key="{{ lookup('file', 'files/pubkeys/{{ item }}.key') }}"
with_items: "{{ team_members[team] }}"

 team_members[team] here is a list of usernames,
the files live in rolename/files/pubkeys/$username.key

original role is here :
https://github.com/rasputnik/ansible-sshteams/blob/master/roles/teams/tasks/team.yml



On 4 July 2017 at 08:32, Suporter  wrote:
> Is there a way to store all accounts keys as some files and call them as
> extra vars in playbook?
>
> On Monday, July 3, 2017 at 2:28:29 PM UTC+5:30, Darragh Grealish wrote:
>>
>> Yes, you pass them as extra-vars, but there are many ways to do this, just
>> watch out where you run your playbook and if AWS ENV variables are already
>> set, as boto will take this into account also.
>> best to understand better the AWS credentials and profiles
>>
>> http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html#credentials-default
>>
>> On Monday, 3 July 2017 07:28:33 UTC+2, Suporter wrote:
>>>
>>> Any help?
>>>
>>> On Thursday, June 29, 2017 at 11:28:59 AM UTC+5:30, Suporter wrote:

 Hi Ansiblers,
How can i use same playbook for multiple aws accounts, can i give
 the access key and secret key as command line paramters in playbook?
>
> --
> 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/5edfad13-4420-4826-a70e-5bfbd56cec86%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/CAK5eLPRd8PquR21OnsMO-nMLg_9HKW%3DrRr2wN4OKZ_n47JhJVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: AWS Ansible

2017-07-04 Thread Suporter
Is there a way to store all accounts keys as some files and call them as 
extra vars in playbook?

On Monday, July 3, 2017 at 2:28:29 PM UTC+5:30, Darragh Grealish wrote:
>
> Yes, you pass them as extra-vars, but there are many ways to do this, just 
> watch out where you run your playbook and if AWS ENV variables are already 
> set, as boto will take this into account also.
> best to understand better the AWS credentials and profiles
>
> http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html#credentials-default
>  
>
> On Monday, 3 July 2017 07:28:33 UTC+2, Suporter wrote:
>>
>> Any help?
>>
>> On Thursday, June 29, 2017 at 11:28:59 AM UTC+5:30, Suporter wrote:
>>>
>>> Hi Ansiblers,
>>>How can i use same playbook for multiple aws accounts, can i give 
>>> the access key and secret key as command line paramters in playbook?
>>>
>>

-- 
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/5edfad13-4420-4826-a70e-5bfbd56cec86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: starting karaf with ansble

2017-07-04 Thread fanvalt
I did display the variables when running the 
start command and I cannot find out which variable would be a problem.
Any clue ?
Regards

Here are the variables set when the error message is displayed:
A__z='"*SHLVL="*TMOUT'
BASH=/bin/sh
BASHOPTS=cmdhist:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=([0]="1" [1]="2")
BASH_ARGV=([0]="/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/setenv" 
[1]="clean" [2]="server")
BASH_CMDS=()
BASH_LINENO=([0]="12" [1]="0")
BASH_SOURCE=([0]="/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/setenv" 
[1]="/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/foryou")
BASH_VERSINFO=([0]="4" [1]="2" [2]="46" [3]="1" [4]="release" 
[5]="x86_64-redhat-linux-gnu")
BASH_VERSION='4.2.46(1)-release'
CURRENTDIR=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin
DIRNAME=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin
DIRSTACK=()
EDITOR=vi
EUID=21175
FCEDIT=vi
GROUPS=()
HISTEDIT=vi
HISTFILESIZE=1000
HISTSIZE=128
HOME=/home/4you
HOSTNAME=server1
HOSTTYPE=x86_64
IFS='
'
KARAF_SCRIPT=foryou
LOG=/shr_4you/current/logs
LOGNAME=4you
MACHINE=x86_64-unknown-linux-gnu
MACHTYPE=x86_64-redhat-linux-gnu
MAIL=/var/spool/mail/4you
MANPATH=/usr/share/man:/sopra/tools/man
OLDPWD=/shr_4you
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PAGER=more
PATH=/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/doi/pjunix/4.1/usrbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/sopra/tools/bin:/sopra/tools/sbin
PIPESTATUS=([0]="0")
POSIXLY_CORRECT=y
PPID=1
PROGNAME=foryou
PS4='+ '
SHELL=/usr/bin/ksh
SHELLOPTS=braceexpand:hashall:interactive-comments:posix
SHLVL=5
SIGACS=/shr_4you
SSH_CLIENT='172.21.18.35 49739 22'
SSH_CONNECTION='172.21.18.35 49739 10.7.1.4 22'
SSH_TTY=/dev/pts/2
TERM=xterm
TMOUT=7200
TMP=/shr_4you/current/temp
UID=21175
UNZIP_HOME=/hrasdlcusers/build-tools/unzip/current
USER=4you
_=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin
http_proxy=None
https_proxy=None

Here are the variables set when the start command is running withour error 
message:
_=*3622*/usr/bin/env
EDITOR=vi
FCEDIT=vi
HISTEDIT=vi
HISTFILESIZE=1000
HISTSIZE=128
HOME=/home/4you
HOSTNAME=server1
JAVACMD=/hrasdlcusers/build-tools/java/current/bin/java
JAVA_HOME=/hrasdlcusers/build-tools/java/current
LOG=/shr_4you/current/logs
LOGNAME=4you
MACHINE=x86_64-unknown-linux-gnu
MAIL=/var/spool/mail/4you
MANPATH=/usr/share/man:/sopra/tools/man
PAGER=more
PATH=/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/doi/pjunix/4.1/usrbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/sopra/tools/bin:/sopra/tools/sbin
SHELL=/usr/bin/ksh
SHLVL=1
SIGACS=/shr_4you
SSH_CLIENT=172.21.18.35 49739 22
SSH_CONNECTION=172.21.18.35 49739 10.7.1.4 22
SSH_TTY=/dev/pts/2
TERM=xterm
TMOUT=7200
TMP=/shr_4you/current/temp
UNZIP_HOME=/hrasdlcusers/build-tools/unzip/current
USER=4you
A__z="*SHLVL="*TMOUT

Le mercredi 28 juin 2017 17:04:40 UTC+2, J Hawkesworth a écrit :
>
>
> Maybe your application needs some environment variables which aren't set 
> when ansible runs the command.
>
> You can set specific environment variables though - see 
> http://docs.ansible.com/ansible/playbooks_environment.html
>
> Jon
> On Wednesday, June 28, 2017 at 3:20:21 PM UTC+1, fanvalt wrote:
>>
>> Hello,
>>
>> If I run karaf manually with the start command, I have no error.
>> But if I run the start command in a ansible task, I have the following 
>> command:
>>
>> 347 [sshd-SshClient[7a4ccb53]-nio2-thread-1] WARN 
>> org.apache.sshd.client.session.ClientSessionImpl - Exception caught
>> java.lang.IllegalStateException: Unable to negotiate key exchange for kex 
>> algorithms (client: 
>> ecdh-sha2-nistp256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp384,ecdh-sha2-nistp521,ecdh-sha2-nistp521
>>  
>> / server: 
>> diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1)
>> at 
>> org.apache.sshd.common.session.AbstractSession.negotiate(AbstractSession.java:1159)
>> at 
>> org.apache.sshd.common.session.AbstractSession.doHandleMessage(AbstractSession.java:388)
>> at 
>> org.apache.sshd.common.session.AbstractSession.handleMessage(AbstractSession.java:326)
>> at 
>> org.apache.sshd.client.session.ClientSessionImpl.handleMessage(ClientSessionImpl.java:306)
>> at 
>> org.apache.sshd.common.session.AbstractSession.decode(AbstractSession.java:780)
>> at 
>> org.apache.sshd.common.session.AbstractSession.messageReceived(AbstractSession.java:308)
>> at 
>> org.apache.sshd.common.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:54)
>> at 
>> org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:184)
>> at 
>> org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:170

Re: [ansible-project] get_url runs but doesnt download the file

2017-07-04 Thread 'J Hawkesworth' via Ansible Project
The output above seems to be saying that the file /home/ansible/index.html 
is present on 10.10.0.5.

If you are expecting the file to be re-downloaded each time the playbook 
runs, then set 'force: yes' in your playbook, otherwise it will not attempt 
to fetch the file again.

Jon

On Monday, July 3, 2017 at 6:02:11 PM UTC+1, Anfield wrote:
>
> Hi. What I am expecting is just for the file to be downloaded from the 
> remote host to the local (again both vms')
>
> The output tells me that it has run (and flagged as changed) - but when I 
> look into the local target dir - the file is never there..am I  missing 
> something?
>
>
>

-- 
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/7dcf7dd8-5888-456a-905d-c18b5e1b2dea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] is it possible to open a file locally, read the content and push it to a remote host?

2017-07-04 Thread Kai Stian Olstad

On 03.07.2017 20:14, Danilo Braga wrote:
But with the "with_lines", is it possible to run the command remotely 
at

the switch?


with_lines do not have this ability, it only read one line at a time and 
hand it over to the module.

So if the module run on the remote, it will run on the remote.

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