[ansible-project] inventory file in jenkins server

2016-09-01 Thread Edson Noboru Yamada
I have several hosts to manage and, in order to access them, i have to use
a couple of different ssh keys (and I set the ansible_ssh_private_key_file
in the inventory file to tell ansible which key to use).

The thing is that i've been maintaining 2 inventory files versions (which
is a pain): one for my station (where ansible_ssh_private_key_file  points
to my home dir -- /home/enyamada/.ssh) and other for jenkins server
(with ansible_ssh_private_key_file  pointing to /var/jenkins/.ssh files).
Everything else is the same.

What's the best way to circumvent this problem? (and keep a single version?)

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/CANo%3DurZBEqwC5gaq58Sf5GFxnV2LCFTg7M5qxK%2B-w1K36rKshg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Stuck deploying templated configs for multiple users with with_items

2016-09-01 Thread Patrick Laimbock

Hi Kai,

On 01-09-16 22:46, Kai Stian Olstad wrote:


Are you trying to make all the users on all the sites?
If so, check out with_nested
https://docs.ansible.com/ansible/playbooks_loops.html#nested-loops


Thank you for your suggestion. That was the solution :) In #ansible 
agaffney mentioned that with_nested couldn't handle looping over a dict. 
So I changed the dict to a list and now it's working.


Thanks again,
Patrick

--
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/c04c22f9-0a5f-ef30-604e-a67dd927374c%40laimbock.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] docker_login and GCR

2016-09-01 Thread Dmitry Makovey
is anyone using docker_login with Google Cloud Registry?

I am attempting to do so by defining variable for auth token:

gcloud_token_file: gcp_sa_account.json
gcloud_token: "{{ lookup('file', gcloud_token_file) }}"

and then trying to login:

docker_login: username="_json_key" password="{{ gcloud_token | to_json | 
quote }}" email="{{ docker_auth_email }}" registry="gcr.io" reauthorize=
"yes"

it looks like ansible instead of picking up "raw" contents of the file 
auto-converts it into structure as soon as it notices JSON so I have to 
"un-convert" it with to_json, however as soon as I do that it seems like 
escaping/quoting goes out the window and I am unable to get login to work 
as expected. Using the same gcp_sa_account.json I can login just find using 

docker login -e s...@email.com -u _json_key -p "$(cat gcp_sa_account.json)" 
https://gcr.io

I looked online and couldn't find any samples of people using it. is it 
just not meant to be functional with GCR?

-- 
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/d2377c28-6dc7-4561-b27a-6dbf983e7df9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Reuse a role in different playbooks

2016-09-01 Thread Alan Evangelista
I current have one playbook for each application in my infrastructure: one 
for Gerrit, one for Jenkins, etc. Current filesystem structure:

playbooks
  |
   gerrit
  |
  --- roles
   |
 postfix
   jenkins
  |
  --- master.yml
  --- roles
   |
 postfix

My Jenkins master node setup playbook has something like:

- name: Setup Jenkins master node
  hosts: jenkins-master
  remote_user: root
  roles:
- selinux
- epel
- packages
- user
- sudo
- jenkins
- nginx
- systemd
- firewalld
- nfs
- ssh
- postfix

The gerrit setup playbook is similar.


- name: Setup Gerrit
  hosts: gerrit
  remote_user: root
  roles:
- selinux
- epel
- packages
- gerrit
- systemd
- firewalld
- postfix

I'd like to reuse the postfix email server role used in Gerrit playbook in 
the Jenkins playbook. Currently, it is duplicated. Is that possible or 
should I use a different Ansible files organization to achieve the reuse I 
desire? 

-- 
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/2b9ff3ae-78a3-4239-a6c1-cb6a854a066e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Stuck deploying templated configs for multiple users with with_items

2016-09-01 Thread Kai Stian Olstad

On 01. sep. 2016 22:20, Patrick Laimbock wrote:

Variables:

---

openvpn_networks:
  site1:
openvpn_config: site1-server1
  site2:
openvpn_config: site2-server1

openvpn_users:
  - name: patrick
base: /home/
  - name: test
base: /home/


The task below works (apologies for the wrapping):

ansible/roles/openvpn/client/tasks/main.yml

---

- name: install openvpn NetworkManager client config(s)
  template:
src: "{{ item }}/openvpn_networks[item].openvpn_config }}.j2"
dest: "/home/patrick/{{openvpn_networks[item].openvpn_config }}.ovpn"
mode: 0644
  with_items:
- '{{ openvpn_networks | list }}'


But I can't figure out how to do this for multiple users as it fails
with: the field 'args' has an invalid value, which appears to include a
variable that is undefined. The error was: 'unicode object' has no
attribute 'base'

- name: install multi-user openvpn NetworkManager client config(s)
  template:
src: "{{ item }}/{{ openvpn_networks[item].openvpn_config }}.j2"
dest: "{{ item.2.base }}/{{ item.2.name }}/test/{{
openvpn_networks[item].openvpn_config }}.ovpn"
owner: "{{ item.2.name }}"
group: "{{ item.2.name }}"
mode: 0644
  with_items:
- '{{ openvpn_networks | list }}'
- '{{ openvpn_users }}'


How to make this work (possibly in a better way)?


Are you trying to make all the users on all the sites?
If so, check out with_nested
https://docs.ansible.com/ansible/playbooks_loops.html#nested-loops

--
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/8b96d8ba-645b-d5a1-db00-20a83c6b2055%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Stuck deploying templated configs for multiple users with with_items

2016-09-01 Thread Patrick Laimbock

Hi,


I want to deploy a couple of OpenVPN configs to multiple users. It works 
for a single user but now I'm stuck trying to make it work for multiple 
users. Anyone have a suggestion how to make this work?


Variables:

---

openvpn_networks:
  site1:
openvpn_config: site1-server1
  site2:
openvpn_config: site2-server1

openvpn_users:
  - name: patrick
base: /home/
  - name: test
base: /home/


The task below works (apologies for the wrapping):

ansible/roles/openvpn/client/tasks/main.yml

---

- name: install openvpn NetworkManager client config(s)
  template:
src: "{{ item }}/openvpn_networks[item].openvpn_config }}.j2"
dest: "/home/patrick/{{openvpn_networks[item].openvpn_config }}.ovpn"
mode: 0644
  with_items:
- '{{ openvpn_networks | list }}'


But I can't figure out how to do this for multiple users as it fails 
with: the field 'args' has an invalid value, which appears to include a 
variable that is undefined. The error was: 'unicode object' has no 
attribute 'base'


- name: install multi-user openvpn NetworkManager client config(s)
  template:
src: "{{ item }}/{{ openvpn_networks[item].openvpn_config }}.j2"
dest: "{{ item.2.base }}/{{ item.2.name }}/test/{{ 
openvpn_networks[item].openvpn_config }}.ovpn"

owner: "{{ item.2.name }}"
group: "{{ item.2.name }}"
mode: 0644
  with_items:
- '{{ openvpn_networks | list }}'
- '{{ openvpn_users }}'


How to make this work (possibly in a better way)?

Thanks a bunch!
Patrick

--
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/405dc493-5cf8-3b77-881b-462a5f3a86c6%40laimbock.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Generate number sequence for dynamic server inventory

2016-09-01 Thread titleistfour
Hello,

I'm currently building some servers in AWS.  A set of servers will need a 
sequence of keys generated for each server like so, with a template that 
get's pushed out.

# server 1
9011
9012
9013

# server 2
9021
9022
9023

# server 3
9031
9032
9033

If my inventory is dynamic, what is a good Ansible-ish way of handling 
this?  I know I can do a "with_sequence: start=1 end=3", but that same 
'with' statement does the same thing on all 3 servers.  I normally would 
use a host_var, but since the inventory is dynamic, I can't do that.  At 
least I don't think I can.

Any ideas?

Thanks,
Jay

-- 
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/c4361ba7-5c89-4e28-8f84-cd7d7cc886f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread ZillaYT
Much better solution. Thanks!

I ended up doing this

- include_vars: "roles/syslog/vars/{{ ansible_os_family }}-{{ 
ansible_distribution_major_version }}.yml"


On Thursday, September 1, 2016 at 2:07:23 PM UTC-4, Allen Sanabria wrote:
>
> include_vars is your friend.
>
> For instance in tasks you can say..
>
> ```yaml
> - include_vars: RedHat6.yml
>   when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "6"
>
> - include_vars: RedHat7.yml
>   when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "7"
> ```
>
> On Thu, Sep 1, 2016 at 10:54 AM, ZillaYT  
> wrote:
>
>> Having a lot of -name/when task blocks is just ugly infrastructure. I 
>> have to think of a better way. There's GOT to be a better way.
>>
>>
>> On Thursday, September 1, 2016 at 1:45:02 PM UTC-4, Kai Stian Olstad 
>> wrote:
>>>
>>> On 01. sep. 2016 18:02, ZillaYT wrote: 
>>> > I'm writing a role to configure syslog, and of course the service is 
>>> > different between Linux instances. How do I do this in var/main.yml? 
>>>
>>> The directory must be vars not var. 
>>>
>>>
>>> > # pseudo-code in vars/main.yml 
>>> > if Redhat7.x 
>>> >   syslog_service: rsyslog 
>>> > else if RedHat6.x 
>>> >   syslog_service: syslog 
>>> > end 
>>>
>>> It's not possible, vars/main.yml can only contain variable definitions, 
>>> not logic. 
>>>
>>>
>>> > So then I can just do this in tasks/main.yml 
>>> > 
>>> > - name: Ensure syslog is running 
>>> >   service: name="{{ syslog_service }}" state=running enabled=yes 
>>>
>>> You must split it in two tasks. 
>>> ansible_os_family and ansible_lsb.major_release values is probably wrong 
>>> so you need to find the correct ones. 
>>>
>>> - name: Ensure syslog is running on Redhat 6.x 
>>>service: name=syslog state=running enabled=yes 
>>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release == 
>>> "6" 
>>>
>>> - name: Ensure syslog is running on Redhat 7.x 
>>>service: name=rsyslog state=running enabled=yes 
>>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release == 
>>> "7" 
>>>
>>> -- 
>>> 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-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/5b1c97fc-2e65-4c7d-a32c-911f1ddeedca%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/18791881-1d8b-4417-82d8-4f41d1d78286%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread Matt Martz
Additionally you can make syslog_service a dictionary value with keys for
the different versions:

vars/main.yml

syslog_service:
"6": syslog
"7": rsyslog

Then just do:

- name: Ensure syslog is running
  service: name="{{ syslog_service[ansible_distribution_major_version] }}"
state=running enabled=yes

On Thu, Sep 1, 2016 at 1:04 PM, Allen Sanabria 
wrote:

> include_vars is your friend.
>
> For instance in tasks/main.yml you can say..
> - include_vars: RedHat6.yml
>  when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "6"
>
> - include_vars: RedHat7.yml
>  when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "7"
>
>
>
> On Thursday, September 1, 2016 at 10:54:25 AM UTC-7, ZillaYT wrote:
>>
>> Having a lot of -name/when task blocks is just ugly infrastructure. I
>> have to think of a better way. There's GOT to be a better way.
>>
>> On Thursday, September 1, 2016 at 1:45:02 PM UTC-4, Kai Stian Olstad
>> wrote:
>>>
>>> On 01. sep. 2016 18:02, ZillaYT wrote:
>>> > I'm writing a role to configure syslog, and of course the service is
>>> > different between Linux instances. How do I do this in var/main.yml?
>>>
>>> The directory must be vars not var.
>>>
>>>
>>> > # pseudo-code in vars/main.yml
>>> > if Redhat7.x
>>> >   syslog_service: rsyslog
>>> > else if RedHat6.x
>>> >   syslog_service: syslog
>>> > end
>>>
>>> It's not possible, vars/main.yml can only contain variable definitions,
>>> not logic.
>>>
>>>
>>> > So then I can just do this in tasks/main.yml
>>> >
>>> > - name: Ensure syslog is running
>>> >   service: name="{{ syslog_service }}" state=running enabled=yes
>>>
>>> You must split it in two tasks.
>>> ansible_os_family and ansible_lsb.major_release values is probably wrong
>>> so you need to find the correct ones.
>>>
>>> - name: Ensure syslog is running on Redhat 6.x
>>>service: name=syslog state=running enabled=yes
>>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release ==
>>> "6"
>>>
>>> - name: Ensure syslog is running on Redhat 7.x
>>>service: name=rsyslog state=running enabled=yes
>>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release ==
>>> "7"
>>>
>>> --
>>> 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/e03d4afd-fbf1-4a66-af09-e01083bb451e%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

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


Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread Allen Sanabria
include_vars is your friend.

For instance in tasks you can say..

```yaml
- include_vars: RedHat6.yml
  when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "6"

- include_vars: RedHat7.yml
  when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "7"
```

On Thu, Sep 1, 2016 at 10:54 AM, ZillaYT  wrote:

> Having a lot of -name/when task blocks is just ugly infrastructure. I have
> to think of a better way. There's GOT to be a better way.
>
>
> On Thursday, September 1, 2016 at 1:45:02 PM UTC-4, Kai Stian Olstad wrote:
>>
>> On 01. sep. 2016 18:02, ZillaYT wrote:
>> > I'm writing a role to configure syslog, and of course the service is
>> > different between Linux instances. How do I do this in var/main.yml?
>>
>> The directory must be vars not var.
>>
>>
>> > # pseudo-code in vars/main.yml
>> > if Redhat7.x
>> >   syslog_service: rsyslog
>> > else if RedHat6.x
>> >   syslog_service: syslog
>> > end
>>
>> It's not possible, vars/main.yml can only contain variable definitions,
>> not logic.
>>
>>
>> > So then I can just do this in tasks/main.yml
>> >
>> > - name: Ensure syslog is running
>> >   service: name="{{ syslog_service }}" state=running enabled=yes
>>
>> You must split it in two tasks.
>> ansible_os_family and ansible_lsb.major_release values is probably wrong
>> so you need to find the correct ones.
>>
>> - name: Ensure syslog is running on Redhat 6.x
>>service: name=syslog state=running enabled=yes
>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release ==
>> "6"
>>
>> - name: Ensure syslog is running on Redhat 7.x
>>service: name=rsyslog state=running enabled=yes
>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release ==
>> "7"
>>
>> --
>> 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/5b1c97fc-2e65-4c7d-a32c-911f1ddeedca%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/CAH2deCYnardwwVGVB%3DEzOQNJErJv-mNdV%2BRWoKFpbm%2BmR%3Dx6Ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread Allen Sanabria
include_vars is your friend.

For instance in tasks/main.yml you can say..
- include_vars: RedHat6.yml
 when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "6"

- include_vars: RedHat7.yml
 when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "7"



On Thursday, September 1, 2016 at 10:54:25 AM UTC-7, ZillaYT wrote:
>
> Having a lot of -name/when task blocks is just ugly infrastructure. I have 
> to think of a better way. There's GOT to be a better way.
>
> On Thursday, September 1, 2016 at 1:45:02 PM UTC-4, Kai Stian Olstad wrote:
>>
>> On 01. sep. 2016 18:02, ZillaYT wrote: 
>> > I'm writing a role to configure syslog, and of course the service is 
>> > different between Linux instances. How do I do this in var/main.yml? 
>>
>> The directory must be vars not var. 
>>
>>
>> > # pseudo-code in vars/main.yml 
>> > if Redhat7.x 
>> >   syslog_service: rsyslog 
>> > else if RedHat6.x 
>> >   syslog_service: syslog 
>> > end 
>>
>> It's not possible, vars/main.yml can only contain variable definitions, 
>> not logic. 
>>
>>
>> > So then I can just do this in tasks/main.yml 
>> > 
>> > - name: Ensure syslog is running 
>> >   service: name="{{ syslog_service }}" state=running enabled=yes 
>>
>> You must split it in two tasks. 
>> ansible_os_family and ansible_lsb.major_release values is probably wrong 
>> so you need to find the correct ones. 
>>
>> - name: Ensure syslog is running on Redhat 6.x 
>>service: name=syslog state=running enabled=yes 
>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release == 
>> "6" 
>>
>> - name: Ensure syslog is running on Redhat 7.x 
>>service: name=rsyslog state=running enabled=yes 
>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release == 
>> "7" 
>>
>> -- 
>> 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/e03d4afd-fbf1-4a66-af09-e01083bb451e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread ZillaYT
Having a lot of -name/when task blocks is just ugly infrastructure. I have 
to think of a better way. There's GOT to be a better way.

On Thursday, September 1, 2016 at 1:45:02 PM UTC-4, Kai Stian Olstad wrote:
>
> On 01. sep. 2016 18:02, ZillaYT wrote: 
> > I'm writing a role to configure syslog, and of course the service is 
> > different between Linux instances. How do I do this in var/main.yml? 
>
> The directory must be vars not var. 
>
>
> > # pseudo-code in vars/main.yml 
> > if Redhat7.x 
> >   syslog_service: rsyslog 
> > else if RedHat6.x 
> >   syslog_service: syslog 
> > end 
>
> It's not possible, vars/main.yml can only contain variable definitions, 
> not logic. 
>
>
> > So then I can just do this in tasks/main.yml 
> > 
> > - name: Ensure syslog is running 
> >   service: name="{{ syslog_service }}" state=running enabled=yes 
>
> You must split it in two tasks. 
> ansible_os_family and ansible_lsb.major_release values is probably wrong 
> so you need to find the correct ones. 
>
> - name: Ensure syslog is running on Redhat 6.x 
>service: name=syslog state=running enabled=yes 
>when: ansible_os_family == "RedHat" and ansible_lsb.major_release == 
> "6" 
>
> - name: Ensure syslog is running on Redhat 7.x 
>service: name=rsyslog state=running enabled=yes 
>when: ansible_os_family == "RedHat" and ansible_lsb.major_release == 
> "7" 
>
> -- 
> 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/5b1c97fc-2e65-4c7d-a32c-911f1ddeedca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread Kai Stian Olstad

On 01. sep. 2016 18:02, ZillaYT wrote:

I'm writing a role to configure syslog, and of course the service is
different between Linux instances. How do I do this in var/main.yml?


The directory must be vars not var.



# pseudo-code in vars/main.yml
if Redhat7.x
  syslog_service: rsyslog
else if RedHat6.x
  syslog_service: syslog
end


It's not possible, vars/main.yml can only contain variable definitions, 
not logic.




So then I can just do this in tasks/main.yml

- name: Ensure syslog is running
  service: name="{{ syslog_service }}" state=running enabled=yes


You must split it in two tasks.
ansible_os_family and ansible_lsb.major_release values is probably wrong 
so you need to find the correct ones.


- name: Ensure syslog is running on Redhat 6.x
  service: name=syslog state=running enabled=yes
  when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "6"

- name: Ensure syslog is running on Redhat 7.x
  service: name=rsyslog state=running enabled=yes
  when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "7"

--
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/5d0b51ce-dc25-352f-6db8-e663bbccc6c2%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Is there a way to define a list of values in vars?

2016-09-01 Thread Kai Stian Olstad

On 01. sep. 2016 16:57, synova.market...@gmail.com wrote:

Hi,

Is there a way to do the same as "with_items" but globally for the playbook?

For example something like :

variable1:
  - {url: 'http://someting', dest: 'something', src: 'something'}
  - {url: 'http://someting2', dest: 'something2', src: 'something2'}


This will work.



and use it like this in the playbook.

  - name: Download something
get_url:
  url="{{ variable1.url }}"
  dest="/tmp/{{ variable1.dest}}"

and in an other place use the same infos

 - name: Extract
unarchive:
  src=/tmp/{{ variable1.src}}
  dest=/tmp/ copy=no


But this will not. Since it is a list you need to specify which list 
item you want.


Fist item (someting):
{{ variable1[0].url }}

Second item (someting2):
{{ variable1[1].url }}

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


[ansible-project] Re: Installation of .exe on windows remote node get hung

2016-09-01 Thread 'J Hawkesworth' via Ansible Project
try win_package - win_msi is *only* for (well behaved) msi files.

also win_chocolatey is an option for a lot of places if it meets your 
security requirements.

A lot of (older) .exe programs will assume there is a user and pop up some 
kind of dialog box, which will cause the module to hang indefinitely.  Most 
decent modern software has a command line switch to run in silent and or 
unattended mode, so search for  'xxx.exe unattended installation' to see if 
that's an option for you.

Hope this helps,

Jon
On Thursday, September 1, 2016 at 4:55:00 PM UTC+1, srcr...@gmail.com wrote:
>
> Hi,
>
> I'm trying to install a software(.exe file) using raw module in windows 
> but failed to do.
>
> - hosts : all
>   remote_user: administrator
>   
>
>   tasks:
>- raw : xxx.exe /s
>
> Is there any other module to install software from .exe files?? I tried 
> win_msi but it didnt work.
>

-- 
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/c4532802-90dd-48b9-b053-df3a4f99c24c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to get the ansible command line information like current tags, skip-tags, limit, etc?

2016-09-01 Thread Matt Martz
So I guess to answer your question directly, there is no way to access
tags, skip tags, limit and most other command line options from within a
play.

It's really only achievable via a callback.

On Thu, Sep 1, 2016 at 11:26 AM, Jordan Cohen  wrote:

> The callback plugin is really nice, i didn't know it existed.
>
> For my purposes though, I would like to use the slack module so that I can
> more custom tailor the message, the channel to post to, and when to skip a
> slack message (for local/dev environments)
>
> But thank you, this is cool.
>
> On Thursday, September 1, 2016 at 12:07:18 PM UTC-4, Matt Martz wrote:
>>
>> Jordan,
>>
>> Have you looked at the slack callback plugin that is already bundled with
>> ansible?
>>
>> In your ansible.cfg you would need to have something like:
>>
>> [defaults]
>> callback_whitelist = slack
>>
>> The docstring for the callback has information about what environment
>> variables need to be set up for it to work:
>>
>> https://github.com/ansible/ansible/blob/devel/lib/ansible/
>> plugins/callback/slack.py#L43-L56
>>
>> To get it to display things like tags, skip tags, limit, etc...you will
>> need to set SLACK_INVOCATION=True
>>
>> On Thu, Sep 1, 2016 at 10:40 AM, Jordan Cohen  wrote:
>>
>>> I am integrating some automated slack messaging in ansible to inform on
>>> ansible runs and it would be useful to display information such as:
>>>
>>> Current tags in push
>>> Current skip-tags in push
>>> Current limit (though I know i can use play_hosts for listing the
>>> servers)
>>>
>>> To be honest, the whole ansible command would be helpful.  I am doing
>>> this with a local action shell now:
>>>
>>> shell ps aux | grep 'ansible-playbook' | grep -v grep
>>>
>>> ...but besides it being very janky, this is unpredictable if there are
>>> multiple ansible-playbooks running on one host, like in my jenkins server.
>>>
>>> I scanned all the built in vars that I know of for some of this
>>> information but no luck.
>>>
>>> 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-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/ms
>>> gid/ansible-project/97c23341-c49a-447c-beea-a9592c8a1959%
>>> 40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Matt Martz
>> @sivel
>> sivel.net
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/de06d9d3-f81a-4993-9c5a-3a5826e1ce2b%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

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


Re: [ansible-project] How to get the ansible command line information like current tags, skip-tags, limit, etc?

2016-09-01 Thread Jordan Cohen
The callback plugin is really nice, i didn't know it existed. 

For my purposes though, I would like to use the slack module so that I can 
more custom tailor the message, the channel to post to, and when to skip a 
slack message (for local/dev environments)

But thank you, this is cool.

On Thursday, September 1, 2016 at 12:07:18 PM UTC-4, Matt Martz wrote:
>
> Jordan,
>
> Have you looked at the slack callback plugin that is already bundled with 
> ansible?
>
> In your ansible.cfg you would need to have something like:
>
> [defaults]
> callback_whitelist = slack
>
> The docstring for the callback has information about what environment 
> variables need to be set up for it to work:
>
>
> https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/callback/slack.py#L43-L56
>
> To get it to display things like tags, skip tags, limit, etc...you will 
> need to set SLACK_INVOCATION=True
>
> On Thu, Sep 1, 2016 at 10:40 AM, Jordan Cohen  > wrote:
>
>> I am integrating some automated slack messaging in ansible to inform on 
>> ansible runs and it would be useful to display information such as:
>>
>> Current tags in push
>> Current skip-tags in push
>> Current limit (though I know i can use play_hosts for listing the servers)
>>
>> To be honest, the whole ansible command would be helpful.  I am doing 
>> this with a local action shell now:
>>
>> shell ps aux | grep 'ansible-playbook' | grep -v grep
>>
>> ...but besides it being very janky, this is unpredictable if there are 
>> multiple ansible-playbooks running on one host, like in my jenkins server.
>>
>> I scanned all the built in vars that I know of for some of this 
>> information but no luck.  
>>
>> 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-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/97c23341-c49a-447c-beea-a9592c8a1959%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

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


Re: [ansible-project] How to get the ansible command line information like current tags, skip-tags, limit, etc?

2016-09-01 Thread Matt Martz
Jordan,

Have you looked at the slack callback plugin that is already bundled with
ansible?

In your ansible.cfg you would need to have something like:

[defaults]
callback_whitelist = slack

The docstring for the callback has information about what environment
variables need to be set up for it to work:

https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/callback/slack.py#L43-L56

To get it to display things like tags, skip tags, limit, etc...you will
need to set SLACK_INVOCATION=True

On Thu, Sep 1, 2016 at 10:40 AM, Jordan Cohen  wrote:

> I am integrating some automated slack messaging in ansible to inform on
> ansible runs and it would be useful to display information such as:
>
> Current tags in push
> Current skip-tags in push
> Current limit (though I know i can use play_hosts for listing the servers)
>
> To be honest, the whole ansible command would be helpful.  I am doing this
> with a local action shell now:
>
> shell ps aux | grep 'ansible-playbook' | grep -v grep
>
> ...but besides it being very janky, this is unpredictable if there are
> multiple ansible-playbooks running on one host, like in my jenkins server.
>
> I scanned all the built in vars that I know of for some of this
> information but no luck.
>
> 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/97c23341-c49a-447c-beea-a9592c8a1959%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

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


Re: [ansible-project] Re: Version (and other) problems with Ansible Azure Modules

2016-09-01 Thread Matt Davis
That's not us calling that, it's the Azure Python SDK calling itself, so 
something is internally out of sync (possibly stale .pyc files?). The way 
they package "azure" as a empty meta-package that depends on lots of other 
packages makes it really easy for things to get out of sync, especially 
with some older busted versions of pip that can mask dependency failures. 
I'd suggest pip uninstalling every azure-* package (uninstalling "azure" by 
itself is useless) and see if you can reinstall.

On Tuesday, August 30, 2016 at 1:28:22 PM UTC-7, Andrea Dixon wrote:
>
> The issue is not on the constructor line though it's at line 146 of 
> ComputeManagementClient which is the Serializer (inside the constructor)
>
> On Tuesday, 30 August 2016 01:58:12 UTC+1, Matt Davis wrote:
>>
>> It doesn't look like your Azure SDK is at the correct version- the rc5 
>> version of ComputeManagementClient 
>> 
>>  
>> does indeed take two positional args, and the version you have installed 
>> clearly only takes one. 
>>
>> On Monday, August 29, 2016 at 7:24:57 AM UTC-7, Andrea Dixon wrote:
>>>
>>> Is azure 2.0.0rc5 + ansible stable-2.1 supposed to work now? I have 
>>> azure python sdk 2.0.0rc5 installed and I'm trying to run the azure_rm.py 
>>> inventory file that I plucked from the head of stable-2.1 but I get the 
>>> following error:
>>>
>>> [cafex@cfx-ansible stable-2.1]$ ./azure_rm.py --list
>>> Traceback (most recent call last):
>>>   File "./azure_rm.py", line 763, in 
>>> main()
>>>   File "./azure_rm.py", line 760, in main
>>> AzureInventory()
>>>   File "./azure_rm.py", line 369, in __init__
>>> self._compute_client = rm.compute_client
>>>   File "./azure_rm.py", line 353, in compute_client
>>> self._compute_client = 
>>> ComputeManagementClient(self.azure_credentials, self.subscription_id)
>>>   File 
>>> "/usr/lib/python2.7/site-packages/azure/mgmt/compute/compute_management_client.py",
>>>  
>>> line 146, 
>>> in  
>>>
>>> __init__
>>> self._serialize = Serializer(client_models)
>>> TypeError: __init__() takes exactly 1 argument (2 given)
>>>
>>> I'm assuming this azure_rm.py just has a dependency on the azure sdk and 
>>> not my ansible install? As my ansible is not from stable-2.1.
>>>
>>> On Friday, 8 July 2016 20:06:08 UTC+1, Matt Davis wrote:

 I've cherry-picked everything back to 2.1 that's been fixed in devel, 
 so it *should* all work on current stable-2.1 (slash 2.1.1 RC2). If 
 there's 
 stuff that still isn't working, please file issues so we can get it fixed.

 Thanks!

 -Matt

 On Thursday, July 7, 2016 at 6:25:25 PM UTC-7, Steven Carter wrote:
>
> That worked!  I really appreciate it!  Should the other functions work 
> at this point or will that still take some time?
>
> Steven.
>
> On Thu, Jul 7, 2016 at 2:02 PM, Matt Davis  wrote:
>
>> Yeah, looks like the azure_rm_deployment module got missed for rc5 
>> updates. I've tested and pushed a fix to devel and stable-2.1 (just in 
>> the 
>> nick of time for 2.1.1rc2), so try updating from stable-2.1 with 
>> submodules- should work now.
>>
>> -Matt
>>
>>
>> On Thursday, July 7, 2016 at 5:51:12 AM UTC-7, Steven Carter wrote:
>>>
>>> I am installing with 'pip install --no-cache-dir git+git://
>>> github.com/ansible/ansible.git@stable-2.1', so the source directory 
>>> gets plowed over every time.
>>>
>>> Thanks,
>>>
>>> Steven.
>>>
>>> On Thu, Jul 7, 2016 at 4:38 AM, 'J Hawkesworth' via Ansible Project 
>>>  wrote:
>>>
 Just a guess but if you are running ansible from source and 
 switching between branches, you may need to run a 

 make clean

 to get rid of any .pyc files

 Hope this helps,

 Jon

 On Thursday, July 7, 2016 at 4:26:17 AM UTC+1, Steven Carter wrote:
>
> Strange, I thought that I had this working with azure 2.0.0rc5 + 
> ansible stable-2.1, but when I tried to re-install and run my 
> ansible, I 
> get:
>
> An exception occurred during task execution. The full traceback is:
> Traceback (most recent call last):
>   File 
> "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", line 
> 661, in 
> 
> main()
>   File 
> "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", line 
> 657, in 
> main
> AzureRMDeploymentManager()
>   File 
> "/tmp/ansible_nsnYjC/ansible_module_azure_rm_deployment.py", line 

[ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread ZillaYT
I'm writing a role to configure syslog, and of course the service is 
different between Linux instances. How do I do this in var/main.yml?

# pseudo-code in vars/main.yml
if Redhat7.x
  syslog_service: rsyslog
else if RedHat6.x
  syslog_service: syslog
end


So then I can just do this in tasks/main.yml

- name: Ensure syslog is running
  service: name="{{ syslog_service }}" state=running enabled=yes


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/1f595730-130a-4e82-ab9b-f881b4e729cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Unusual WinRM connection issue

2016-09-01 Thread Mike Fennemore
So courtesy of a few colleagues we have a solution. By specifying the fqdn in 
the inventory rather than the ip, and making sure the Ansible control machine 
could resolve the fqdn to the ip, the connection is now successful.

-- 
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/15488e3c-de47-4ac0-ab27-59d9b405f3aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Is there a way to define a list of values in vars?

2016-09-01 Thread synova . marketing
Hi,

Is there a way to do the same as "with_items" but globally for the playbook?

For example something like :

variable1:
  - {url: 'http://someting', dest: 'something', src: 'something'}
  - {url: 'http://someting2', dest: 'something2', src: 'something2'}

and use it like this in the playbook.

  - name: Download something
get_url:
  url="{{ variable1.url }}"
  dest="/tmp/{{ variable1.dest}}"

and in an other place use the same infos

 - name: Extract
unarchive:
  src=/tmp/{{ variable1.src}}
  dest=/tmp/ copy=no



-- 
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/d738c5c5-742e-4e1b-b567-90d2350d3f50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Missing something with host directory/file paths

2016-09-01 Thread Jon Langemak
I'll answer this for myself.  Seems like just using the command module and 
doing the copy that way is the best approach.

Thanks for putting me on the right track!

On Wednesday, August 31, 2016 at 7:09:22 PM UTC-5, Jon Langemak wrote:
>
> Thank you!  Is there a better means to recursively copy then?  Or do I 
> need to copy each file separately?
>
> On Wednesday, August 31, 2016 at 5:19:57 PM UTC-5, Brian Coca wrote:
>>
>> by default ansible looks in the local 'controller' for the `src=` 
>> parameter, you need to use `remote_src=yes` for it to look for it on the 
>> target machine.
>>
>> Also note that `remote_src=yes` does not support recursive copying.
>>
>>
>> --
>> 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/385bbb39-70a7-4e76-aef1-3a857fa4eafd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] win_user fails to change password, but password changes!

2016-09-01 Thread Андрей З
The whole test playbook is here;
 - hosts: windows
   gather_facts: false
   tasks:
- name: Change Administrator password
  win_user: name=Administrator password=Quaiqu6I 
password_never_expires=yes

Running with ansible 2.1.1.0, and Windows 2012 R2 as client.
http://pastebin.com/2Wg9qYMt

but, if I change the access password - the playbook works well,
so, the password was changed.

Why it throws an error 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/98e07166-a3da-4899-99f6-41c1625bb408%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Define group in hosts file based on intersection of 2 groups

2016-09-01 Thread Iain M. Conochie
Hello,

 It is possible to limit the hosts the ansible command runs against by 
specifying patterns on the command line like so:

ansible webservers:!staging -m ping

Is it possible to use the same technique to define groups in the inventory 
file, so that the new group is defined by the intersection of 2 child groups?

Thanks

Iain

-- 
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/36FBA030-F5D2-480B-81F0-6820F53AF163%40shihad.org.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Thoughts on role for creating multiple users

2016-09-01 Thread appeltabak
Hi,

Currently, I'm transforming my user role from creating one user to creating 
multiple users. In many examples I've seen this is done by adding with_items 
to every tasks related to the creation of the user (create user, add 
authorized key, etc). This would result in executing every tasks for every 
listed user before moving to the next tasks (right?) But what I want is 
that the whole task file is run from top to bottom, for every listed user. 

I've tried this approach: 
https://gist.github.com/Appeltabak/7f20f9f6e4fed80202cc2dd5d0044b5f 
Unfortunately, this gives an undefined variable error when the outer_users 
is used in subsequent tasks.

*TL;DR How can I run a task file with **with_items* ?

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/5c62db30-0ef4-4732-a545-726a501ca53f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to get the ansible command line information like current tags, skip-tags, limit, etc?

2016-09-01 Thread Jordan Cohen
I am integrating some automated slack messaging in ansible to inform on 
ansible runs and it would be useful to display information such as:

Current tags in push
Current skip-tags in push
Current limit (though I know i can use play_hosts for listing the servers)

To be honest, the whole ansible command would be helpful.  I am doing this 
with a local action shell now:

shell ps aux | grep 'ansible-playbook' | grep -v grep

...but besides it being very janky, this is unpredictable if there are 
multiple ansible-playbooks running on one host, like in my jenkins server.

I scanned all the built in vars that I know of for some of this information 
but no luck.  

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/97c23341-c49a-447c-beea-a9592c8a1959%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible 2.2.0 - ios_facts module

2016-09-01 Thread Rukka Pal
Hi Peter,

many thanks for your help, it works now!

On Tuesday, August 30, 2016 at 4:26:08 AM UTC+2, Peter Sprygada wrote:
>
> Hi Rukka,
>
> See sample playbook here: 
> https://gist.github.com/privateip/f473d9ce25dd699b14c9987264159616
>
>
>
> On Mon, Aug 29, 2016 at 5:23 AM, Rukka Pal  > wrote:
>
>> I am a newbie and would like to use Ansible to automate network operation 
>> tasks, right now I am only interested in fact collection. I have been using 
>> the "raw" module which is not very flexible, hence I decided to install 
>> (from GitHub) ansible 2.2.0 to try the "ios_facts" module. First I was 
>> using paramiko, but it failed to open SFTP connection. Then I tried default 
>> ansible config, but it was complaining about SSH ("SSH Error: data could 
>> not be sent to the remote host. Make sure this host can be reached over 
>> ssh") so I changed "scp_if_ssh" to true. Now it says ""failed to transfer 
>> file to Line has invalid autocommand \"/bin/sh -c ( umask 77 && mkdir -p 
>> \"\"/ios_facts.py:\n\nPrivilege denied.\n" and the command won't run.
>>
>> What am I missing here? Could someone provide an example ad-hoc command 
>> or an example playbook?
>>
>> Environment: 3.13.0-93-generic Ubuntu 14, Perl 5.18.2-2ubuntu1.1
>>
>> Thanks in advance!
>>
>> -- 
>> 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/1cee5cad-6ce4-4dfe-b99b-73ebb1a87e6f%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/e7338c5c-3ada-4450-8384-e50dd52ada52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Installation of .exe on windows remote node get hung

2016-09-01 Thread srcr2801
Hi,

I'm trying to install a software(.exe file) using raw module in windows but 
failed to do.

- hosts : all
  remote_user: administrator
  

  tasks:
   - raw : xxx.exe /s

Is there any other module to install software from .exe files?? I tried 
win_msi but it didnt work.

-- 
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/d453ac0d-13fc-478a-80d2-77ba81fc6941%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] with_nested and empty lists

2016-09-01 Thread Pim Rupert
I have the following task which uses with_nested with variables that could 
be empty.

- name: Authorize SSH keys for all website users.
  authorized_key:
user="{{ item.0.user | default(websites_default_user) }}"
key="{{ lookup('file', 'data/public-ssh-keys/' ~ item.1.key) }}"
key_options="{{ item.1.options | default(omit) }}"
state="{{ item.1.state | default('present') }}"
  with_nested:
 - "{{ websites }}"
 - "{{ ssh_keys_for_all_websites }}"


This stopped working in Ansible 2.0, but is working again since Ansible 2.1 
(see https://github.com/ansible/ansible/issues/14498). 

However, it is now throwing the following warning:

[DEPRECATION WARNING]: Skipping task due to undefined Error, in the future 
this will be a fatal error.:
'ssh_keys_for_all_websites' is undefined.


 
First of all, this warning is incorrect. The variable 
"ssh_keys_for_all_websites" is defined, it is defined as "[]", an empty 
list. Further, I want to continue to be able to use with_nested with 
variables that could (for some hosts) be empty. If this is deprecated, what 
is the suggested alternative? 

-- 
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/05aeda06-925b-4a52-a2be-4d65253e25d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ansible requiring ansible_ssh_pass

2016-09-01 Thread Graham O'Regan
To provide a bit more detail, if I have this in my inventory file;

ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com ansible_ssh_user=ec2-user 
ansible_ssh_pass=dummy


And run this;

$ ansible all -i inventory/aws -m ping -
No config file found; using defaults
Loaded callback minimal of type stdout, v2.0
 ESTABLISH CONNECTION 
FOR USER: ec2-user on PORT 22 TO 
ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com
 EXEC /bin/sh -c '( 
umask 77 && mkdir -p "` echo 
$HOME/.ansible/tmp/ansible-tmp-1472737036.6-208605390381784 `" && echo 
ansible-tmp-1472737036.6-208605390381784="` echo 
$HOME/.ansible/tmp/ansible-tmp-1472737036.6-208605390381784 `" ) && sleep 0'
 PUT 
/var/folders/vt/jn8svt1j333c31rspxhcsb8rgp/T/tmpElWP2d TO 
/home/ec2-user/.ansible/tmp/ansible-tmp-1472737036.6-208605390381784/ping
 EXEC /bin/sh -c 
'LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 
/usr/bin/python 
/home/ec2-user/.ansible/tmp/ansible-tmp-1472737036.6-208605390381784/ping; 
rm -rf 
"/home/ec2-user/.ansible/tmp/ansible-tmp-1472737036.6-208605390381784/" > 
/dev/null 2>&1 && sleep 0'
ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com | SUCCESS => {
"changed": false, 
"invocation": {
"module_args": {
"data": null
}, 
"module_name": "ping"
}, 
"ping": "pong"
}

Everything works ok, but if i set the inventory to;

ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com ansible_ssh_user=ec2-user



$ ansible all -i inventory/aws -m ping -
No config file found; using defaults
Loaded callback minimal of type stdout, v2.0
 ESTABLISH SSH 
CONNECTION FOR USER: ec2-user
 SSH: EXEC ssh -C -vvv 
-o ControlMaster=auto -o ControlPersist=60s -o 
KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o 
ControlPath=/Users/graham/.ansible/cp/ansible-ssh-%h-%p-%r 
ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'( 
umask 77 && mkdir -p "` echo 
$HOME/.ansible/tmp/ansible-tmp-1472737048.41-168621408771185 `" && echo 
ansible-tmp-1472737048.41-168621408771185="` echo 
$HOME/.ansible/tmp/ansible-tmp-1472737048.41-168621408771185 `" ) && sleep 
0'"'"''
ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com | UNREACHABLE! => {
"changed": false, 
"msg": "Failed to connect to the host via ssh.", 
"unreachable": true
}

It fails :/

Graham

On Thursday, 1 September 2016 14:35:18 UTC+1, Graham O'Regan wrote:
>
> I'm running Ansible 2.1.1.0 on OS X 10.11.6 and I'm having a problem that 
> I haven't had before. The issue the same as outlined in this SO question;
>
> https://stackoverflow.com/questions/37213551/ansible-ssh-connection-fail
>
> If I don't put ansible_ssh_pass in the inventory file then SSH doesn't 
> work. I can use any value for that variable and it will be ignored in 
> favour of the SSH cert and everything works, e.g.;
>
> ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com ansible_ssh_user=ec2-user 
> ansible_ssh_pass=dummy
>
>
> The problem is that running with that inventory file on Linux fails because 
> the password doesn't match. I've tried quite a few permutations of settings 
> but I can't find something that works on both systems. I haven't had this 
> issue with Ansible before using older versions.
>
>
> Anyone else having the same issue?
>
>
> Graham
>
>
>
>

-- 
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/be6b542c-5420-4e0f-8ca8-036621f1f7b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ansible requiring ansible_ssh_pass

2016-09-01 Thread Graham O'Regan
I'm running Ansible 2.1.1.0 on OS X 10.11.6 and I'm having a problem that I 
haven't had before. The issue the same as outlined in this SO question;

https://stackoverflow.com/questions/37213551/ansible-ssh-connection-fail

If I don't put ansible_ssh_pass in the inventory file then SSH doesn't 
work. I can use any value for that variable and it will be ignored in 
favour of the SSH cert and everything works, e.g.;

ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com ansible_ssh_user=ec2-user 
ansible_ssh_pass=dummy


The problem is that running with that inventory file on Linux fails because the 
password doesn't match. I've tried quite a few permutations of settings but I 
can't find something that works on both systems. I haven't had this issue with 
Ansible before using older versions.


Anyone else having the same issue?


Graham



-- 
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/882d227e-9218-4b39-81fd-bf0bc6b5a402%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible installed from yum is unable to connect to windows while Ansible installed via source file is working fine from the same host

2016-09-01 Thread 'J Hawkesworth' via Ansible Project
to get round that issue you need to set

ansible_winrm_server_cert_validation: ignore


In your inventory / group vars

its documented here:

http://docs.ansible.com/ansible/intro_windows.html#inventory

Hope this helps,

Jon
On Thursday, September 1, 2016 at 11:13:02 AM UTC+1, ishan jain wrote:
>
> I am making some centOS based docker containers to be used as Ansible 
> host. Initially, i created a container and installed Ansible from source 
> files. To connect to windows hosts, i installed some modules as and when 
> required. (honestly, i am not sure what all modules i installed)
>
> Now i created another similar docker container only that i installed 
> Ansible and other things via yum, all latest versions. The scripts for 
> linux hosts works fine but the scripts for windows which are working on 
> same host (and same target windows machine) are not working in this new 
> container. Below is the error i get for setup module.
>
>
> Loaded callback minimal of type stdout, v2.0
> <10.10.10.10> ESTABLISH WINRM CONNECTION FOR USER: test on PORT 5986 TO 
> 10.10.10.10
> <10.10.10.10> WINRM CONNECT: transport=ssl endpoint=
> https://10.10.10.10:5986/wsman
> <10.10.10.10> WINRM CONNECTION ERROR: [SSL: CERTIFICATE_VERIFY_FAILED] 
> certificate verify failed (_ssl.c:765)
> Traceback (most recent call last):
>   File 
> "/usr/lib/python2.7/site-packages/ansible/plugins/connection/winrm.py", 
> line 151, in _winrm_connect
> self.shell_id = protocol.open_shell(codepage=65001) # UTF-8
>   File "/usr/lib/python2.7/site-packages/winrm/protocol.py", line 132, in 
> open_shell
> res = self.send_message(xmltodict.unparse(req))
>   File "/usr/lib/python2.7/site-packages/winrm/protocol.py", line 207, in 
> send_message
> return self.transport.send_message(message)
>   File "/usr/lib/python2.7/site-packages/winrm/transport.py", line 173, in 
> send_message
> response = self.session.send(prepared_request, 
> timeout=self.read_timeout_sec)
>   File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 596, 
> in send
> r = adapter.send(request, **kwargs)
>   File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 497, 
> in send
> raise SSLError(e, request=request)
> SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 
> (_ssl.c:765)
>
> windows1 | UNREACHABLE! => {
> "changed": false,
> "msg": "ssl: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify 
> failed (_ssl.c:765)",
> "unreachable": true
> }
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To 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/a9fd65e7-e7ea-4473-b3bc-383b6469edcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Location of host and group configuration

2016-09-01 Thread Kai Stian Olstad

On 01. sep. 2016 12:39, Uwe Sauter wrote:

Yes, that I've alredy figured out. But what if I want to group my playbooks 
inside different folders but the group and host vars
should be the same? Is there an option to tell Ansible where to look for those 
folders?


I don't think that is possible. You need to have the group_vars and 
host_vars in the inventory directory or the playbook directory.
group_vars and host_vars in the playbook directory will overwrite those 
in the inventory directory if both exist.


--
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/46411dda-d059-221f-a049-b8d7613b0cfb%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] including a pre_tasks

2016-09-01 Thread Kai Stian Olstad

On 01. sep. 2016 11:00, fanvalt wrote:

Hello,

I want to set variables with set_fact in a pre_tasks section.
This is working well, but it is 50 lines long and I want to have these
lines to be set in all my playbooks.

Is there a way to include a pre_tasks ? Here is what I would expect:


- include: 

https://docs.ansible.com/ansible/playbooks_roles.html#task-include-files-and-encouraging-reuse



  pre_tasks:
- name: variables Instance 1 DV/QA
  set_fact:
KARAFHTTPPORT: "210{{ Slice }}"
KARAFSSHPORT: "211{{ Slice }}"
KARAFRMIREGISTRYPORT: "212{{ Slice }}"
KARAFRMISERVERPORT: "213{{ Slice }}"
  when: numint == '1' and ( EnvType == 'DV' or EnvType == 'QA')
...

I would like to copy these lines in a setting.yml file, I don't know where
it would be conventional, lets say in vars directory.


vars, settings, tasks... as long as you don't use any of the reserved 
directories you are good.



And then call it this way:
  pre_tasks:
   vars/setting.yml


  pre_tasks:
- include: vars/settings.yml

--
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/42989965-27a7-fe5e-63ce-a92c5a8d5571%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Location of host and group configuration

2016-09-01 Thread Uwe Sauter
Yes, that I've alredy figured out. But what if I want to group my playbooks 
inside different folders but the group and host vars
should be the same? Is there an option to tell Ansible where to look for those 
folders?

I imagine a dir tree like:

.
├── group_vars
│   ├── group1.yaml
│   └── group2.yaml
├── host_vars
│   ├── host1.yaml
│   ├── host2.yaml
│   └── localhost.yaml
├── group1-playbooks
│   ├── 00-requirements.yaml
│   ├── 01-copy-static-files.yaml
│   └── 99-cleanup.yaml
├── group2-playbooks
│   ├── 00-requirements.yaml
│   ├── 01-copy-static-files.yaml
│   └── 99-cleanup.yaml
└── inventory

Regards,

Uwe


Am 01.09.2016 um 12:29 schrieb ankur.c...@gmail.com:
> It can be inside the same folder as the playbook.
> 
> root
>   -- group_vars/all.yml
>   -- host_vars/some_host.yml
>   -- myPlaybook.yml
> 
> On Thursday, September 1, 2016 at 2:40:10 PM UTC+5:30, Uwe Sauter wrote:
> 
> Hi all,
> 
> I'm currently struggling with how to tell Ansible where it can find 
> host_vars and group_vars folders. Is there an environmet
> variable for it? Does it have to be inside the same folder as the 
> playbook?
> 
> Regards,
> 
> Uwe
> 

-- 
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/66e25267-d6a4-bc7c-77f4-af8f1bfdd032%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Location of host and group configuration

2016-09-01 Thread ankur . cool
It can be inside the same folder as the playbook.

root
  -- group_vars/all.yml
  -- host_vars/some_host.yml
  -- myPlaybook.yml

On Thursday, September 1, 2016 at 2:40:10 PM UTC+5:30, Uwe Sauter wrote:
>
> Hi all, 
>
> I'm currently struggling with how to tell Ansible where it can find 
> host_vars and group_vars folders. Is there an environmet 
> variable for it? Does it have to be inside the same folder as the 
> playbook? 
>
> Regards, 
>
> Uwe 
>

-- 
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/482d2ee8-d9a2-4b7c-9796-5739c469c59f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Running ansible from python

2016-09-01 Thread ankur . cool
Hi

I have a need to call ansible from python. I was looking 
at http://docs.ansible.com/ansible/developing_api.html#python-api-2-0 but 
doc doesn't seem to be very clear.

I need to execute a module or a playbook which ever is easy and want the 
response of it. Basically this is my custom module which returns me a list 
of services running on my servers.

Please see that I have lots of variables defined in my group_vars have lots 
of custom roles in my ansible directory (Having directory structure as 
specified in ansible docs). 
So I want that when I execute module or playbook from python it should be 
able to use these vars, roles, etc..

Also I am not sure how can I get the output of executing the api so that I 
can process that data in python

Hope I can find some answers here. Please let me know if I am not clear 
with requirement.

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/c1494649-dc56-4922-b668-25c6409a9788%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible installed from yum is unable to connect to windows while Ansible installed via source file is working fine from the same host

2016-09-01 Thread ishan jain
I am making some centOS based docker containers to be used as Ansible host. 
Initially, i created a container and installed Ansible from source files. 
To connect to windows hosts, i installed some modules as and when required. 
(honestly, i am not sure what all modules i installed)

Now i created another similar docker container only that i installed 
Ansible and other things via yum, all latest versions. The scripts for 
linux hosts works fine but the scripts for windows which are working on 
same host (and same target windows machine) are not working in this new 
container. Below is the error i get for setup module.


Loaded callback minimal of type stdout, v2.0
<10.10.10.10> ESTABLISH WINRM CONNECTION FOR USER: test on PORT 5986 TO 
10.10.10.10
<10.10.10.10> WINRM CONNECT: transport=ssl 
endpoint=https://10.10.10.10:5986/wsman
<10.10.10.10> WINRM CONNECTION ERROR: [SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed (_ssl.c:765)
Traceback (most recent call last):
  File 
"/usr/lib/python2.7/site-packages/ansible/plugins/connection/winrm.py", 
line 151, in _winrm_connect
self.shell_id = protocol.open_shell(codepage=65001) # UTF-8
  File "/usr/lib/python2.7/site-packages/winrm/protocol.py", line 132, in 
open_shell
res = self.send_message(xmltodict.unparse(req))
  File "/usr/lib/python2.7/site-packages/winrm/protocol.py", line 207, in 
send_message
return self.transport.send_message(message)
  File "/usr/lib/python2.7/site-packages/winrm/transport.py", line 173, in 
send_message
response = self.session.send(prepared_request, 
timeout=self.read_timeout_sec)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 596, 
in send
r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 497, 
in send
raise SSLError(e, request=request)
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 
(_ssl.c:765)

windows1 | UNREACHABLE! => {
"changed": false,
"msg": "ssl: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 
(_ssl.c:765)",
"unreachable": true
}

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To 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/a9b7dba0-bf8c-4940-ad6a-fed554ba3857%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Location of host and group configuration

2016-09-01 Thread Uwe Sauter
Hi all,

I'm currently struggling with how to tell Ansible where it can find host_vars 
and group_vars folders. Is there an environmet
variable for it? Does it have to be inside the same folder as the playbook?

Regards,

Uwe

-- 
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/5e02ccc4-cf3b-3cf6-3ff5-9b8b78813252%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] including a pre_tasks

2016-09-01 Thread fanvalt
Hello,

I want to set variables with set_fact in a pre_tasks section.
This is working well, but it is 50 lines long and I want to have these 
lines to be set in all my playbooks.

Is there a way to include a pre_tasks ? Here is what I would expect:

  pre_tasks:
- name: variables Instance 1 DV/QA
  set_fact:
KARAFHTTPPORT: "210{{ Slice }}"
KARAFSSHPORT: "211{{ Slice }}"
KARAFRMIREGISTRYPORT: "212{{ Slice }}"
KARAFRMISERVERPORT: "213{{ Slice }}"
  when: numint == '1' and ( EnvType == 'DV' or EnvType == 'QA')
...

I would like to copy these lines in a setting.yml file, I don't know where 
it would be conventional, lets say in vars directory.
And then call it this way:
  pre_tasks:
   vars/setting.yml 

Would this work and what is the conventional way to do this in Ansible ?

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/ce1bde29-ecf2-48de-abae-52d574309091%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] unable to evaluate conditional

2016-09-01 Thread fanvalt
ok thank you for the explanation
REgards

Le mercredi 31 août 2016 12:50:55 UTC+2, Kai Stian Olstad a écrit :
>
> On 31. aug. 2016 11:43, fanvalt wrote: 
> > Hello, 
> > 
> > I don't understand where I am doing wrong in this simple tasks: 
> > 
> > - name: Search for bin directory 
> >   stat: 
> > path: /{{ Directoryname }}/{{ item }}/bin 
> >   register: previous 
> >   with_items: "{{ shr4you_inst.stdout_lines }}" 
> >   when: shr4you_inst|success 
> > 
> > - debug: msg="previous {{previous}}" 
>
> It very hard to read the output using debug this way, please use this 
> instead 
> - debug: var=previous 
>
> If you do you probably will see what's happening a lot easier. 
>
> When you use register with with_items the result back is a list. 
>
>
> https://docs.ansible.com/ansible/playbooks_loops.html#using-register-with-a-loop
>  
>
> -- 
> 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/09eb359a-823e-40cc-a109-964d7b2e0e35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: win_copy failing (timeout)

2016-09-01 Thread 'J Hawkesworth' via Ansible Project
win_copy is still unfortunately not great for large files.  From the 
testing that I did earlier in the year it is still slower than fetching the 
same size file via http and there seems to be a max size, although this 
isn't something I've hit myself.

What I do is add an http server (nginx) to my ansible controllers (there 
are lots of roles on galaxy to do this for you to chose from) and then use 
win_get_url to fetch the files back onto the windows boxes.  You could use 
any web server but I can vouch for nginx working well.  You can also use 
force=no with win_get_url which will only download files if they have a 
newer timestamp than the current version, and nginx sends the correct 
headers for this to work, so its a good combination.

Happy to go into more detail if you need it.

Hope this helps,

Jon

On Wednesday, August 31, 2016 at 3:23:19 PM UTC+1, Justin Dugan wrote:
>
> I have also tried unarchive which fails with the same error.
>

-- 
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/8c23743a-6fc0-4446-981b-0106ae6bfecf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: EC2 dynamic inventory: SSH rules

2016-09-01 Thread Hagai Kariti
You can try setting it to public_dns_name. It should resolve to the private
IP when you're inside the vpc, and to the public IP when your outside.

On Wed, Aug 31, 2016, 23:22 Soren Olegnowicz 
wrote:

> Sure!
>
> Currently I run: " ansible all -m ping -i ec2.py "
>
> With:
>
> destination_variable = public_dns_name
>
> vpc_destination_variable = private_ip_address
>
> The return values for the ping will only return positive on the private
> vpc instances because the ping happens via the private IP's
>
> If I change it to:
>
> vpc_destination_variable = public_ip_address
>
> then the return values for the ping will only return positive for the
> public non-vpc instances because the ping happens via the public IP's
>
> I would like to be able to successfully ping all instances with the above
> command.
>
> Hope that helps.
>
> On Monday, August 29, 2016 at 9:04:47 PM UTC-4, Soren Olegnowicz wrote:
>>
>> Hey guys I need to connect to my ec2 instances in various ways using the
>> ec2.ini provided. Right now my I can only get my ec2.ini to connect to my
>> instances via their private or public IP alone, but I need to connect to
>> some instances via their private IP and some via their public. Any
>> suggestions for introducing logic to accomplish this?
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/jfEO2I9pStM/unsubscribe.
> To unsubscribe from this group and all its topics, 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/fbdc0064-709e-405f-8f32-5685a5dd6d52%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/CAO0%3DbmH2gGc2JRyoCUt_NfdMHyiFZyzuCBBLoDVwDB9ku5Jgjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.