Re: [ansible-project] Fix the bug for saving Ansible ping results to a local file

2022-12-07 Thread Frank Ling
Hi Brian,

Thanks a lot for the help. 

 Yes, it works as expected. 

I really appreciate that. 

Frank  




On Tuesday, December 6, 2022 at 5:22:29 PM UTC-5 Brian Coca wrote:

> - hosts: test-vms
> tasks:
> - name: Ping vms in test-vms
> ansible.builtin.ping:
> register: ping_pong
> ignore_errors: True
>
> - hosts: localhost
> gather_facts: no
> tasks:
> - name: Copy the output result to /tmp/file.txt
> ansible.builtin.template:
> src: ping.j2
> dest: /tmp/file.txt
>
>
> ping.j2:
> {% for host in groups['test-vms'] %}
> {{ host }}: {{ hostvars[host]['ping_pong'] }}
> {% endfor %}
>
> -- 
> --
> Brian Coca
>
>

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


Re: [ansible-project] Fix the bug for saving Ansible ping results to a local file

2022-12-06 Thread Frank Ling
It looks like I need to use a template for the task. But saving the screen 
output for the playbook run should be a very common task. Hope someone can 
write a module for doing this.

>>You have an invalid character in your group name, by the way. Change the 
dash to an underscore (probably).
Yeah, you're correct.

Thanks.

Frank

On Tuesday, December 6, 2022 at 4:13:36 PM UTC-5 uto...@gmail.com wrote:

> You could change your dest to
> dest: "/tmp/file-{{ inventory_hostname }}.txt"
> and concatenate them all, but then they won't contain the host names.
> If you don't like that, then you could register the ping results and loop 
> through them with a template…
>
> You have an invalid character in your group name, by the way. Change the 
> dash to an underscore (probably).
>
> On Tuesday, December 6, 2022 at 3:34:47 PM UTC-5 frankl...@gmail.com 
> wrote:
>
>> >>What makes it weird?
>> I wanted to save the ansible ping results to /tmp/file.txt so I can email 
>> out the result.
>>
>> After running the playbook, I just got following saved in /tmp/file.txt:
>>
>> {"ping": "pong", "failed": false, "changed": false}
>>
>> >>What were you expecting instead?
>>
>> I added a few lines in the playbook as:
>>
>> ---
>> - hosts: test-vms 
>>   tasks:
>> - name: Ping vms in test-vms
>>   ansible.builtin.ping: 
>>   register: ping_pong
>>   ignore_errors: True
>>
>> - name: Ping result
>>   ansible.builtin.ping:
>>   register: ping_screen
>>
>> - name: Ping the result to the screen
>>   ansible.builtin.debug:
>>  var: ping_screen
>>
>>
>>
>> - name: Copy the output result to /tmp/file.txt 
>>   ansible.builtin.copy: 
>>   content: "{{ ping_pong }}"
>>   dest: /tmp/file.txt
>>
>> When I ran it, the ping result would show on the screen as following and 
>> I would like to save following result to /tmp/file.txt:
>>
>> ...
>>
>> TASK [Ping the result to the screen] 
>> ***
>> ok: [test-vm01] => {
>> "ping_screen": {
>> "changed": false,
>> "failed": false,
>> "ping": "pong"
>> }
>> }
>> ok: [test-vm02] => {
>> "ping_screen": {
>> "changed": false,
>> "failed": false,
>> "ping": "pong"
>> }
>> }
>> ok: [test-vm03] => {
>> "ping_screen": {
>> "changed": false,
>> "failed": false,
>> "ping": "pong"
>> }
>> }
>>
>> 
>>
>>
>>
>>
>> On Tuesday, December 6, 2022 at 3:21:44 PM UTC-5 Matt Martz wrote:
>>
>>> Also, it helps when you clarify what you want to see, instead of "I got 
>>> this weird result".
>>>
>>> What makes it weird?  What were you expecting instead?
>>>
>>> On Tue, Dec 6, 2022 at 2:09 PM Frank Ling  wrote:
>>>
>>>> Thanks for the reply.
>>>>
>>>> >> You're saving the result for each host to the same file.
>>>> Yeah, you're right. I am not sure how to save the output in Ansible to 
>>>> the output in a file like in shell >> /tmp/file 
>>>>
>>>> >>And there is something weird with the inventory you use...
>>>> I had the inventory in /etc/ansible/hosts with:
>>>>
>>>> [test-vms]
>>>> test-vm01
>>>> test-vm02
>>>> test-vm03
>>>>  Frank
>>>>
>>>> On Tuesday, December 6, 2022 at 3:00:48 PM UTC-5 dnmv...@gmail.com 
>>>> wrote:
>>>>
>>>>> Several things here. 
>>>>> You're saving the result for each host to the same file. So you will 
>>>>> end up with just one result, from the last host.
>>>>> And there is something weird with the inventory you use. Follow the 
>>>>> suggestion made by the code (use increased verbosity). 
>>>>>
>>>>>
>>>>>
>>>>> On Tue, 6 Dec 2022 at 20:54, Frank Ling  wrote:
>>

Re: [ansible-project] Fix the bug for saving Ansible ping results to a local file

2022-12-06 Thread Frank Ling
Thanks, Matt.

>> Perhaps you want to set a log file instead...
Well, I don't want to have the whole log file that contains all details of 
different play, but only the output of the play. 

>>you'll want to use a template and build the output in the format you 
want..
I will look into it.

Frank
On Tuesday, December 6, 2022 at 4:05:27 PM UTC-5 Matt Martz wrote:

> Registered results do not contain the full output as seen on the screen.  
> Perhaps you want to set a log file instead, otherwise, you'll want to use a 
> template and build the output in the format you want.  The screen output is 
> controlled by a callback plugin which does extra formatting.
>
> See 
> https://docs.ansible.com/ansible-core/2.14/reference_appendices/config.html#default-log-path
>
> On Tue, Dec 6, 2022 at 3:02 PM Frank Ling  wrote:
>
>> Well as a workaround I could use: ansible-playbook ping_email.yml >> 
>> /tmp/file.txt to save the output as a file. But I hope there could be a 
>> better way.
>>
>> Thanks.
>>
>> On Tuesday, December 6, 2022 at 3:34:47 PM UTC-5 Frank Ling wrote:
>>
>>> >>What makes it weird?
>>> I wanted to save the ansible ping results to /tmp/file.txt so I can 
>>> email out the result.
>>>
>>> After running the playbook, I just got following saved in /tmp/file.txt:
>>>
>>> {"ping": "pong", "failed": false, "changed": false}
>>>
>>> >>What were you expecting instead?
>>>
>>> I added a few lines in the playbook as:
>>>
>>> ---
>>> - hosts: test-vms 
>>>   tasks:
>>> - name: Ping vms in test-vms
>>>   ansible.builtin.ping: 
>>>   register: ping_pong
>>>   ignore_errors: True
>>>
>>> - name: Ping result
>>>   ansible.builtin.ping:
>>>   register: ping_screen
>>>
>>> - name: Ping the result to the screen
>>>   ansible.builtin.debug:
>>>  var: ping_screen
>>>
>>>
>>>
>>> - name: Copy the output result to /tmp/file.txt 
>>>   ansible.builtin.copy: 
>>>   content: "{{ ping_pong }}"
>>>   dest: /tmp/file.txt
>>>
>>> When I ran it, the ping result would show on the screen as following and 
>>> I would like to save following result to /tmp/file.txt:
>>>
>>> ...
>>>
>>> TASK [Ping the result to the screen] 
>>> ***
>>> ok: [test-vm01] => {
>>> "ping_screen": {
>>> "changed": false,
>>> "failed": false,
>>> "ping": "pong"
>>> }
>>> }
>>> ok: [test-vm02] => {
>>> "ping_screen": {
>>> "changed": false,
>>> "failed": false,
>>> "ping": "pong"
>>> }
>>> }
>>> ok: [test-vm03] => {
>>> "ping_screen": {
>>> "changed": false,
>>>     "failed": false,
>>> "ping": "pong"
>>> }
>>> }
>>>
>>> 
>>>
>>>
>>>
>>>
>>> On Tuesday, December 6, 2022 at 3:21:44 PM UTC-5 Matt Martz wrote:
>>>
>>>> Also, it helps when you clarify what you want to see, instead of "I got 
>>>> this weird result".
>>>>
>>>> What makes it weird?  What were you expecting instead?
>>>>
>>>> On Tue, Dec 6, 2022 at 2:09 PM Frank Ling  wrote:
>>>>
>>>>> Thanks for the reply.
>>>>>
>>>>> >> You're saving the result for each host to the same file.
>>>>> Yeah, you're right. I am not sure how to save the output in Ansible to 
>>>>> the output in a file like in shell >> /tmp/file 
>>>>>
>>>>> >>And there is something weird with the inventory you use...
>>>>> I had the inventory in /etc/ansible/hosts with:
>>>>>
>>>>> [test-vms]
>>>>> test-vm01
>>>>> test-vm02
>>>>> test-vm03
>>>>>  Frank
>>>>>
>>>>> On Tuesday, December 6, 2022 at 3:00:48 PM UTC-5 dnmv...@gmail.com 
>>>>> wrote:
>>>>>
&

Re: [ansible-project] Fix the bug for saving Ansible ping results to a local file

2022-12-06 Thread Frank Ling
Well as a workaround I could use: ansible-playbook ping_email.yml >> 
/tmp/file.txt to save the output as a file. But I hope there could be a 
better way.

Thanks.

On Tuesday, December 6, 2022 at 3:34:47 PM UTC-5 Frank Ling wrote:

> >>What makes it weird?
> I wanted to save the ansible ping results to /tmp/file.txt so I can email 
> out the result.
>
> After running the playbook, I just got following saved in /tmp/file.txt:
>
> {"ping": "pong", "failed": false, "changed": false}
>
> >>What were you expecting instead?
>
> I added a few lines in the playbook as:
>
> ---
> - hosts: test-vms 
>   tasks:
> - name: Ping vms in test-vms
>   ansible.builtin.ping: 
>   register: ping_pong
>   ignore_errors: True
>
> - name: Ping result
>   ansible.builtin.ping:
>   register: ping_screen
>
> - name: Ping the result to the screen
>   ansible.builtin.debug:
>  var: ping_screen
>
>
>
> - name: Copy the output result to /tmp/file.txt 
>   ansible.builtin.copy: 
>   content: "{{ ping_pong }}"
>   dest: /tmp/file.txt
>
> When I ran it, the ping result would show on the screen as following and I 
> would like to save following result to /tmp/file.txt:
>
> ...
>
> TASK [Ping the result to the screen] 
> ***
> ok: [test-vm01] => {
> "ping_screen": {
> "changed": false,
> "failed": false,
> "ping": "pong"
> }
> }
> ok: [test-vm02] => {
> "ping_screen": {
> "changed": false,
> "failed": false,
> "ping": "pong"
> }
> }
> ok: [test-vm03] => {
> "ping_screen": {
> "changed": false,
> "failed": false,
> "ping": "pong"
> }
> }
>
> 
>
>
>
>
> On Tuesday, December 6, 2022 at 3:21:44 PM UTC-5 Matt Martz wrote:
>
>> Also, it helps when you clarify what you want to see, instead of "I got 
>> this weird result".
>>
>> What makes it weird?  What were you expecting instead?
>>
>> On Tue, Dec 6, 2022 at 2:09 PM Frank Ling  wrote:
>>
>>> Thanks for the reply.
>>>
>>> >> You're saving the result for each host to the same file.
>>> Yeah, you're right. I am not sure how to save the output in Ansible to 
>>> the output in a file like in shell >> /tmp/file 
>>>
>>> >>And there is something weird with the inventory you use...
>>> I had the inventory in /etc/ansible/hosts with:
>>>
>>> [test-vms]
>>> test-vm01
>>> test-vm02
>>> test-vm03
>>>  Frank
>>>
>>> On Tuesday, December 6, 2022 at 3:00:48 PM UTC-5 dnmv...@gmail.com 
>>> wrote:
>>>
>>>> Several things here. 
>>>> You're saving the result for each host to the same file. So you will 
>>>> end up with just one result, from the last host.
>>>> And there is something weird with the inventory you use. Follow the 
>>>> suggestion made by the code (use increased verbosity). 
>>>>
>>>>
>>>>
>>>> On Tue, 6 Dec 2022 at 20:54, Frank Ling  wrote:
>>>>
>>>>> I need some helps for fixing the bug of saving the Ansible ping 
>>>>> results to a local file. 
>>>>>
>>>>> Appreciate your help. 
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> Frank
>>>>>
>>>>> After running the playbook, I got this weird result:
>>>>>
>>>>> cat /tmp/file.txt
>>>>>
>>>>> {"ping": "pong", "failed": false, "changed": false}
>>>>>
>>>>> 
>>>>>
>>>>> Here is the playbook:
>>>>>
>>>>> ---
>>>>> - hosts: test-vms 
>>>>>   tasks:
>>>>> - name: Ping vms in test-vms
>>>>>   ansible.builtin.ping: 
>>>>>  register: ping_pong
>>>>>  ignore_errors: True
>>>>>
>>>>> - name: Copy the output result to /tmp/file.txt 
>>>>>   ansible.builtin.copy: 
>>>>

Re: [ansible-project] Fix the bug for saving Ansible ping results to a local file

2022-12-06 Thread Frank Ling
>>What makes it weird?
I wanted to save the ansible ping results to /tmp/file.txt so I can email 
out the result.

After running the playbook, I just got following saved in /tmp/file.txt:

{"ping": "pong", "failed": false, "changed": false}

>>What were you expecting instead?

I added a few lines in the playbook as:

---
- hosts: test-vms 
  tasks:
- name: Ping vms in test-vms
  ansible.builtin.ping: 
  register: ping_pong
  ignore_errors: True

- name: Ping result
  ansible.builtin.ping:
  register: ping_screen

- name: Ping the result to the screen
  ansible.builtin.debug:
 var: ping_screen

- name: Copy the output result to /tmp/file.txt 
  ansible.builtin.copy: 
  content: "{{ ping_pong }}"
  dest: /tmp/file.txt

When I ran it, the ping result would show on the screen as following and I 
would like to save following result to /tmp/file.txt:

...

TASK [Ping the result to the screen] 
***
ok: [test-vm01] => {
"ping_screen": {
"changed": false,
"failed": false,
"ping": "pong"
}
}
ok: [test-vm02] => {
"ping_screen": {
"changed": false,
"failed": false,
"ping": "pong"
}
}
ok: [test-vm03] => {
"ping_screen": {
"changed": false,
"failed": false,
"ping": "pong"
}
}






On Tuesday, December 6, 2022 at 3:21:44 PM UTC-5 Matt Martz wrote:

> Also, it helps when you clarify what you want to see, instead of "I got 
> this weird result".
>
> What makes it weird?  What were you expecting instead?
>
> On Tue, Dec 6, 2022 at 2:09 PM Frank Ling  wrote:
>
>> Thanks for the reply.
>>
>> >> You're saving the result for each host to the same file.
>> Yeah, you're right. I am not sure how to save the output in Ansible to 
>> the output in a file like in shell >> /tmp/file 
>>
>> >>And there is something weird with the inventory you use...
>> I had the inventory in /etc/ansible/hosts with:
>>
>> [test-vms]
>> test-vm01
>> test-vm02
>> test-vm03
>>  Frank
>>
>> On Tuesday, December 6, 2022 at 3:00:48 PM UTC-5 dnmv...@gmail.com wrote:
>>
>>> Several things here. 
>>> You're saving the result for each host to the same file. So you will end 
>>> up with just one result, from the last host.
>>> And there is something weird with the inventory you use. Follow the 
>>> suggestion made by the code (use increased verbosity). 
>>>
>>>
>>>
>>> On Tue, 6 Dec 2022 at 20:54, Frank Ling  wrote:
>>>
>>>> I need some helps for fixing the bug of saving the Ansible ping results 
>>>> to a local file. 
>>>>
>>>> Appreciate your help. 
>>>>
>>>> Thanks in advance.
>>>>
>>>> Frank
>>>>
>>>> After running the playbook, I got this weird result:
>>>>
>>>> cat /tmp/file.txt
>>>>
>>>> {"ping": "pong", "failed": false, "changed": false}
>>>>
>>>> 
>>>>
>>>> Here is the playbook:
>>>>
>>>> ---
>>>> - hosts: test-vms 
>>>>   tasks:
>>>> - name: Ping vms in test-vms
>>>>   ansible.builtin.ping: 
>>>>  register: ping_pong
>>>>  ignore_errors: True
>>>>
>>>> - name: Copy the output result to /tmp/file.txt 
>>>>   ansible.builtin.copy: 
>>>>   content: "{{ ping_pong }}"
>>>>   dest: /tmp/file.txt
>>>>
>>>> ===
>>>>
>>>> $ ansible-playbook ping_email.yml
>>>> [WARNING]: Invalid characters were found in group names but not 
>>>> replaced, use - to see details
>>>> [WARNING]: Found both group and host with same name: localhost
>>>>
>>>> PLAY [test-vms] 
>>>> 
>>>>
>>>> TASK [Gathering Facts] 
>>>> *
>>>> ok: [test-vm03]
&g

Re: [ansible-project] Fix the bug for saving Ansible ping results to a local file

2022-12-06 Thread Frank Ling
Thanks for the reply.

>> You're saving the result for each host to the same file.
Yeah, you're right. I am not sure how to save the output in Ansible to the 
output in a file like in shell >> /tmp/file 

>>And there is something weird with the inventory you use...
I had the inventory in /etc/ansible/hosts with:

[test-vms]
test-vm01
test-vm02
test-vm03
 Frank

On Tuesday, December 6, 2022 at 3:00:48 PM UTC-5 dnmv...@gmail.com wrote:

> Several things here. 
> You're saving the result for each host to the same file. So you will end 
> up with just one result, from the last host.
> And there is something weird with the inventory you use. Follow the 
> suggestion made by the code (use increased verbosity). 
>
>
>
> On Tue, 6 Dec 2022 at 20:54, Frank Ling  wrote:
>
>> I need some helps for fixing the bug of saving the Ansible ping results 
>> to a local file. 
>>
>> Appreciate your help. 
>>
>> Thanks in advance.
>>
>> Frank
>>
>> After running the playbook, I got this weird result:
>>
>> cat /tmp/file.txt
>>
>> {"ping": "pong", "failed": false, "changed": false}
>>
>> 
>>
>> Here is the playbook:
>>
>> ---
>> - hosts: test-vms 
>>   tasks:
>> - name: Ping vms in test-vms
>>   ansible.builtin.ping: 
>>  register: ping_pong
>>  ignore_errors: True
>>
>> - name: Copy the output result to /tmp/file.txt 
>>   ansible.builtin.copy: 
>>   content: "{{ ping_pong }}"
>>   dest: /tmp/file.txt
>>
>> ===
>>
>> $ ansible-playbook ping_email.yml
>> [WARNING]: Invalid characters were found in group names but not replaced, 
>> use - to see details
>> [WARNING]: Found both group and host with same name: localhost
>>
>> PLAY [test-vms] 
>> 
>>
>> TASK [Gathering Facts] 
>> *
>> ok: [test-vm03]
>> ok: [test-vm02]
>> ok: [test-vm01]
>>
>> TASK [Ping vms in test-vms] 
>> 
>> ok: [test-vm03]
>> ok: [test-vm02]
>> ok: [test-vm01]
>>
>> TASK [Copy the output result to /tmp/file.txt] 
>> *
>> changed: [test-vm01]
>> changed: [test-vm02]
>> changed: [test-vm03]
>>
>> PLAY RECAP 
>> *
>> test-vm01  : ok=3changed=1unreachable=0   
>>  failed=0skipped=0rescued=0ignored=0   
>> test-vm02  : ok=3changed=1unreachable=0   
>>  failed=0skipped=0rescued=0ignored=0   
>> test-vm03  : ok=3changed=1unreachable=0   
>>  failed=0skipped=0rescued=0ignored=0 
>>
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/15123a9a-fc1c-4b8b-8a0a-2f24cf9a06a6n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/15123a9a-fc1c-4b8b-8a0a-2f24cf9a06a6n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> -- 
> Sent from Gmail Mobile
>

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


[ansible-project] Fix the bug for saving Ansible ping results to a local file

2022-12-06 Thread Frank Ling
I need some helps for fixing the bug of saving the Ansible ping results to 
a local file. 

Appreciate your help. 

Thanks in advance.

Frank

After running the playbook, I got this weird result:

cat /tmp/file.txt

{"ping": "pong", "failed": false, "changed": false}



Here is the playbook:

---
- hosts: test-vms 
  tasks:
- name: Ping vms in test-vms
  ansible.builtin.ping: 
 register: ping_pong
 ignore_errors: True

- name: Copy the output result to /tmp/file.txt 
  ansible.builtin.copy: 
  content: "{{ ping_pong }}"
  dest: /tmp/file.txt

===

$ ansible-playbook ping_email.yml
[WARNING]: Invalid characters were found in group names but not replaced, 
use - to see details
[WARNING]: Found both group and host with same name: localhost

PLAY [test-vms] 


TASK [Gathering Facts] 
*
ok: [test-vm03]
ok: [test-vm02]
ok: [test-vm01]

TASK [Ping vms in test-vms] 

ok: [test-vm03]
ok: [test-vm02]
ok: [test-vm01]

TASK [Copy the output result to /tmp/file.txt] 
*
changed: [test-vm01]
changed: [test-vm02]
changed: [test-vm03]

PLAY RECAP 
*
test-vm01  : ok=3changed=1unreachable=0failed=0 
   skipped=0rescued=0ignored=0   
test-vm02  : ok=3changed=1unreachable=0failed=0 
   skipped=0rescued=0ignored=0   
test-vm03  : ok=3changed=1unreachable=0failed=0 
   skipped=0rescued=0ignored=0 

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


[ansible-project] ansible python issue

2021-10-13 Thread Marlon Frank
hi team,
I've recently logged an issue on githut however it was close by with clear
direction on what to do other than saying install kubernetes client
python...
that was already installed as described by me on that occasion...
any other pointers that could help?
I am losing hope here... I do have several other modules installed and
working just fine it is just the kubernetes module that seems to not work
for me...
more details here..
https://github.com/ansible/ansible/issues/76022
 and below as I can confirm that I already have it installed

marlon@ansible:~$ sudo pip install kubernetes
[sudo] password for marlon:
Requirement already satisfied: kubernetes in
/usr/local/lib/python3.8/dist-packages (8.0.2)
Requirement already satisfied: setuptools>=21.0.0 in
/usr/local/lib/python3.8/dist-packages (from kubernetes) (58.2.0)
Requirement already satisfied: google-auth>=1.0.1 in
/usr/local/lib/python3.8/dist-packages (from kubernetes) (2.3.0)
Requirement already satisfied: adal>=1.0.2 in
/usr/local/lib/python3.8/dist-packages (from kubernetes) (1.2.7)
Requirement already satisfied: urllib3>=1.24.2 in
/usr/local/lib/python3.8/dist-packages (from kubernetes) (1.26.7)
Requirement already satisfied: pyyaml>=3.12 in
/usr/local/lib/python3.8/dist-packages (from kubernetes) (5.4.1)
Requirement already satisfied: requests in
/usr/local/lib/python3.8/dist-packages (from kubernetes) (2.26.0)
Requirement already satisfied: six>=1.9.0 in
/usr/local/lib/python3.8/dist-packages (from kubernetes) (1.16.0)
Requirement already satisfied: certifi>=14.05.14 in
/usr/local/lib/python3.8/dist-packages (from kubernetes) (2021.10.8)
Requirement already satisfied: requests-oauthlib in
/usr/local/lib/python3.8/dist-packages (from kubernetes) (1.3.0)
Requirement already satisfied: python-dateutil>=2.5.3 in
/usr/local/lib/python3.8/dist-packages (from kubernetes) (2.8.2)
Requirement already satisfied:
websocket-client!=0.40.0,!=0.41.*,!=0.42.*,>=0.32.0 in
/usr/local/lib/python3.8/dist-packages (from kubernetes) (1.2.1)
Requirement already satisfied: rsa<5,>=3.1.4 in
/usr/local/lib/python3.8/dist-packages (from
google-auth>=1.0.1->kubernetes) (4.7.2)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in
/usr/local/lib/python3.8/dist-packages (from
google-auth>=1.0.1->kubernetes) (4.2.4)
Requirement already satisfied: pyasn1-modules>=0.2.1 in
/usr/local/lib/python3.8/dist-packages (from
google-auth>=1.0.1->kubernetes) (0.2.8)
Requirement already satisfied: cryptography>=1.1.0 in
/usr/local/lib/python3.8/dist-packages (from adal>=1.0.2->kubernetes)
(35.0.0)
Requirement already satisfied: PyJWT<3,>=1.0.0 in
/usr/local/lib/python3.8/dist-packages (from adal>=1.0.2->kubernetes)
(2.2.0)
Requirement already satisfied: idna<4,>=2.5; python_version >= "3" in
/usr/local/lib/python3.8/dist-packages (from requests->kubernetes) (3.2)
Requirement already satisfied: charset-normalizer~=2.0.0; python_version >=
"3" in /usr/local/lib/python3.8/dist-packages (from requests->kubernetes)
(2.0.7)
Requirement already satisfied: oauthlib>=3.0.0 in
/usr/local/lib/python3.8/dist-packages (from requests-oauthlib->kubernetes)
(3.1.1)
Requirement already satisfied: pyasn1>=0.1.3 in
/usr/local/lib/python3.8/dist-packages (from
rsa<5,>=3.1.4->google-auth>=1.0.1->kubernetes) (0.4.8)
Requirement already satisfied: cffi>=1.12 in
/usr/local/lib/python3.8/dist-packages (from
cryptography>=1.1.0->adal>=1.0.2->kubernetes) (1.14.6)
Requirement already satisfied: pycparser in
/usr/local/lib/python3.8/dist-packages (from
cffi>=1.12->cryptography>=1.1.0->adal>=1.0.2->kubernetes) (2.20)
marlon@ansible:~$ sudo ansible-galaxy collection install kubernetes.core
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/download/kubernetes-core-2.2.0.tar.gz
to
/root/.ansible/tmp/ansible-local-750klau04v6/tmpzha4qz6v/kubernetes-core-2.2.0-3gkt2qxk
Installing 'kubernetes.core:2.2.0' to
'/root/.ansible/collections/ansible_collections/kubernetes/core'
kubernetes.core:2.2.0 was installed successfully
marlon@ansible:~$ sudo ansible-galaxy collection install
community.kubernetes
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading
https://galaxy.ansible.com/download/community-kubernetes-2.0.0.tar.gz to
/root/.ansible/tmp/ansible-local-768144b2u_w/tmp3p0zh0_e/community-kubernetes-2.0.0-qe0hy7yf
Installing 'community.kubernetes:2.0.0' to
'/root/.ansible/collections/ansible_collections/community/kubernetes'
community.kubernetes:2.0.0 was installed successfully
Skipping 'kubernetes.core:2.2.0' as it is already installed

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/

Re: [ansible-project] Need help of Ansible lineinfile module with a variable based on hostname

2021-02-06 Thread FRANK L
Thanks a lot for the tip, Racke.   It really works. 

I really appreciate your help.

Regards

Frank

On Saturday, February 6, 2021 at 7:16:36 AM UTC-5 brae...@gmail.com wrote:

> On 2/5/21 7:46 PM, FRANK L wrote:
> > Hi, 
> > 
> > I need help of Ansible lineinfile module with a variable based on 
> hostname. Here is what I have for the task:>
> > On server vccs7ap01:
> > 
> > - name: ulimits - find sidadm on the server
> >   shell: hostname | sed 's/vc//' | sed 's/ap[0-9][0-9]//g' | sed 
> 's/$/adm/'
> >   register: sidadm
> > 
>
> Ansible has already the hostname present in the variable 
> "ansible_hostname", so you can really save the roundtrip to
> vccs7ap01:
>
> - name:
> set_fact:
> sidadm: "{{ ansible_hostname | regex_replace('vc') | 
> regex_replace('ap[0-9][0-9]') + 'adm' }}"
>
>
> > - name: ulimits - add sidadm soft value to limits file
> >   lineinfile:
> > path: /etc/security/limits.conf
> > regexp: '^sidadm.stdout\ soft'
> > line: "@sidadm.stdout\ soft 65536"
> > 
> > - name: ulimits - add sidadm hard value to limits file
> >   lineinfile:
> > path: /etc/security/limits.conf
> > regexp: '^sidadm.stdout\ hard'
> > line: "@sidadm.stdout\ hard 65536"
>
> There is also a dedicated module for adjusting PAM limits, so let's use 
> that:
>
> - name: ulimits - add sidadm soft value to limits file
> pam_limits:
> domain: "{{ sidadm }}"
> limit_type: soft
> limit_item: nofile
> value: "65536"
>
> > 
> > After ran the playbook, change was made to /etc/security/limits.conf:
> > @sidadm.stdout soft 65536
> > @sidadm.stdout hard 65536
> > 
> > but I would like to have the entries:
> > cs7adm soft 65536
> > cs7adm hard 65536
> > 
>
> Shouldn't that be:
>
> cs7adm soft nofile 65536
> cs7adm hard nofile 65536
>
> Regards
> Racke
>
> > Thanks in advance. 
> > 
> > Frank
> > 
> > -- 
> > 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  ansible-proje...@googlegroups.com>.
> > To view this discussion on the web visit
> > 
> https://groups.google.com/d/msgid/ansible-project/d3fca17a-e73e-40fe-8c3a-967017991a50n%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/d3fca17a-e73e-40fe-8c3a-967017991a50n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>
>
> -- 
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1e097f69-38bd-45fd-9f03-2754bc94c168n%40googlegroups.com.


[ansible-project] Need help of Ansible lineinfile module with a variable based on hostname

2021-02-05 Thread FRANK L
Hi, 

I need help of Ansible lineinfile module with a variable based on hostname. 
Here is what I have for the task:

On server vccs7ap01:

- name: ulimits - find sidadm on the server
  shell: hostname | sed 's/vc//' | sed 's/ap[0-9][0-9]//g' | sed 
's/$/adm/'
  register: sidadm

- name: ulimits - add sidadm soft value to limits file
  lineinfile:
path: /etc/security/limits.conf
regexp: '^sidadm.stdout\ soft'
line: "@sidadm.stdout\ soft 65536"

- name: ulimits - add sidadm hard value to limits file
  lineinfile:
path: /etc/security/limits.conf
regexp: '^sidadm.stdout\ hard'
line: "@sidadm.stdout\ hard 65536"

After ran the playbook, change was made to /etc/security/limits.conf:
@sidadm.stdout soft 65536
@sidadm.stdout hard 65536

but I would like to have the entries:
cs7adm soft 65536
cs7adm hard 65536

Thanks in advance. 

Frank

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


[ansible-project] Re: gcp_compute_* modules: trying to link using selfLink

2020-03-12 Thread Frank Gravato
Hi Lujaina,

Were you able to get this working I'm currently working on a project trying 
to get this working exactly in the same setup as your post.


On Thursday, January 2, 2020 at 9:46:16 AM UTC-5, Lujaina Abu Erban wrote:
>
> Thank you for the response, 
> But unfortunately, this also did not work for me
>
> On Thursday, January 2, 2020 at 2:41:50 PM UTC+1, JF wrote:
>>
>> Hello.
>> Try to use '- network: " {{ network }}"' instead of '- network: "{{ 
>> network.selfLink }}"'
>>
>> On Thursday, January 2, 2020 at 3:15:52 PM UTC+2, Lujaina Abu Erban wrote:
>>>
>>> I am new to using Ansible and the gcp_* modules.
>>>
>>> This is in relation to making use of Google Cloud Platform and Ansible. 
>>>
>>> Let us say that I have two projects: HOST_PROJECT and SERVICE_PROJECT. 
>>> They are both part of the same organisation.
>>> The host project, serves as a shared VPC host, while the service project 
>>> is using the shared VPC from the host project.
>>>
>>> Using Ansible, I want to create an instance template (using the 
>>> gcp_compute_instance_template module) to create a template the makes use of 
>>> the shared VPC network.
>>>
>>> Here is my ansible playbook:
>>>
>>> ---
>>> - name: test
>>>   hosts: localhost
>>>   gather_facts: no
>>>   vars_files:
>>> - ./vars/global.yaml
>>>   vars:
>>> service_account_file: 'gcloud-api-key.json'
>>> project: SERVICE_PROJECT
>>> auth_kind: serviceaccount
>>> scopes: 
>>>   - https://www.googleapis.com/auth/compute
>>>   
>>>
>>>   tasks: 
>>> - name: check network information
>>>   gcp_compute_network_info:
>>> filters:
>>>   - name = "{{ shared_network }}"
>>> project: HOST_PROJECT
>>> auth_kind: "{{ auth_kind }}"
>>> service_account_file: "{{ service_account_file }}"
>>>   register: network
>>> 
>>> - name: create an instance template
>>>   gcp_compute_instance_template:
>>> name: instance_template
>>> properties:
>>>   disks:
>>>   - auto_delete: 'true'
>>> boot: 'true'
>>> initialize_params:
>>>   source_image: projects/ubuntu-os-cloud/global/images/
>>> family/ubuntu-1604-lts
>>>   machine_type: f1-micro
>>>   network_interfaces:
>>>   - network: "{{ network.selfLink }}"
>>> access_configs:
>>> - name: access_config
>>>   type: ONE_TO_ONE_NAT
>>> project: SERVICE_PROJECT
>>> auth_kind: "{{ auth_kind }}"
>>> service_account_file: "{{ service_account_file }}"
>>> state: present
>>>   register: instancetemplate
>>>
>>> Running the following command: ansible-playbook test.yaml -vvv
>>> I get the following error:
>>>
>>> "msg": "argument network is of type  found in 'properties 
>>> -> network_interfaces'. and we were unable to convert to dict: dictionary 
>>> requested, could not parse JSON or key=value"
>>>
>>> I am sure it is referring to the network.selfLink line. 
>>>
>>> My question is, is this possible to do using this module? And am I 
>>> approaching this correctly?
>>>
>>> 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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dc4cf61b-824a-4de2-9af8-741dd0533827%40googlegroups.com.


[ansible-project] Help on Ansible gcp_compute_snapshot module

2020-03-06 Thread FRANK L
Hi Ansible helpers,

Could someone help on how to use the Ansible gcp_compute_snapshot module?

I created an Ansible playbook as bollow but ran into one error during the 
snapshot on SUSE 12.3.  The error was "fatal: [patchtest03]: FAILED! => 
{"changed": false, "msg": "argument source_disk is of type  
and we were unable to convert to dict:  cannot be converted to 
a dict"}
"

The more detailed Ansible gcp_compute_snapshot module can be found: 

https://docs.ansible.com/ansible/latest/modules/gcp_compute_snapshot_module.html

Thanks a lot in advance.

Frank

---
- hosts: snapshots_test
  become: yes
  vars:
disks:
  - patchtest03

  tasks:

- name: create a snapshot
  gcp_compute_snapshot:
 name: Testing snapshots for patchtest03
 source_disk: "{{ disks }}"
 zone: us-central1-a
 labels:
   my_label: value
 project: np-sapcar
 auth_kind: serviceaccount
 service_account_file: 
"/home/ansible/managed_files/np-sap-json/np-sapcar-483f5968b671.json"
 state: present

-

PLAY [snapshots_test] 
*

TASK [Gathering Facts] 

[WARNING]: Platform linux on host patchtest03 is using the discovered 
Python interpreter at /usr/bin/python, but future installation
of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html
 
for more information.

ok: [patchtest03]

TASK [create a snapshot] 
**
skipping: [patchtest03]

PLAY RECAP 

patchtest03: ok=1changed=0unreachable=0
failed=0skipped=1rescued=0ignored=0

[ansible@npcaradmin01 playbooks]$ ansible-playbook snapshot_backups.yml

PLAY [snapshots_test] 
*

TASK [Gathering Facts] 

[WARNING]: Platform linux on host patchtest03 is using the discovered 
Python interpreter at /usr/bin/python, but future installation
of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html
 
for more information.

ok: [patchtest03]

TASK [create a snapshot] 
**
fatal: [patchtest03]: FAILED! => {"changed": false, "msg": "argument 
source_disk is of type  and we were unable to convert to dict: 
 cannot be converted to a dict"}

PLAY RECAP 

patchtest03: ok=1changed=0unreachable=0
failed=1skipped=0rescued=0ignored=0


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


[ansible-project] Re: How to specify the user home directory dynamatically with /home/{{ 'echo{$USER}' }}/sub_dir for copying files with Ansible copy module ?

2020-01-22 Thread FRANK L
Dick, 

Thanks for the suggestion. 

We use visudo for editing the sudoers file in the first place. So if any 
mistakes made we could catch up in the first place.

Your suggestion is the good one, and I like it. 

Frank
 

On Tuesday, January 21, 2020 at 9:07:45 PM UTC-5, FRANK L wrote:
>
> Hi, 
>
> I would like to use git for managing Ansible playbooks for version control 
> on an admin server in GCP.  So the idea is this: 
> each user in the admin group to run the playbooks pulled from the github 
> ino their repo from each user's home.  for exampel:
> for user1,
>run ansible playbooks from: 
> adminserver:/home/user1/user1_git_repo/playbooks
>
> for user1,
>   run ansible playbooks from: 
> adminserver:/home/user2/user2_git_repo/playbooks
>
> etc.
>
> I have this Ansible playbook but it doesn't work:
>
>
> 
> ---
> - hosts: sudo
>   become: yes
>  
>   - name: Copy the sudoers file from ~/managed_files/sudo_ii/sudoers to 
> /etc on the remote VMs
>  copy:
> src: /home/{{ 'echo ${USER}' }}/managed_files/sudo_ii/sudoers
> dest: /etc
> owner: root
> group: root
> mode: '0440'
>
> 
>
> The error was:
>
> fatal: [gittest]: FAILED! => {"changed": false, "msg": "Could not find or 
> access '/home/echo ${USER}/managed_files/sudo_ii/sudoers' on the Ansible 
> Controller.\nIf you are using a module and expect the file to exist on the 
> remote, see the remote_src option"}
> An exception occurred during task execution. To see the full traceback, 
> use -vvv. The error was: If you are using a module.
>
> How to specify the user home directory dynamatically with /home/{{ 
> 'echo{$USER}' }}/sub_dir for copying files with Ansible copy module ?
>
> Please help!  Thanks in advance.   
>
> Frank
>
>

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


[ansible-project] Re: How to specify the user home directory dynamatically with /home/{{ 'echo{$USER}' }}/sub_dir for copying files with Ansible copy module ?

2020-01-22 Thread FRANK L
Hi Michael,

Thanks for the tip.  Yes, it works. 

Frank

On Tuesday, January 21, 2020 at 9:07:45 PM UTC-5, FRANK L wrote:
>
> Hi, 
>
> I would like to use git for managing Ansible playbooks for version control 
> on an admin server in GCP.  So the idea is this: 
> each user in the admin group to run the playbooks pulled from the github 
> ino their repo from each user's home.  for exampel:
> for user1,
>run ansible playbooks from: 
> adminserver:/home/user1/user1_git_repo/playbooks
>
> for user1,
>   run ansible playbooks from: 
> adminserver:/home/user2/user2_git_repo/playbooks
>
> etc.
>
> I have this Ansible playbook but it doesn't work:
>
>
> 
> ---
> - hosts: sudo
>   become: yes
>  
>   - name: Copy the sudoers file from ~/managed_files/sudo_ii/sudoers to 
> /etc on the remote VMs
>  copy:
> src: /home/{{ 'echo ${USER}' }}/managed_files/sudo_ii/sudoers
> dest: /etc
> owner: root
> group: root
> mode: '0440'
>
> 
>
> The error was:
>
> fatal: [gittest]: FAILED! => {"changed": false, "msg": "Could not find or 
> access '/home/echo ${USER}/managed_files/sudo_ii/sudoers' on the Ansible 
> Controller.\nIf you are using a module and expect the file to exist on the 
> remote, see the remote_src option"}
> An exception occurred during task execution. To see the full traceback, 
> use -vvv. The error was: If you are using a module.
>
> How to specify the user home directory dynamatically with /home/{{ 
> 'echo{$USER}' }}/sub_dir for copying files with Ansible copy module ?
>
> Please help!  Thanks in advance.   
>
> Frank
>
>

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


[ansible-project] How to specify the user home directory dynamatically with /home/{{ 'echo{$USER}' }}/sub_dir for copying files with Ansible copy module ?

2020-01-21 Thread FRANK L
Hi, 

I would like to use git for managing Ansible playbooks for version control 
on an admin server in GCP.  So the idea is this: 
each user in the admin group to run the playbooks pulled from the github 
ino their repo from each user's home.  for exampel:
for user1,
   run ansible playbooks from: 
adminserver:/home/user1/user1_git_repo/playbooks

for user1,
  run ansible playbooks from: 
adminserver:/home/user2/user2_git_repo/playbooks

etc.

I have this Ansible playbook but it doesn't work:


---
- hosts: sudo
  become: yes
 
  - name: Copy the sudoers file from ~/managed_files/sudo_ii/sudoers to 
/etc on the remote VMs
 copy:
src: /home/{{ 'echo ${USER}' }}/managed_files/sudo_ii/sudoers
dest: /etc
owner: root
group: root
mode: '0440'


The error was:

fatal: [gittest]: FAILED! => {"changed": false, "msg": "Could not find or 
access '/home/echo ${USER}/managed_files/sudo_ii/sudoers' on the Ansible 
Controller.\nIf you are using a module and expect the file to exist on the 
remote, see the remote_src option"}
An exception occurred during task execution. To see the full traceback, use 
-vvv. The error was: If you are using a module.

How to specify the user home directory dynamatically with /home/{{ 
'echo{$USER}' }}/sub_dir for copying files with Ansible copy module ?

Please help!  Thanks in advance.   

Frank

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


[ansible-project] How to detect AWS instance type

2019-02-25 Thread Frank Dias
I have an old playbook that will add an addition volume and it works fine on t2 
instances. With the move to t3 instances we also now have nvme based ebs. 

The play book uses lvm to setup the second volume we add the volume as xvdf so 
/dev/xvdf.
Now on t3 instances when we add the volume as xvdf the volume now shows up as 
/dev/nvme1n1.

Has anyone figured out a playbook to handle both situations?

-- 
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/92c7d8a0-ad32-4120-a9b5-3a3bf0f7c438%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] playbooks failing after upgrade

2019-02-21 Thread Frank Dias
look at logs on playbooks that worked are now failing
working task before upgrade
TASK [config-seeding : Clean build directory] 
**
Using module file 
/usr/lib/python2.7/site-packages/ansible/modules/files/file.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: awx
<127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p " `echo 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743` 
" && echo ansible-tmp-1550518656.25-107290640962743=" `echo 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743` " ) && 
sleep 0'
<127.0.0.1> PUT /tmp/tmpva01gk TO 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743/file.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743/ 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743/file.py 
&& sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python2 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743/file.py; 
rm -rf "/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743/" 
> /dev/null 2>&1 && sleep 0'
changed: [localhost]
META: ran handlers

after upgrade 
TASK [config-seeding : Clean build directory] 
**
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: awx
<127.0.0.1> EXEC /bin/sh -c 'echo ~awx && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p " `echo 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029` " && 
echo ansible-tmp-1550685564.21-49495796014029=" `echo 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029` " ) && 
sleep 0'
Using module file 
/usr/lib/python2.7/site-packages/ansible/modules/files/file.py
<127.0.0.1> PUT 
/var/lib/awx/.ansible/tmp/ansible-local-4464sAQz1X/tmp7OWQ36 TO 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029/AnsiballZ_file.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029/ 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029/AnsiballZ_file.py
 
&& sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python2 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029/AnsiballZ_file.py
 
&& sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029/ > 
/dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {"changed": false, "msg": "rmtree failed: 
[Errno 13] Permission denied: './target/seeding/consoleutility/modules'"} 

the structure seems to have changed

-- 
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/dca447de-6fd5-475b-8949-404329fe0076%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] issues with tasks after upgrade

2019-02-20 Thread Frank Dias
Work task before upgrade:

TASK [config-seeding : Clean build directory] 
**
Using module file 
/usr/lib/python2.7/site-packages/ansible/modules/files/file.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: awx
<127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p " `echo 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743` " && 
echo ansible-tmp-1550518656.25-107290640962743=" `echo 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743` " ) && 
sleep 0'
<127.0.0.1> PUT /tmp/tmpva01gk TO 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743/file.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743/ 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743/file.py 
&& sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python2 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743/file.py; 
rm -rf 
"/var/lib/awx/.ansible/tmp/ansible-tmp-1550518656.25-107290640962743/" > 
/dev/null 2>&1 && sleep 0'
changed: [localhost]
META: ran handlers


failed
TASK [config-seeding : Clean build directory] 
**
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: awx
<127.0.0.1> EXEC /bin/sh -c 'echo ~awx && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p " `echo 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029` " && 
echo ansible-tmp-1550685564.21-49495796014029=" `echo 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029` " ) && 
sleep 0'
Using module file 
/usr/lib/python2.7/site-packages/ansible/modules/files/file.py
<127.0.0.1> PUT 
/var/lib/awx/.ansible/tmp/ansible-local-4464sAQz1X/tmp7OWQ36 TO 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029/AnsiballZ_file.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029/ 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029/AnsiballZ_file.py
 
&& sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python2 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029/AnsiballZ_file.py
 
&& sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r 
/var/lib/awx/.ansible/tmp/ansible-tmp-1550685564.21-49495796014029/ > 
/dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {"changed": false, "msg": "rmtree failed: 
[Errno 13] Permission denied: './target/seeding/consoleutility/modules'"} 
(edited) 


they add awx  /bin/sh -c 'echo ~awx && sleep 0
they changed command from rm -rf   EXEC /bin/sh -c 'rm -f -r
they split the exec on file from one step to two steps

-- 
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/cce81618-6cb8-492e-8a8e-0ae119e02c03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] mounting addition disks issue on new instance types

2019-02-14 Thread Frank Dias
the following play work on t2 instances, the issue I am running into is 
when I try to run it against a t3 instance it fails.
it looks like the issue comes from the new instance types are using 
/dev/nvme0n1p1 for root and /nvme1n1 for the second drive. t2 vs (t3. m5 
,c5)
so is there a ec2 fact that I can filter on to set the var additional_disk
:"{{platform}}"
any exampled that anone willing to share of how they are dealing with the 
change in device name for the new instance types.

additional_disk: /dev/xvdb
# mountpoint: /mnt


- name: check if {{ additional_disk }} exists
set_fact:
exist_device: True
when: ansible_devices[ "{{ additional_disk | basename }}" ] is defined

- name: check if {{ additional_disk }} in use
command: pvdisplay "{{ additional_disk }}"
register: result
ignore_errors: True

- name: format new volume
filesystem:
fstype: ext4
dev: "{{ additional_disk }}"
when: exist_device is defined and result|failed

- name: mount {{ additional_disk }} on {{ mountpoint }}
mount:
name: "{{ mountpoint }}"
src: "{{ additional_disk }}"
fstype: ext4
state: mounted
when: exist_device is defined and mountpoint is defined

-- 
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/d94a1790-3a32-4f47-9bd6-50ee6f3414bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ansible role/playbook cloudwatch alarm

2019-01-03 Thread Frank Dias
I am looking for a role or play book that one could run against AWS EC2 
instances and set a cloud watch alarm for "cpucreditbalance".

frank

-- 
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/c447c177-38ff-4afa-9c44-d4e4c5cbbb55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: having issues with finding AMI

2018-12-11 Thread Frank Dias
ami-0307f7ccf6ea35750

refer to this link for the latest  
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI_launch_latest.html

On Saturday, December 8, 2018 at 3:54:01 AM UTC-6, Karl Auer wrote:
>
> Hullo Frank.
>
> What specific AMI did you expect your code to find?
>
> Did you manually locate that AMI in the available AMIs for that region?
>
> I.e., do you know for a fact that the AMI you seek does exist and does 
> match that search string? Please tell us the specific AMI ID that you think 
> matches your search string.
>
> Also, you have provided two different search strings - which one is being 
> used by your code?
>
> Regards, K.
>
>
> On Fri, Dec 7, 2018 at 11:37 AM Frank Dias  > wrote:
>
>> here are the extra vars being set;
>> account: prod
>> ami_search_string: amzn-ami-2018.03.i-amazon-ecs-optimized
>> asg_name: MiscServices
>> cluster_name: MiscServices
>> instance_type: m5.2xlarge
>> lc_name: MiscServices
>> region: us-west-2
>>
>>
>> On Thursday, December 6, 2018 at 2:45:21 PM UTC-6, Frank Dias wrote:
>>>
>>> ami_search_string: "amzn*amazon-ecs-optimized*"
>>>
>>>
>>>   ec2_ami_find:
>>> name: "{{ ami_search_string }}"
>>> region: "{{ region }}"
>>> virtualization_type: hvm
>>> owner: aws-marketplace
>>> sort: creationDate
>>> sort_order: descending
>>> sort_end: 1
>>>   register: os_image
>>>   when:
>>> - lc_ami is not defined
>>>
>>> failing to discover the ami from the following;
>>>
>>>
>>> https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html
>>>
>>> launch configuration fails on ami.
>>>
>>>
>>> -- 
>> 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/01d5bed1-eb12-4016-b8e1-db064e2f3b38%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/01d5bed1-eb12-4016-b8e1-db064e2f3b38%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Karl Auer
>
> Email  : ka...@2pisoftware.com 
> Website: http://2pisoftware.com
>
> GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
> Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
>

-- 
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/de790081-8dc0-48a4-b764-ebb17e550c02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: having issues with finding AMI

2018-12-06 Thread Frank Dias
here are the extra vars being set;
account: prod
ami_search_string: amzn-ami-2018.03.i-amazon-ecs-optimized
asg_name: MiscServices
cluster_name: MiscServices
instance_type: m5.2xlarge
lc_name: MiscServices
region: us-west-2


On Thursday, December 6, 2018 at 2:45:21 PM UTC-6, Frank Dias wrote:
>
> ami_search_string: "amzn*amazon-ecs-optimized*"
>
>
>   ec2_ami_find:
> name: "{{ ami_search_string }}"
> region: "{{ region }}"
> virtualization_type: hvm
> owner: aws-marketplace
> sort: creationDate
> sort_order: descending
> sort_end: 1
>   register: os_image
>   when:
> - lc_ami is not defined
>
> failing to discover the ami from the following;
>
>
> https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html
>
> launch configuration fails on ami.
>
>
>

-- 
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/01d5bed1-eb12-4016-b8e1-db064e2f3b38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: having issues with finding AMI

2018-12-06 Thread Frank Dias
- name: find an ami if none is given
ec2_ami_find:
name: "{{ ami_search_string }}"
region: "{{ region }}"
virtualization_type: hvm
owner: aws-marketplace
sort: creationDate
sort_order: descending
sort_end: 1
register: os_image
when:
- lc_ami is not defined

- name: set the ami
set_fact:
lc_ami: "{{ os_image.results[0].ami_id }}"
when:
- lc_ami is not defined
- os_image is defined

- name: Delete previous launch configuration and auto scaling group if they 
exist
include: delete_previous.yml
when: delete_previous


- ec2_lc:
assign_public_ip: "{{ assign_public_ip }}"
name: "{{ lc_name }}"
image_id: "{{ lc_ami }}"
key_name: "{{ keypair }}"
region: "{{ region }}"
security_groups: "{{ asg_security_groups }}"
instance_type: "{{ instance_type }}"
volumes: "{{ volumes }}"
instance_profile_name: "{{ instance_profile_name }}"
user_data: "{{ lookup('file', user_data_file )}}"

- ec2_asg:
name: "{{ asg_name }}"
launch_config_name: "{{ lc_name }}"
min_size: "{{ asg_min }}"
max_size: "{{ asg_max }}"
desired_capacity: "{{ asg_des }}"
region: "{{ region }}"
vpc_zone_identifier: "{{ vpc_zone_identifier }}"
tags: "{{ asg_instances_tags }}"


TASK [aws/asg : set the ami] 
***
13:41:56
22
 fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' 
has an invalid value, which appears to include a variable that is 
undefined. The error was: list object has no element 0\n\nThe error appears 
to have been in 
'/var/lib/awx/projects/_1067__production_us/roles/aws/asg/tasks/main.yml': 
line 14, column 3, but may\nbe elsewhere in the file depending on the exact 
syntax problem.\n\nThe offending line appears to be:\n\n\n- name: set the 
ami\n ^ here\n"} 


On Thursday, December 6, 2018 at 2:45:21 PM UTC-6, Frank Dias wrote:
>
> ami_search_string: "amzn*amazon-ecs-optimized*"
>
>
>   ec2_ami_find:
> name: "{{ ami_search_string }}"
> region: "{{ region }}"
> virtualization_type: hvm
> owner: aws-marketplace
> sort: creationDate
> sort_order: descending
> sort_end: 1
>   register: os_image
>   when:
> - lc_ami is not defined
>
> failing to discover the ami from the following;
>
>
> https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html
>
> launch configuration fails on ami.
>
>
>

-- 
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/48cc56fb-1c64-4c8b-9fd9-af9f209b42f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] having issues with finding AMI

2018-12-06 Thread Frank Dias
ami_search_string: "amzn*amazon-ecs-optimized*"


  ec2_ami_find:
name: "{{ ami_search_string }}"
region: "{{ region }}"
virtualization_type: hvm
owner: aws-marketplace
sort: creationDate
sort_order: descending
sort_end: 1
  register: os_image
  when:
- lc_ami is not defined

failing to discover the ami from the following;

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html

launch configuration fails on ami.


-- 
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/c8af0c8e-f47c-49ab-85e6-2619e9e06b1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] "flush_handlers task does not support when conditional"...??

2018-11-29 Thread Frank Thommen
Hmm.  That would explain some random issues that we had in the past with 
this playbook




On 11/29/2018 08:15 PM, Matt Martz wrote:
A when statement supplied to flush_handlers has never worked.  It was 
silently ignored in the past, but now has a warning.


There is an open feature request to allow this to work:
https://github.com/ansible/ansible/issues/41313


On Thu, Nov 29, 2018 at 1:09 PM Frank Thommen <mailto:lists.ansi...@drosera.ch>> wrote:


Hello,

our latest yum update brought ansible from 2.4.2.0 to 2.7.2 and now we
are facing

     [WARNING]: flush_handlers task does not support when conditional

we need the handlers to be flushed at that point, as later tasks
rely on
previously reconfigured services to be reloaded.  The "when" originates
from our role definition:

--
- hosts: all
    name:  "== BLAH =="
    roles:
      - { role: blah, when: has_blah|default(False) }
    tags:
      - blah-only
--
(has_blah is an inventory variable, the hosts which "have blah" are
spread over all our host groups.  To organize them in a separate host
group would be too much overhead as this characteristic can change very
often).

I can't find this restriction mentioned anywhere in the changelogs or
the documentation of handlers or "meta" and I wonder

a) why this - IMHO irritating - change of behaviour has been introduced

and

b) what would be the best way to work around it


Any help or hint is appreciated.


frank


-- 
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
<mailto:ansible-project%2bunsubscr...@googlegroups.com>.
To post to this group, send email to
ansible-project@googlegroups.com
<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/ansible-project/f9ecce8b-2c47-472d-ad1e-9074f3894070%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.

--
Matt Martz
@sivel
sivel.net <http://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 
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To post to this group, send email to ansible-project@googlegroups.com 
<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v95xvMwYZmJP0Lqh%3Drq3rxeDiEg4xCXB%3Dp09yFVra1z-A%40mail.gmail.com 
<https://groups.google.com/d/msgid/ansible-project/CAD8N0v95xvMwYZmJP0Lqh%3Drq3rxeDiEg4xCXB%3Dp09yFVra1z-A%40mail.gmail.com?utm_medium=email&utm_source=footer>.

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/4b41a481-2421-dcb1-aac2-6bef2e97cd9c%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] "flush_handlers task does not support when conditional"...??

2018-11-29 Thread Frank Thommen

Hello,

our latest yum update brought ansible from 2.4.2.0 to 2.7.2 and now we 
are facing


   [WARNING]: flush_handlers task does not support when conditional

we need the handlers to be flushed at that point, as later tasks rely on 
previously reconfigured services to be reloaded.  The "when" originates 
from our role definition:


--
- hosts: all
  name:  "== BLAH =="
  roles:
- { role: blah, when: has_blah|default(False) }
  tags:
- blah-only
--
(has_blah is an inventory variable, the hosts which "have blah" are 
spread over all our host groups.  To organize them in a separate host 
group would be too much overhead as this characteristic can change very 
often).


I can't find this restriction mentioned anywhere in the changelogs or 
the documentation of handlers or "meta" and I wonder


a) why this - IMHO irritating - change of behaviour has been introduced

and

b) what would be the best way to work around it


Any help or hint is appreciated.


frank


--
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/f9ecce8b-2c47-472d-ad1e-9074f3894070%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Copy multiple files to different locations on remote server

2018-11-02 Thread Frank Thommen
Then your remote file is most probably identical to the one you are 
trying to copy ;-)


Did you check that your local file (src) is for sure different from the 
remote one (dest)?  Run `ansible-playbook` with '-vvv' to see, which 
local files ansible selects (this can be confusing when you are using 
roles) and compare with remote file.


frank


On 11/02/2018 09:51 AM, Keshipeddy Anusha wrote:

No change Mohan
It is not replacing the file

On Fri, Nov 2, 2018, 2:20 PM Mohan L <mailto:thefossg...@gmail.com> wrote:


copy module with force yes automatically replace it. Otherwise you
may need to delete it before copy task.

On Thursday, November 1, 2018 at 8:11:53 PM UTC+5:30, Keshipeddy
Anusha wrote:

Okay got it. Is there any specific module that we can use to
replace a complete file in remote server?

Thank you for your help.

Thanks,
Anusha

On Thu, Nov 1, 2018, 8:07 PM Mohan L -- 
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/4950ba71-0f0d-4630-8c1c-475fc93f8fc2%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-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/01ef6833-b052-43ff-881e-70ad14e427e6%40googlegroups.com

<https://groups.google.com/d/msgid/ansible-project/01ef6833-b052-43ff-881e-70ad14e427e6%40googlegroups.com?utm_medium=email&utm_source=footer>.
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
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To post to this group, send email to
ansible-project@googlegroups.com
<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/ansible-project/b6898b5a-9204-4c27-bded-506194a56cfd%40googlegroups.com

<https://groups.google.com/d/msgid/ansible-project/b6898b5a-9204-4c27-bded-506194a56cfd%40googlegroups.com?utm_medium=email&utm_source=footer>.
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 
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To post to this group, send email to ansible-project@googlegroups.com 
<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEME5dR5Xi7SU%2BPRV11GohZgQ2%2BDM6%2B2hPu%2B-ehJOGc7DXkk%3Dg%40mail.gmail.com 
<https://groups.google.com/d/msgid/ansible-project/CAEME5dR5Xi7SU%2BPRV11GohZgQ2%2BDM6%2B2hPu%2B-ehJOGc7DXkk%3Dg%40mail.gmail.com?utm_medium=email&utm_source=footer>.

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/97961e31-48d1-29ea-2e29-34723f192139%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Copy multiple files to different locations on remote server

2018-11-02 Thread Frank Thommen

This is not the same:

  * copy module copies from the controller (where you run the
ansible-playbook command) to the client
  * cp -f copies a file locally from client to itself

frank



On 11/02/2018 10:25 AM, Mohan L wrote:

Try with command or shell module with cp -f.

On Friday, November 2, 2018 at 2:21:33 PM UTC+5:30, Keshipeddy Anusha wrote:

No change Mohan
It is not replacing the file

On Fri, Nov 2, 2018, 2:20 PM Mohan L  wrote:

copy module with force yes automatically replace it. Otherwise
you may need to delete it before copy task.

On Thursday, November 1, 2018 at 8:11:53 PM UTC+5:30, Keshipeddy
Anusha wrote:

Okay got it. Is there any specific module that we can use to
replace a complete file in remote server?

Thank you for your help.

Thanks,
Anusha

On Thu, Nov 1, 2018, 8:07 PM Mohan L -- 
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/4950ba71-0f0d-4630-8c1c-475fc93f8fc2%40googlegroups.com

<https://groups.google.com/d/msgid/ansible-project/4950ba71-0f0d-4630-8c1c-475fc93f8fc2%40googlegroups.com>.
For more options, visit
https://groups.google.com/d/optout
<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-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/01ef6833-b052-43ff-881e-70ad14e427e6%40googlegroups.com

<https://groups.google.com/d/msgid/ansible-project/01ef6833-b052-43ff-881e-70ad14e427e6%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit
https://groups.google.com/d/optout
<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-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/b6898b5a-9204-4c27-bded-506194a56cfd%40googlegroups.com

<https://groups.google.com/d/msgid/ansible-project/b6898b5a-9204-4c27-bded-506194a56cfd%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout
<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 
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To post to this group, send email to ansible-project@googlegroups.com 
<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f963a9e3-56c8-4ebb-a3c7-8b7cbe5b812d%40googlegroups.com 
<https://groups.google.com/d/msgid/ansible-project/f963a9e3-56c8-4ebb-a3c7-8b7cbe5b812d%40googlegroups.com?utm_medium=email&utm_source=footer>.

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/09955b1e-dbe6-76f0-b44c-9586a880a204%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Need help

2018-10-28 Thread Frank Thommen
Consider, that with this mechanism you will not detect packages which 
have been installed directly either by custom installer, the standard 
configure-make-make install or by directly copying binaries or scripts 
in some central location.


Also keep in mind, that if you omit (or someone removes) an essential 
package (let's say "python" :-) from good_packages, you risk to 
completely screw up your systems.  I am normally extremely careful when 
it comes to /remove/ stuff through ansible.


Also because of that you should absolutely consider Michael's comment. 
Additionally you might consider to implement some inventory/monitoring 
which allows you to monitor software changes.


Cheers
frank


On 28/10/18 17:34, Jonathan Lozada De La Matta wrote:

I 2nd Michael's comment.

On Sun, Oct 28, 2018 at 11:37 AM Michael Mullay <mailto:mmul...@gmail.com>> wrote:


Hi Sathya,

You could get a list of current packages via 'yum list' or whatever
package manager, then use that as the list of packages as the
variable, and do something like the following. Maintaining and
parsing that 'master' list however might be quite cumbersome.

  name: remove unwanted packages
   package:
     name: "{{ item }}"
     state: absent
   when item not in good_packages

Of course the simpler and saner way would be to just restrict people
from installing packages in the first place. ;)


On Sat, Oct 27, 2018 at 10:44 AM Sathya Narayanan
mailto:mycer...@gmail.com>> wrote:

Hi All,

I am new to ansible and I would like to understand or get some
ideas about how to use ansible to maintain standard operating
system environment.

For example :  I would like to have ansible to check all my
existing OS (Amazon Linux) to see if there are any additional
package installed.

The idea is to have a list of rpm names as standard packages,
and ansible should monitor if all my systems are having only the
list of approved rpms. In case of any extra rpms installed by
any of the engineer, then ansible should automatically remove it.

Not sure, if I have explained my ask clear, but the idea is to
have ansible maintain software inventory (approved software) and
any unauthorized software installed, then it should notify via
email and remove that software.

Regards,
Sathya.R

-- 
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
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To post to this group, send email to
ansible-project@googlegroups.com
<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/ansible-project/CACqv84jQ%2BpHqRtk4fAoCvyhey-o6cRgugv0uOWnNn4Odf%2BgEDA%40mail.gmail.com

<https://groups.google.com/d/msgid/ansible-project/CACqv84jQ%2BpHqRtk4fAoCvyhey-o6cRgugv0uOWnNn4Odf%2BgEDA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
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
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To post to this group, send email to
ansible-project@googlegroups.com
<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/ansible-project/CAH4rTPtxobZgb%3DiD4qGpfvQJg17d1Z5EeZD41_Ry6pz%2BVwLkJA%40mail.gmail.com

<https://groups.google.com/d/msgid/ansible-project/CAH4rTPtxobZgb%3DiD4qGpfvQJg17d1Z5EeZD41_Ry6pz%2BVwLkJA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.



--

Jonathan lozada de la matta

AUTOMATION PRACTICE






--
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 
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To post to this group, send email to ansible-project@googlegroups.com 
<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BLrTbWvnJiBt71FduuK1A24NAo0a6gfdH1cq%3D04YHsvBQ%40mail.gmail.com 
<https

Re: [ansible-project] Get IP address, replace first three octets

2018-10-21 Thread Frank Thommen

On 10/21/2018 10:16 AM, Kai Stian Olstad wrote:

On Sunday, 21 October 2018 06:09:38 CEST LJMedina wrote:

Hello!
Unfortunately, we are using version 2.4, don't think upgrading is an option
(at least at this point) any other ideas ?


What are the part that you struggle with?
For the IP you can do something like this

  - debug: msg="11.11.11.{{ ansible_default_ipv4.address.split('.').3 }}"


sorry, dummy question: But where does the "split" come from?  It's not a 
YAML statement, its not a standard Jinja2 filter and its not one of the 
special ansible Jinja2 filters.  I'm confused.


frank



--
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/c4841f44-56fa-bca8-5680-570d9e1fd37f%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ios_config using before to set interface range on Cisco switch

2018-09-14 Thread Frank Clatterbaugh
When trying to use the before command to set an interface range on a Cisco 
switch it errors if I have more than one range. Both of these commands work 
fine from CLI.
Example:

Worksbefore: interface range twoGigabitEthernet 1/0/1-36
Doesn't work before: interface range twoGigabitEthernet 1/0/1-36, 
TenGigabitEthernet 1/0/39-48
 Error is:

 fatal: [LIN-WLFG-9300-FM-01]: FAILED! => changed=false
  module_stderr: |-
Traceback (most recent call last):
  File "/tmp/ansible_0V2RB4/ansible_module_ios_config.py", line 561, in 

main()
  File "/tmp/ansible_0V2RB4/ansible_module_ios_config.py", line 490, in 
main
load_config(module, commands)
  File 
"/tmp/ansible_0V2RB4/ansible_modlib.zip/ansible/module_utils/network/ios/ios.py",
 
line 168, in load_config
  File 
"/tmp/ansible_0V2RB4/ansible_modlib.zip/ansible/module_utils/connection.py", 
line 149, in __rpc__
ansible.module_utils.connection.ConnectionError:  TenGigabitEthernet 
1/0/39-48
   ^
% Invalid input detected at '^' marker.

Switch(config-if-range)#
  module_stdout: ''
  msg: MODULE FAILURE
  rc: 1

I'm not sure if this is a bug or a limitation. Does anyone have any insight?

-- 
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/63ed22e6-c126-41f5-9578-5f4753a31b79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tags not propagated to dynamically included tasks: Workaround?

2018-08-24 Thread Frank Thommen

Thanks a lot Kai,

On 08/24/2018 04:31 PM, Kai Stian Olstad wrote:

On Friday, 24 August 2018 15.47.39 CEST Frank Thommen wrote:

since "recently" (we realized just now), tags applied in role's main.yml
task, like:

/role/myrole/tasks/main.yml:

- name: My Task
include_tasks: "mytask.{{ansible_osfamily}}.yml"
tags:
  - mytask-only
  - always

are not propagated to the included task any more.






However this is a major pain for us: We are extensively using unified,
role-spanning[*] tags on the level of the the main tasks to be able to
selectively roll out our configurations.  The new behaviour means, that
we have to manually add hundreds(!) of "tag" statements to each
individual task in all the included taskfiles.


You don't need to add it to every task, you can use a block: around them all 
and set the tag on the block.

You can also wrap the include_tasks in a block, and set the tags on the block.

   - block:
 - name: My Task
   include_tasks: "mytask.{{ansible_osfamily}}.yml"
 tags:
   - mytask-only
   - always


Very nice solution.  I myself experimendet with a construction like:

- name: "My Task"
  block:
- import_tasks: mytask.RedHat.yml
  when: distro == "RedHat"
- import_tasks: mytask.CentOS.yml
  when: distro == "CentOS"
- import_tasks: mytask.Suse.yml
  when: distro == "Suse"
- import_tasks: mytask.Debian.yml
  when: distro == "Debian"
  tags:
- mytask-only

which makes for bad reading and bad maintainability.  Your idea with the 
block is elegant and well maintainable while keeping all the dynamic and 
flexibility.


I realize blocks are more versatile than I thought ;-)

f.



Is there a way to achieve the former behaviour (tag inheritance to
dynamic includes) other than framing each task.yml with a block, which
introduces redundancy and error-proneness?


Only the workaround mention above, but you can always downgrade.
There are some discussion don't remember if it was in an issue or on this list 
about a option or something like that to tell if it should propagate or not.





--
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/b16843c0-2a9b-318f-57c0-2c46ac009146%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Tags not propagated to dynamically included tasks: Workaround?

2018-08-24 Thread Frank Thommen

Dear all,

since "recently" (we realized just now), tags applied in role's main.yml 
task, like:


/role/myrole/tasks/main.yml:

- name: My Task
  include_tasks: "mytask.{{ansible_osfamily}}.yml"
  tags:
- mytask-only
- always

are not propagated to the included task any more.  It still works fine 
for statically included tasks.  This seems to be the the now documented 
way of attribute inheritance since ansible 2.5 and it probably came to 
us with a recent `yum upgrade` which updated ansible from 2.4 to 2.6 in 
one big step.


However this is a major pain for us: We are extensively using unified, 
role-spanning[*] tags on the level of the the main tasks to be able to 
selectively roll out our configurations.  The new behaviour means, that 
we have to manually add hundreds(!) of "tag" statements to each 
individual task in all the included taskfiles.


Is there a way to achieve the former behaviour (tag inheritance to 
dynamic includes) other than framing each task.yml with a block, which 
introduces redundancy and error-proneness?



Personally I find this new behaviour suboptimal regarding maintenance, 
intuitive understanding of playbooks and scalability.  All things, that 
I appreciated with ansible so far.


Cheers
frank



[*] i.e. we have e.g. the same tag "sysconfig" applied to an included 
taskfile for the role "common" and for the role "hw-server" and for the 
role "webserver", allowing us to run the complete system configuration 
with --tags=sysconfig



--
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/6bab2473-402c-2f95-7f8b-494ba78731eb%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to use host ranges with `ansible-playbook --limit`?

2018-01-03 Thread Frank Thommen

On 04/01/18 07:11, Kai Stian Olstad wrote:

On 03.01.2018 18:03, Frank Thommen wrote:

I assumed, that host ranges could be used with ansible-playbook's
--limit as they can be used in the inventory itself.  However this
doesn't seem to be possible:


It's called patterns
http://docs.ansible.com/ansible/latest/intro_patterns.html



$ ansible-playbook site.yml --limit='host[010:027]'


According to the documentation this is the syntax to get index 10 to 27 
from group named host.


I see.  It seems a bad idea to implement the seemingly identical syntax 
for two things with completely different meaning: A range in the 
inventory and indexes elsewhere




 [WARNING]: Could not match supplied host pattern, ignoring: host

ERROR! Specified --limit does not match any hosts
$

All hosts host010 - host027 are listed in the inventory.

The same happens with double quotes and witout quotes around the limit 
pattern.


How can I use host ranges witn --limit?


I think you best option is to switch to regex, and that can be done with 
tilde


  ansible-playbook site.yml --limit='~host0(1[0-9]|2[0-7])'


I hoped to avoid that.  regexes tend to become quite complex and 
unreadable very quickly.  The usecase in the post is a very simplified 
breakdown of the "real" term we need. But I'll give it a try anyway. :-)


Thanks
frank


--
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/ca472a75-0971-80aa-94e5-d68114ddff16%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to use host ranges with `ansible-playbook --limit`?

2018-01-03 Thread Frank Thommen

Hi,

I assumed, that host ranges could be used with ansible-playbook's 
--limit as they can be used in the inventory itself.  However this 
doesn't seem to be possible:



$ ansible-playbook site.yml --limit='host[010:027]'

 [WARNING]: Could not match supplied host pattern, ignoring: host

ERROR! Specified --limit does not match any hosts
$

All hosts host010 - host027 are listed in the inventory.

The same happens with double quotes and witout quotes around the limit 
pattern.


How can I use host ranges witn --limit?

Cheers
frank


--
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/93d54018-2093-651e-3881-5ae3730c5c16%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] deploy_helper and parallel execution

2017-12-21 Thread Frank Thilo Röhl
Hi,

im using an instance of deploy helper. This creates a subdirectory with a 
timestamp and then creates a link to this subdirectory.

I have seen cases where this link is created to a target which does not 
exists - only when I execute a script executing to two servers in parallel. 
It seems like there is no link per server but just one variable.

The obvious solution whould be to execute the scripts in serial format.

Is there another way I could use deploy_helper with two servers in parallel 
? I would like to set the timestamp just once for both servers - that would 
solve my issue.


ansible 2.2.0 (devel ff52e01a11) last updated 2016/09/19 09:30:50 (GMT +000)


Thilo

-- 
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/41754c5b-9be6-409c-a08a-3b334f0060ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: help with variables

2017-09-27 Thread Frank Dias
I an trying to get set_fact: resource_{{ item.item.key }}={{item.stdout}} 
to be the output of   "stdout": "0" meaning resource_{{ item.item.key }}= 
0, later in other task I am checking if value is 0 or 1

On Wednesday, September 27, 2017 at 9:36:42 PM UTC-5, Frank Dias wrote:
>
> Can I get your help in diagnosing why this is not working, I am getting 
> the error on task #3 Here are the three tasks; I am wantng to key off 
> of"stdout": "0",
>
> - name: Check if Redis Resources already exists
>
>   shell: "pcs resource | grep '{{ item.key }}' | grep Master | wc -l"
>
>   register: resource_exist
>
>   with_dict: "{{redis}}"
>
>   tags: [config_cluster, redis]
>
>  
>
> - name: Print results
>
>debug: msg="{{ resource_exist.results }}"
>
>tags: [config_cluster, redis]
>
>  
>
>  
>
> - name: Set facts about if resources already exists
>
>   set_fact: resource_{{ item.item.key }}={{item.stdout}}
>
>   with_items: resource_exist.results
>
>   tags: [config_cluster, redis]
>
>  
>
> here is the output;
>
>  
>
> TASK [postgres-ha : Check if Redis Resources already exists] 
> ***
>
> skipping: [sds02.prodea-int.net] => (item={'key': u'redis_array_1', 
> 'value': {u'bin': u'/opt/redis/bin/redis-server', u'clone_max': 3, 
> u'master_max': 1, u'wait_last_known_master': 0, u'loglevel': u'notice', 
> u'client_bin': u'/opt/redis/bin/redis-cli', u'vip_cidr_netmask': 24, 
> u'master_node_max': 1, u'save': [u'900 1', u'300 10', u'60 1'], 
> u'vip_nic': u'eth0', u'daemonize': u'yes', u'notify': True, u'user': 
> u'root', u'vip_ip': u'172.24.2.242', u'rundir': u'/var/run/redis', 
> u'logfile': None, u'port': 6379, u'clone_node_max': 1}})
>
> changed: [sds01.prodea-int.net] => (item={'key': u'redis_array_1', 
> 'value': {u'bin': u'/opt/redis/bin/redis-server', u'clone_max': 3, 
> u'master_max': 1, u'wait_last_known_master': 0, u'loglevel': u'notice', 
> u'client_bin': u'/opt/redis/bin/redis-cli', u'vip_cidr_netmask': 24, 
> u'master_node_max': 1, u'save': [u'900 1', u'300 10', u'60 1'], 
> u'vip_nic': u'eth0', u'daemonize': u'yes', u'notify': True, u'user': 
> u'root', u'vip_ip': u'172.24.2.242', u'rundir': u'/var/run/redis', 
> u'logfile': None, u'port': 6379, u'clone_node_max': 1}})
>
>  
>
> TASK [postgres-ha : Print results] 
> *
>
> ok: [sds01.prodea-int.net] => {
>
> "msg": [
>
> {
>
> "_ansible_item_result": true, 
>
> "_ansible_no_log": false, 
>
> "_ansible_parsed": true, 
>
> "changed": true, 
>
> "cmd": "pcs resource | grep 'redis_array_1' | grep Master | wc 
> -l", 
>
> "delta": "0:00:00.328159", 
>
> "end": "2017-09-26 17:25:25.591212", 
>
> "invocation": {
>
> "module_args": {
>
> "_raw_params": "pcs resource | grep 'redis_array_1' | 
> grep Master | wc -l", 
>
> "_uses_shell": true, 
>
> "chdir": null, 
>
> "creates": null, 
>
> "executable": null, 
>
> "removes": null, 
>
> "warn": true
>
> }
>
> }, 
>
> "item": {
>
> "key": "redis_array_1", 
>
> "value": {
>
> "bin": "/opt/redis/bin/redis-server", 
>
> "client_bin": "/opt/redis/bin/redis-cli", 
>
> 

[ansible-project] help with variables

2017-09-27 Thread Frank Dias


Can I get your help in diagnosing why this is not working, I am getting the 
error on task #3 Here are the three tasks; I am wantng to key off of
"stdout": 
"0",

- name: Check if Redis Resources already exists

  shell: "pcs resource | grep '{{ item.key }}' | grep Master | wc -l"

  register: resource_exist

  with_dict: "{{redis}}"

  tags: [config_cluster, redis]

 

- name: Print results

   debug: msg="{{ resource_exist.results }}"

   tags: [config_cluster, redis]

 

 

- name: Set facts about if resources already exists

  set_fact: resource_{{ item.item.key }}={{item.stdout}}

  with_items: resource_exist.results

  tags: [config_cluster, redis]

 

here is the output;

 

TASK [postgres-ha : Check if Redis Resources already exists] 
***

skipping: [sds02.prodea-int.net] => (item={'key': u'redis_array_1', 
'value': {u'bin': u'/opt/redis/bin/redis-server', u'clone_max': 3, 
u'master_max': 1, u'wait_last_known_master': 0, u'loglevel': u'notice', 
u'client_bin': u'/opt/redis/bin/redis-cli', u'vip_cidr_netmask': 24, 
u'master_node_max': 1, u'save': [u'900 1', u'300 10', u'60 1'], 
u'vip_nic': u'eth0', u'daemonize': u'yes', u'notify': True, u'user': 
u'root', u'vip_ip': u'172.24.2.242', u'rundir': u'/var/run/redis', 
u'logfile': None, u'port': 6379, u'clone_node_max': 1}})

changed: [sds01.prodea-int.net] => (item={'key': u'redis_array_1', 'value': 
{u'bin': u'/opt/redis/bin/redis-server', u'clone_max': 3, u'master_max': 1, 
u'wait_last_known_master': 0, u'loglevel': u'notice', u'client_bin': 
u'/opt/redis/bin/redis-cli', u'vip_cidr_netmask': 24, u'master_node_max': 
1, u'save': [u'900 1', u'300 10', u'60 1'], u'vip_nic': u'eth0', 
u'daemonize': u'yes', u'notify': True, u'user': u'root', u'vip_ip': 
u'172.24.2.242', u'rundir': u'/var/run/redis', u'logfile': None, u'port': 
6379, u'clone_node_max': 1}})

 

TASK [postgres-ha : Print results] 
*

ok: [sds01.prodea-int.net] => {

"msg": [

{

"_ansible_item_result": true, 

"_ansible_no_log": false, 

"_ansible_parsed": true, 

"changed": true, 

"cmd": "pcs resource | grep 'redis_array_1' | grep Master | wc 
-l", 

"delta": "0:00:00.328159", 

"end": "2017-09-26 17:25:25.591212", 

"invocation": {

"module_args": {

"_raw_params": "pcs resource | grep 'redis_array_1' | 
grep Master | wc -l", 

"_uses_shell": true, 

"chdir": null, 

"creates": null, 

"executable": null, 

"removes": null, 

"warn": true

}

}, 

"item": {

"key": "redis_array_1", 

"value": {

"bin": "/opt/redis/bin/redis-server", 

"client_bin": "/opt/redis/bin/redis-cli", 

"clone_max": 3, 

"clone_node_max": 1, 

"daemonize": "yes", 

"logfile": null, 

"loglevel": "notice", 

"master_max": 1, 

"master_node_max": 1, 

"notify": true, 

"port": 6379, 

"rundir": "/var/run/redis", 

"save": [

"900 1", 

"300 10", 

"60 1"

], 

"user": "root", 

"vip_cidr_netmask": 24, 

"vip_ip": "172.24.2.242", 

"vip_nic": "eth0", 

"wait_last_known_master": 0

}

}, 

"rc": 0, 

"start": "2017-09-26 17:25:25.263053", 

"stderr": "", 

"stderr_lines": [], 

"stdout": "0", 

"stdout_lines": [

"0"

]

}

]

}

skipping: [sds02.prodea-int.net]

 

TASK [postgres-ha : Set facts about if resources already exists] 
***

fatal: [sds01.prodea-int.net]: FAILED! => {"failed": true, "msg": "the 
field 'args' has an invalid value, which appears to include a variable that 
is undefined. The error was: 'ansible.vars.unsafe_proxy.AnsibleUnsafeText 
object' has no attribute 'stdout'\n\nThe error appears to have been in 
'/etc/ansible/roles/postgres-ha/tasks/redis_resources.yml': line 18, column 
3, but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\n\n- name: Set fatcs about 
if resources already exists\n  ^ here\n"}

fatal: [sds02.prodea-int.net]: FAILED! => {"failed": true, "msg": "the 
fie

[ansible-project] Re: issues with task not working

2017-08-27 Thread Frank Dias
I am work with 

https://github.com/YanChii/ansible-role-postgres-ha

if I use centos 7 minimal install, it works mostly a few bugs.

but if I try with centos6 minimal install , need to add libselinux-python 
to installation.
i am stuck with failures in the task postgresql_sync.yml 
<https://github.com/YanChii/ansible-role-postgres-ha/blob/master/tasks/postgresql_sync.yml>
 , 
from what I am seeing it installs the pkgs but does not execute task on 
host declared in  postgres_ha_cluster_master_host variable.

I would not think that there would be this much behavioral change in the 
role between OS version.

currently our env is centos6 and plans are not set for when to go to 
centos7 as of yet 

On Saturday, August 26, 2017 at 9:50:42 PM UTC-5, Frank Dias wrote:
>
> why does this not work?
>
> this is my play;
> - name: install PG HA
>   hosts: dbs6
>   gather_facts: True
>   any_errors_fatal: True
>   vars:
> postgres_ha_cluster_master_host: dbs03.prodea-int.net
> postgres_ha_cluster_vip: 172.24.2.241
> postgres_ha_pg_repl_pass: Pr0d3aDdbsRep
> postgres_ha_cluster_ha_password: Pr0d3aOps
> postgres_ha_cluster_ha_password_hash: 
> '$6$random_salt$oOZNTHqP.FhvKCx80X61rfbB3evBPVlnGYxcjJi82gNSLbJY3hNaMipUpNdVBGnFz1uy1UuwWZ0Mcmq/j04c2.'
>   pre_tasks:
> - name: disable firewall
>   service: name=iptables state=stopped enabled=no
>   roles:
>  - postgres-ha6
>
> in the role I have  several task that i want performed on specific host 
> and that host is define as variable 
>
> - name: init DB dir on master if necessary
>   shell: '{{ postgres_ha_pg_bindir }}/pg_ctl initdb'
>   become: yes
>   become_user: postgres
>   args:
> creates: "{{ postgres_ha_pg_data }}/PG_VERSION"
>   when: inventory_hostname == postgres_ha_cluster_master_host
> # run only on one node
>
>
>
>

-- 
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/301b9e66-ccae-4794-b2a3-b43975681050%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] issues with task not working

2017-08-26 Thread Frank Dias
why does this not work?

this is my play;
- name: install PG HA
  hosts: dbs6
  gather_facts: True
  any_errors_fatal: True
  vars:
postgres_ha_cluster_master_host: dbs03.prodea-int.net
postgres_ha_cluster_vip: 172.24.2.241
postgres_ha_pg_repl_pass: Pr0d3aDdbsRep
postgres_ha_cluster_ha_password: Pr0d3aOps
postgres_ha_cluster_ha_password_hash: 
'$6$random_salt$oOZNTHqP.FhvKCx80X61rfbB3evBPVlnGYxcjJi82gNSLbJY3hNaMipUpNdVBGnFz1uy1UuwWZ0Mcmq/j04c2.'
  pre_tasks:
- name: disable firewall
  service: name=iptables state=stopped enabled=no
  roles:
 - postgres-ha6

in the role I have  several task that i want performed on specific host and 
that host is define as variable 

- name: init DB dir on master if necessary
  shell: '{{ postgres_ha_pg_bindir }}/pg_ctl initdb'
  become: yes
  become_user: postgres
  args:
creates: "{{ postgres_ha_pg_data }}/PG_VERSION"
  when: inventory_hostname == postgres_ha_cluster_master_host
# run only on one node



-- 
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/f75a7af2-8180-4053-b477-5c40459b25e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] What exactly is the "action" module and how does it work?

2017-07-27 Thread Frank Thommen

Thanks a lot

On 07/27/2017 07:25 PM, Kai Stian Olstad wrote:

On 27. juli 2017 18:42, Frank Thommen wrote:

Hi,

I was looking for a way to run the distro-dependent package manager
w/o too many "when"s and I found this (on
https://ansible-tips-and-tricks.readthedocs.io/en/latest/os-dependent-tasks/installing_packages/#installing-packages):


- name: install basic package
   action: >
 {{ ansible_pkg_mgr }} name=vim state=present update_cache=yes

However I cannot find this "action" module mentioned anywhere in the
whole Ansible documentation


https://docs.ansible.com/ansible/latest/playbooks_intro.html#tasks-list
https://docs.ansible.com/ansible/latest/playbooks_intro.html#action-shorthand


Shame on me. I overlooked it in the very basic intro page... :-}




In short, it's an old syntax not encourage used anymore.



and I also don't understand, why the ">" is needed at that point.


It's an yaml indicator character, ">" indicate that the lines can be
broken to multiple lines.


Yes, that I know that, but I just don't understand, why

- name: install basic package
   action: {{ ansible_pkg_mgr }} name=vim state=present update_cache=yes

or

- name: install basic package
   action: "{{ ansible_pkg_mgr }}" name=vim state=present update_cache=yes

Wouldn't work (both fail with YAML syntax error)




 Is this an obsolete feature or a very new one, which is not
documented yet?  What exactly can one do with it?


I think you need to use action if the module name is a variable as in
you example.
I think these two examples would fail.

  - name: install basic package
{{ ansible_pkg_mgr }}: name=vim state=present update_cache=yes

and

  - name: install basic package
{{ ansible_pkg_mgr }}:
  name: vim
  state: present
  update_cache: yes


Indeed they fail, and there doesn't seem to be a useable replacement in 
the current syntax. :-(


frank


--
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/e5329e7d-47dd-639f-94fa-a7f8454f47d8%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] What exactly is the "action" module and how does it work?

2017-07-27 Thread Frank Thommen

Hi,

I was looking for a way to run the distro-dependent package manager w/o 
too many "when"s and I found this (on 
https://ansible-tips-and-tricks.readthedocs.io/en/latest/os-dependent-tasks/installing_packages/#installing-packages):


- name: install basic package
  action: >
{{ ansible_pkg_mgr }} name=vim state=present update_cache=yes

However I cannot find this "action" module mentioned anywhere in the 
whole Ansible documentation and I also don't understand, why the ">" is 
needed at that point.  Is this an obsolete feature or a very new one, 
which is not documented yet?  What exactly can one do with it?


Cheers
frank


--
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/de4b9065-5145-c32f-24a3-e748b4dc2559%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to *not* print ansible diagnostic error messages?

2017-07-21 Thread Frank Thommen

Hi

On 07/21/2017 05:17 PM, Branko Majic wrote:

On Fri, 21 Jul 2017 16:34:53 +0200
Frank Thommen  wrote:


Hi,

I have a playbook which executes a local task from which I need the
exit status in later steps:


   - name: Get exit status of ./run.sh
 local_action:  command ./run.sh
 register:  ES
 ignore_errors: yes

   - name: Do something if ./run.sh failed
 command:
  
 when: ES.rc == 1


Unfortunately when "./run.sh" fails, ansible prints a whole bunch of
diagnostic output to the screen, which I am not interested in.

How can I tell ansible *not* to print diagnostic error output of a
specific step?

We are running ansible 2.3.0 0 on CentOS 7

Cheers
frank


You could use "failed_when: False" on the task. Although, keep in mind
that would make the task treated as successful for all other purposes
(e.g. ES.failed would be set to False).

Best regards



This is perfect!  Thanks a lot.  Since I'm only interested in ES.rc and 
not in ES.failed, this is exactly what I was looking for.


Cheers
frank


--
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/1c628ede-83b2-12e3-5b8b-9c4f0d26cd2d%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to *not* print ansible diagnostic error messages?

2017-07-21 Thread Frank Thommen

Hi,

I have a playbook which executes a local task from which I need the exit 
status in later steps:



  - name: Get exit status of ./run.sh
local_action:  command ./run.sh
register:  ES
ignore_errors: yes

  - name: Do something if ./run.sh failed
command:
 
when: ES.rc == 1


Unfortunately when "./run.sh" fails, ansible prints a whole bunch of 
diagnostic output to the screen, which I am not interested in.


How can I tell ansible *not* to print diagnostic error output of a 
specific step?


We are running ansible 2.3.0 0 on CentOS 7

Cheers
frank


--
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/ce37e30a-aea4-8239-bc84-878917b6b15a%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Looking for Ansible tower REST specifications (xml files)

2017-07-17 Thread frank vene
Hello everyone,

In the context of our project, we would like to interface with as many 
automation tools as possible.
To do so, we have decided to generate Gateways from REST APIs.
Would you mind sharing the sml specifications of the Ansible tower REST API 
?

Many thanks in advance
Best Regards
Frank

-- 
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/42c1e1d3-cda8-49a3-ada2-1887dc232370%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Create different users on different hosts

2017-07-13 Thread Frank
Hi,

I've got various servers to manage which belong to different departments. 
Also one server could belong to multiple departments.
I would like to create the admin users on all servers, and additional users 
depending on the departments that the server belongs to (like development).
All of this by looping over group_var files which contain the user 
information.

Simplified example:

inventory file:
file "hosts":
[servers]
srv1
srv2

[dep1]
srv2

[dep2]
srv2

group_vars:
file "all":
users:
  admin1:
comment: "Admin user 1"

file "dep1":
users:
  dep1:
comment: "Department1 user"

file "dep2":
users:
  dep2:
comment: "Department2  user"

task:
file "users.yml":
- name: Create users
  user:
name: "{{item.key}}"
comment: "{{item.value.comment}}"
  with_dict: "{{ users }}"


So "srv2" belongs to groups "all", "dep1" and "dep2", hence the users 
"admin1", "dep1" and "dep2" should be created on "srv2"
But only user "dep2" will be created, because this is the last file through 
which ansible is looping in alphabetical order.
If I would rename the file "dep1" to "ZZZdep1" this would be the last file, 
and user "dep1" would be created.

I can't find a way to achieve this, any help appreciated.

Cheers,
Frank

-- 
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/a7466699-7e80-4c1d-8a4d-90fd611e914e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Gathering facts in roles: Is it done multiple times?

2017-06-21 Thread Frank Thommen

On 06/21/2017 11:01 AM, jean-y...@lenhof.eu.org wrote:

Hi Frank,

21 juin 2017 10:29 "Frank Thommen"  a écrit:


Hi,

from ansible's documentation I don't understand how ansible handles fact 
gathering when using
roles: Are a host's facts gathered at each single playbook run? Or at each 
"role" run? Or only
once?

In most cases one would want to gather facts only once in the beginning, but is 
this the case
and/or how can I check this?


This is at playbook level, not at role level


I.e. for a playbook roles/common/tasks/main.yml which is

---
- include: tasks_1.yml
- include: tasks_2.yml

fact gathering would only happen once or once per *.yml (I'm not 
completely sure which is the playbook and which the task in this setup, 
sorry)



For me the gathering fact happens each time a new block of hosts/tasks in the 
playbook
You can control it by using gather_facts: no to skip it.


The concrete example is more complicated, since some include are only 
done on special conditions.  Therefore I cannot really know from the 
beginning, which tasks are run and which not.  Consequently I wouldn't 
know where to gather and where not.


frank


--
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/805a8b57-beca-c669-f0df-7ab306e0ec72%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Gathering facts in roles: Is it done multiple times?

2017-06-21 Thread Frank Thommen

Hi,

from ansible's documentation I don't understand how ansible handles fact 
gathering when using roles:  Are a host's facts gathered at each single 
playbook run?  Or at each "role" run?  Or only once?


In most cases one would want to gather facts only once in the beginning, 
but is this the case and/or how can I check this?


frank


--
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/ba8d7a79-628f-c505-15aa-385cb8e9a8f3%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Can one add items to a list within(!) the inventory?

2017-06-16 Thread Frank Thommen

Hi,

is it possible to expand a list variable within the inventory?  E.g. I 
have a list of users which should be allowed on all hosts but on /some/ 
hosts, additional users should be allowed.  I want to define this in the 
inventory:


So far I so:


[all]
users=['user1', 'user2']

[servers]
host1
host2 users=['user1', 'user2', 'user3']
host3
---

But this is redundant and inflexible.  I'd prefer something like


[all]
users=['user1', 'user2']


host1
host2 users=users + ['user3']
host3
---

I've tried several variants to no avail.

  users = users + ['user3']
  users = [users, 'user3']
  users = [{{users}}, 'user3']


Is such a lsit expansion possible?

Cheers
frank


--
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/94cdbc5d-8f76-36d8-ba9a-3271b1d9ad7b%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to filter dictionary entries using Jinja

2017-04-28 Thread Frank Thommen

On 04/27/2017 12:40 PM, Kai Stian Olstad wrote:

On 26.04.2017 16:20, Frank Thommen wrote:

What I'd need is a syntax, which checks for each mount in the
dictionary, if one of it's (possibly multiple) classes matches the
(single) class of the server and then applies the mount.  I could not
find a usable Jinja-Syntax which I could use together with `when`.
I'd appreciate any hint or pointer to achieve this task.


when: class in item.value.class



Wow, so simple?  :-) Thanks a lot.
frank

--
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/753a22f6-e61a-8456-0edf-b15229a5c92a%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to filter dictionary entries using Jinja

2017-04-28 Thread Frank Thommen
I haven't used roles yet.  If a host can assume several roles, then this 
could work.  Otherwise I'll have to deal with redundant dictionaries, 
which is exactly what I want to avoid.


Thanks for the hint

frank



On 04/27/2017 09:17 AM, Dick Davies wrote:

If each mount was managed by a role, you could just apply those
roles to the (groups holding) the relevant servers.

You'll need to have multiple data structures, one per role, but that's
probably going to 'work with the grain' of Ansible better.



On 26 April 2017 at 15:20, Frank Thommen  wrote:

Dear all,

I'm at a loss as to how to filter entries fom a dictionry based von specific
host variables.  In the concrete case we have a long list of possible NFS
mounts which should be applied according to the hosts' class.


Our hostlist would be like:

host1 class=cluster
host2 class=cluster
host3 class=server


our dictionary of possible mounts would e.g. be:

---
/mnt/1:
  name:   /mnt/1
  src:server:/exports/1
  fstype: nfs
  state:  mounted
  class:
- cluster

/mnt/2:
  name:   /mnt/2
  src:server:/exports/2
  fstype: nfs
  state:  mounted
  class:
- cluster
- server

/mnt/3:
  name:   /mnt/3
  src:server:/exports/3
  fstype: nfs
  state:  mounted
  class:
- cluster
...


I.e I'd like all three mounts to be available on hosts of the class
"cluster" and /mnt/2 (but not the other two mounts) on hosts of the class
"server".

The current playbook (which applies all mounts to all hosts) is

---
- hosts: '{{ target }}'
  gather_facts: no
  serial: 5

  tasks:
   - include_vars:
   file: ./mounts-dict.yml
   name: fs

   - name: "Add NFS mounts"
 mount:
  name:   "{{ item.value.name   }}"
  fstype: "{{ item.value.fstype }}"
  src:"{{ item.value.src}}"
  state:  "{{ item.value.state  }}"
 with_dict: "{{ fs }}"
...


The playbook is run with `ansible-playbook ./nfs-mounts.yml
--extra-vars="target=".

What I'd need is a syntax, which checks for each mount in the dictionary, if
one of it's (possibly multiple) classes matches the (single) class of the
server and then applies the mount.  I could not find a usable Jinja-Syntax
which I could use together with `when`.  I'd appreciate any hint or pointer
to achieve this task.

Thanks
frank


--
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/a0fbe52c-a1bc-f33e-985e-216dac495630%40drosera.ch.
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/b36f86d1-6b80-766e-5669-0e3b1f0079bb%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to filter dictionary entries using Jinja

2017-04-26 Thread Frank Thommen

Dear all,

I'm at a loss as to how to filter entries fom a dictionry based von 
specific host variables.  In the concrete case we have a long list of 
possible NFS mounts which should be applied according to the hosts' class.



Our hostlist would be like:

host1 class=cluster
host2 class=cluster
host3 class=server


our dictionary of possible mounts would e.g. be:

---
/mnt/1:
  name:   /mnt/1
  src:server:/exports/1
  fstype: nfs
  state:  mounted
  class:
- cluster

/mnt/2:
  name:   /mnt/2
  src:server:/exports/2
  fstype: nfs
  state:  mounted
  class:
- cluster
- server

/mnt/3:
  name:   /mnt/3
  src:server:/exports/3
  fstype: nfs
  state:  mounted
  class:
- cluster
...


I.e I'd like all three mounts to be available on hosts of the class 
"cluster" and /mnt/2 (but not the other two mounts) on hosts of the 
class "server".


The current playbook (which applies all mounts to all hosts) is

---
- hosts: '{{ target }}'
  gather_facts: no
  serial: 5

  tasks:
   - include_vars:
   file: ./mounts-dict.yml
   name: fs

   - name: "Add NFS mounts"
 mount:
  name:   "{{ item.value.name   }}"
  fstype: "{{ item.value.fstype }}"
  src:"{{ item.value.src}}"
  state:  "{{ item.value.state  }}"
 with_dict: "{{ fs }}"
...


The playbook is run with `ansible-playbook ./nfs-mounts.yml 
--extra-vars="target=".


What I'd need is a syntax, which checks for each mount in the 
dictionary, if one of it's (possibly multiple) classes matches the 
(single) class of the server and then applies the mount.  I could not 
find a usable Jinja-Syntax which I could use together with `when`.  I'd 
appreciate any hint or pointer to achieve this task.


Thanks
frank


--
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/a0fbe52c-a1bc-f33e-985e-216dac495630%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Azure: no action detected in task

2017-03-11 Thread Frank Montyne
I installed the Azure Python SDK 2.0.0rc5 using pip and ansible 2.0.0.2 
using apt on a Ubuntu 16.04 machine. I also created a Azure AD service 
principle and added the information to ~/.azure/credentials. When I try to 
run a playbook that uses one of the Azure rm module I always get the same 
error. 

For example when I run the following playbook :
===
- name: Test playbook
  hosts: localhost
  connection: local
  gather_facts: False
  tasks:
  - name: GetFacts
azure_rm_virtualnetwork_facts:
  subscription_id: --1-
  resource_group: ansible-test
===

*ansible-playbook test.yml*
ERROR! no action detected in task

The error appears to have been in '/data/ansible/playbooks/tests/test.yml': 
line 6, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
  - name: GetFacts
^ here

I have no idea why I get this error, all help is greatly appreciated!

Frank Montyne

-- 
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/acf76762-d1c6-49ca-bcda-2a5c53a1ca4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible for Windows

2017-02-23 Thread Frank Mehlhop
Hi,

I work with Windows.
I would like to use Vagrant on with gitolite my machine and therefore I 
need Ansible.
Is it a piece of Software to download and install?
Where do I get it?
Or how do I get Ansible on my machine?

Would be lovely to get help!
Frank

-- 
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/6c231430-02a1-48fa-8f8c-03094807b569%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Security Mechanisms

2016-12-08 Thread Frank Albert
Hello Experts,

I am using ansible to configure my windows servers with powershell 
playbooks. Ansible servers communicates with the endpoints using WinRM 
Connections.

I fear that if in any case the ansible server gets compromised the attacker 
can modify the playbooks and execute the malicious code on all my endpoint 
windows 
Servers.

Any ideas of securing the Ansible's infrastructure.

Thanks

Frank


-- 
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/044255e1-84c6-4a4b-8709-b9e8705008ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Question: how to use variable in with_sequence, casting to int results in zero value

2016-12-08 Thread frank
Hi Kai,

Thanks for your reaction.

I think item.path won't work because of the structure of result.files. 
result.files contains a list  [..path..], [.path..]  ,So in the debug var i 
should reference item[0].path , item[1].path

I worked my way around creating a list

# create a list of policies to be defined
- name: create list of files
  debug:
msg: "{{ result.files | map(attribute='path') | list }}"
  register: fileList


Op donderdag 1 december 2016 20:02:44 UTC+1 schreef Kai Stian Olstad:
>
> On 30. nov. 2016 09:52, fr...@tom.nl  wrote: 
> > I am trying to process the result from the find module. The result 
> contains 
> > 3 file paths which i would  like to process in a loop. 
> > The number of files depends on the number of files found in the 
> directories 
> > and is set by result.matched 
> > 
> > Using the with_sequence loop should do the trick, i think. But i ran 
> into a 
> > problem. 
> > 
> > with_sequence: start=0 end={{ variable }}, expects {{ variable }} to be 
> an 
> > integer. Casting {{ variable | int}} results in a zero value, which 
> should 
> > be 3. 
> > 
> > Any suggestions how to solve or work around my issue? 
>
> Why not use with_items? 
>
>
> > After casting the variable correctly to an integer, off course i still 
> have 
> > to subtract 1 to set the correct index value for the results array. 
> > 
> > *Variables*: 
> > 
> > file_path: "roles/ansible-role-iamGroups/files" 
> > template_path: "roles/ansible-role-iamGroups/templates" 
> > 
> > declared_int: 3 
> > 
> > *Tasks*: 
> > 
> > - name: find files 
> >   find: 
> > recurse: yes 
> > patterns: "*.json" 
> > paths: 
> > 
> "/home/user/PycharmProjects/playbook-aws-billing/roles/ansible-role-iamGroups/templates/"
>  
>
> >   register: result 
> > 
> > - name: register numbers variable 
> >   shell: "echo {{result.matched}}" 
> >   register: number 
> > 
> > - name: list number variable (==> string value 3) 
> >   debug: var=number 
> > 
> > - name: list result hard coded (works) 
> >   debug: "var=result.files[{{item}}].path" 
> >   with_sequence: "start=0 end=2 stride=1" 
>
> - name: list result 
>debug: var=item.path 
>with_items: result.files 
>
>
> -- 
> 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/fcbb0993-9581-47e3-871a-00f310177261%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] with_items and register in a role/main.yml

2016-12-01 Thread frank
r is avariable after registering.
So i think you sgould use "{{ r }}" 

-- 
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/15519ca6-11eb-4efd-9fdc-6f3c3f5b3bf0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Question: how to use variable in with_sequence, casting to int results in zero value

2016-12-01 Thread frank
I am trying to process the result from the find module. The result contains 
3 file paths which i would  like to process in a loop. 
The number of files depends on the number of files found in the directories 
and is set by result.matched

Using the with_sequence loop should do the trick, i think. But i ran into a 
problem.

with_sequence: start=0 end={{ variable }}, expects {{ variable }} to be an 
integer. Casting {{ variable | int}} results in a zero value, which should 
be 3.

Any suggestions how to solve or work around my issue?

After casting the variable correctly to an integer, off course i still have 
to subtract 1 to set the correct index value for the results array.

*Variables*:

file_path: "roles/ansible-role-iamGroups/files"
template_path: "roles/ansible-role-iamGroups/templates"

declared_int: 3 

*Tasks*:

- name: find files
  find:
recurse: yes
patterns: "*.json"
paths: 
"/home/user/PycharmProjects/playbook-aws-billing/roles/ansible-role-iamGroups/templates/"
  register: result

- name: register numbers variable
  shell: "echo {{result.matched}}"
  register: number

- name: list number variable (==> string value 3)
  debug: var=number

- name: list result hard coded (works)
  debug: "var=result.files[{{item}}].path"
  with_sequence: "start=0 end=2 stride=1"

- name: list result with variable casted to integer (number is casted to 0, 
should be 3 )
  debug: "var=result.files[{{item}}].path"
  with_sequence: "start=0 end={{ number | int }} stride=1"

- name: list result with  declared integer variable minus 1 (works)
  debug: "var=result.files[{{item}}].path"
  with_sequence: "start=0 end={{ declared_int - 1 }} stride=1"

- name: list result without casting variable number ( results in parsing 
error)
  debug: "var=result.files[{{item}}].path"
  with_sequence: "start=0 end={{ number }} stride=1"

*Output*:

ok: [aws] => {
"changed": false, 
"examined": 25, 
"files": [
{
"atime": 1480345980.447014, 
"ctime": 1480345980.451014, 
"dev": 2049, 
"gid": 1000, 
"inode": 523227, 
"isblk": false, 
"ischr": false, 
"isdir": false, 
"isfifo": false, 
"isgid": false, 
"islnk": false, 
"isreg": true, 
"issock": false, 
"isuid": false, 
"mode": "0644", 
"mtime": 1480345980.447014, 
"nlink": 1, 
"path": 
"/home/user/PycharmProjects/playbook-aws-billing/roles/ansible-role-iamGroups/templates/prod/ReadOnly/readOnly.json",
 
"rgrp": true, 
"roth": true, 
"rusr": true, 
"size": 1655, 
"uid": 1000, 
"wgrp": false, 
"woth": false, 
"wusr": true, 
"xgrp": false, 
"xoth": false, 
"xusr": false
}, 
{
"atime": 1480345980.523014, 
"ctime": 1480345980.527014, 
"dev": 2049, 
"gid": 1000, 
"inode": 523175, 
"isblk": false, 
"ischr": false, 
"isdir": false, 
"isfifo": false, 
"isgid": false, 
"islnk": false, 
"isreg": true, 
"issock": false, 
"isuid": false, 
"mode": "0644", 
"mtime": 1480345980.527014, 
"nlink": 1, 
"path": 
"/home/user/PycharmProjects/playbook-aws-billing/roles/ansible-role-iamGroups/templates/prod/PowerUser/iamAccess.json",
 
"rgrp": true, 
"roth": true, 
"rusr": true, 
"size": 136, 
"uid": 1000, 
"wgrp": false, 
"woth": false, 
"wusr": true, 
"xgrp": false, 
"xoth": false, 
"xusr": false
}, 
{
"atime": 1480345980.531014, 
"ctime": 1480345980.539014, 
"dev": 2049, 
"gid": 1000, 
"inode": 523226, 
"isblk": false, 
"ischr": false, 
"isdir": false, 
"isfifo": false, 
"isgid": false, 
"islnk": false, 
"isreg": true, 
"issock": false, 
"isuid": false, 
"mode": "0644", 
"mtime": 1480345980.531014, 
"nlink": 1, 
"path": 
"/home/user/PycharmProjects/playbook-aws-billing/roles/ansible-role-iamGroups/templates/prod/PowerUser/powerUser.json",
 
"rgrp": true, 
"roth": true, 
"rusr": true, 
"size": 138, 
"uid": 1000, 
"wgrp": false, 
"woth": false, 
"wusr": true, 
"xgrp": false, 
"xoth": false, 
"xusr": false
}
], 
"invocation": {
"module_args": {
"age": null, 
"age_stamp": "mtime

Re: [ansible-project] Module "include_vars" fails with when using "file" parameter

2016-08-24 Thread Frank Thommen

On 08/23/2016 03:38 PM, Frank Thommen wrote:

Hi,

when using the include_module with the "file" parameter, it fails with

  AttributeError: 'NoneType' object has no attribute 'startswith'.

[...]


Seems to have been fixed in the latest 2.2 release
f.


--
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/c4e04564-abef-08c8-742b-9f98db632f09%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Module "include_vars" fails with when using "file" parameter

2016-08-23 Thread Frank Thommen

Hi,

when using the include_module with the "file" parameter, it fails with

 AttributeError: 'NoneType' object has no attribute 'startswith'.


This works fine:

- testmyvars_1.yml ---
---
- hosts: '{{ target }}'
gather_facts: no
tasks:
 - include_vars: ./myvars_1.yml

 - name: "Test myvars.yml"
   debug: msg='Variable {{ item.key }} is named "{{ item.value.name 
}}" and has the value {{item.value.value}}'

   with_dict: "{{ var }}"
$
--


- myvars_1.yml ---
---
var:
A:
 name:  "Variable A"
 value: "aaa"

B:
 name:  "Variable B"
 value: "bbb"
...
--


$ ansible-playbook testmyvars_1.yml --extra-vars "target=MYHOST" \
  --ask-pass
SSH password:

PLAY [MYHOST] 

TASK [include_vars] 


ok: [MYHOST]

TASK [Test myvars.yml] 
*
ok: [MYHOST] => (item={'value': {u'name': u'Variable A', u'value': 
u'aaa'}, 'key': u'A'}) => {

  "item": {
  "key": "A",
  "value": {
  "name": "Variable A",
  "value": "aaa"
  }
  },
  "msg": "Variable A is named \"Variable A\" and has the value aaa"
}
ok: [MYHOST] => (item={'value': {u'name': u'Variable B', u'value': 
u'bbb'}, 'key': u'B'}) => {

  "item": {
  "key": "B",
  "value": {
  "name": "Variable B",
  "value": "bbb"
  }
  },
  "msg": "Variable B is named \"Variable B\" and has the value bbb"
}

PLAY RECAP 
*

MYHOST   : ok=2changed=0unreachable=0failed=0

$


But this one fails:

- testmyvars_2.yml ---
---
- hosts: '{{ target }}'
gather_facts: no
tasks:
 - include_vars: file="./myvars_1.yml"

 - name: "Test myvars.yml"
   debug: msg='Variable {{ item.key }} is named "{{ item.value.name 
}}" and has the value {{item.value.value}}'

   with_dict: "{{ var }}"
--


$ ansible-playbook -vvv testmyvars_2.yml\
 --extra-vars "target=MYHOST" \
 --ask-pass
Using /root/ansible-config/ansible.cfg as config file
SSH password:

PLAYBOOK: testmyvars_2.yml 
*

1 plays in testmyvars_2.yml

PLAY [MYHOST] 

TASK [include_vars] 


task path: /root/ansible-config/testmyvars_2.yml:5
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
File "/root/ansible/ansible/lib/ansible/executor/task_executor.py", 
line 124, in run

  res = self._execute()
File "/root/ansible/ansible/lib/ansible/executor/task_executor.py", 
line 447, in _execute

  result = self._handler.run(task_vars=variables)
File 
"/root/ansible/ansible/lib/ansible/plugins/action/include_vars.py", line 
41, in run
  source = 
self._loader.path_dwim_relative(self._loader.get_basedir(), 'vars', source)
File "/root/ansible/ansible/lib/ansible/parsing/dataloader.py", 
line 236, in path_dwim_relative

  if source.startswith('~') or source.startswith('/'):
AttributeError: 'NoneType' object has no attribute 'startswith'

fatal: [MYHOST]: FAILED! => {"failed": true, "msg": "Unexpected failure 
during module execution.", "stdout": ""}


NO MORE HOSTS LEFT 
*

  to retry, use: --limit @testmyvars_2.retry

PLAY RECAP 
*

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

$

I also tried to use the absolute path to myvars_1.yml to no avail.

I could of course use the free-form of include_vars, but I'd like to 
eventually get rid of the top level variable in ./myvars_1.yml and use 
the "name" parameter to assign the included variables to a specific name.


Ansible version: ansible-playbook 2.2.0 (devel 3afe50dfe2)
Platform: openSuSE 13.1

Is this my bug or ansible's?  If it's mine: Any idea how I can fix it?

Cheers
frank


--
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/bd508038-148f-6f9b-2205-e2046370d422%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Module "include_vars" fails with when using "file" parameter

2016-08-23 Thread Frank Thommen

Hi,

when using the include_module with the "file" parameter, it fails with

AttributeError: 'NoneType' object has no attribute 'startswith'.


This works fine:

- testmyvars_1.yml ---
---
- hosts: '{{ target }}'
   gather_facts: no
   tasks:
- include_vars: ./myvars_1.yml

- name: "Test myvars.yml"
  debug: msg='Variable {{ item.key }} is named "{{ item.value.name 
}}" and has the value {{item.value.value}}'

  with_dict: "{{ var }}"
$
--


- myvars_1.yml ---
---
var:
   A:
name:  "Variable A"
value: "aaa"

   B:
name:  "Variable B"
value: "bbb"
...
--


$ ansible-playbook testmyvars_1.yml --extra-vars "target=MYHOST" \
 --ask-pass
SSH password:

PLAY [MYHOST] 

TASK [include_vars] 


ok: [MYHOST]

TASK [Test myvars.yml] 
*
ok: [MYHOST] => (item={'value': {u'name': u'Variable A', u'value': 
u'aaa'}, 'key': u'A'}) => {

 "item": {
 "key": "A",
 "value": {
 "name": "Variable A",
 "value": "aaa"
 }
 },
 "msg": "Variable A is named \"Variable A\" and has the value aaa"
}
ok: [MYHOST] => (item={'value': {u'name': u'Variable B', u'value': 
u'bbb'}, 'key': u'B'}) => {

 "item": {
 "key": "B",
 "value": {
 "name": "Variable B",
 "value": "bbb"
 }
 },
 "msg": "Variable B is named \"Variable B\" and has the value bbb"
}

PLAY RECAP 
*

MYHOST   : ok=2changed=0unreachable=0failed=0

$


But this one fails:

- testmyvars_2.yml ---
---
- hosts: '{{ target }}'
   gather_facts: no
   tasks:
- include_vars: file="./myvars_1.yml"

- name: "Test myvars.yml"
  debug: msg='Variable {{ item.key }} is named "{{ item.value.name 
}}" and has the value {{item.value.value}}'

  with_dict: "{{ var }}"
--


$ ansible-playbook -vvv testmyvars_2.yml\
--extra-vars "target=MYHOST" \
--ask-pass
Using /root/ansible-config/ansible.cfg as config file
SSH password:

PLAYBOOK: testmyvars_2.yml 
*

1 plays in testmyvars_2.yml

PLAY [MYHOST] 

TASK [include_vars] 


task path: /root/ansible-config/testmyvars_2.yml:5
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
   File "/root/ansible/ansible/lib/ansible/executor/task_executor.py", 
line 124, in run

 res = self._execute()
   File "/root/ansible/ansible/lib/ansible/executor/task_executor.py", 
line 447, in _execute

 result = self._handler.run(task_vars=variables)
   File 
"/root/ansible/ansible/lib/ansible/plugins/action/include_vars.py", line 
41, in run
 source = 
self._loader.path_dwim_relative(self._loader.get_basedir(), 'vars', source)
   File "/root/ansible/ansible/lib/ansible/parsing/dataloader.py", line 
236, in path_dwim_relative

 if source.startswith('~') or source.startswith('/'):
AttributeError: 'NoneType' object has no attribute 'startswith'

fatal: [MYHOST]: FAILED! => {"failed": true, "msg": "Unexpected failure 
during module execution.", "stdout": ""}


NO MORE HOSTS LEFT 
*****

 to retry, use: --limit @testmyvars_2.retry

PLAY RECAP 
*

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

$

I also tried to use the absolute path to myvars_1.yml to no avail.

I could of course use the free-form of include_vars, but I'd like to 
eventually get rid of the top level variable in ./myvars_1.yml and use 
the "name" parameter to assign the included variables to a specific name.


Ansible version: ansible-playbook 2.2.0 (devel 3afe50dfe2)
Platform: openSuSE 13.1

Is this my bug or ansible's?  If it's mine: Any idea how I can fix it?

Cheers
frank


--
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/ab6422d9-6541-8089-d23f-407795a8de9d%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Module "include_vars" fails with when using "file" parameter

2016-08-23 Thread Frank Thommen

Hi,

when using the include_module with the "file" parameter, it fails with

  AttributeError: 'NoneType' object has no attribute 'startswith'.


This works fine:

- testmyvars_1.yml ---
---
- hosts: '{{ target }}'
 gather_facts: no
 tasks:
  - include_vars: ./myvars_1.yml

  - name: "Test myvars.yml"
debug: msg='Variable {{ item.key }} is named "{{ 
item.value.name }}" and has the value {{item.value.value}}'

with_dict: "{{ var }}"
$
--


- myvars_1.yml ---
---
var:
 A:
  name:  "Variable A"
  value: "aaa"

 B:
  name:  "Variable B"
  value: "bbb"
...
--


$ ansible-playbook testmyvars_1.yml --extra-vars "target=MYHOST" \
   --ask-pass
SSH password:

PLAY [MYHOST] 

TASK [include_vars] 


ok: [MYHOST]

TASK [Test myvars.yml] 
*
ok: [MYHOST] => (item={'value': {u'name': u'Variable A', u'value': 
u'aaa'}, 'key': u'A'}) => {

   "item": {
   "key": "A",
   "value": {
   "name": "Variable A",
   "value": "aaa"
   }
   },
   "msg": "Variable A is named \"Variable A\" and has the value aaa"
}
ok: [MYHOST] => (item={'value': {u'name': u'Variable B', u'value': 
u'bbb'}, 'key': u'B'}) => {

   "item": {
   "key": "B",
   "value": {
   "name": "Variable B",
   "value": "bbb"
   }
   },
   "msg": "Variable B is named \"Variable B\" and has the value bbb"
}

PLAY RECAP 
*

MYHOST   : ok=2changed=0unreachable=0failed=0

$


But this one fails:

- testmyvars_2.yml ---
---
- hosts: '{{ target }}'
 gather_facts: no
 tasks:
  - include_vars: file="./myvars_1.yml"

  - name: "Test myvars.yml"
debug: msg='Variable {{ item.key }} is named "{{ 
item.value.name }}" and has the value {{item.value.value}}'

with_dict: "{{ var }}"
--


$ ansible-playbook -vvv testmyvars_2.yml\
  --extra-vars "target=MYHOST" \
  --ask-pass
Using /root/ansible-config/ansible.cfg as config file
SSH password:

PLAYBOOK: testmyvars_2.yml 
*

1 plays in testmyvars_2.yml

PLAY [MYHOST] 

TASK [include_vars] 


task path: /root/ansible-config/testmyvars_2.yml:5
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
 File 
"/root/ansible/ansible/lib/ansible/executor/task_executor.py", line 124, 
in run

   res = self._execute()
 File 
"/root/ansible/ansible/lib/ansible/executor/task_executor.py", line 447, 
in _execute

   result = self._handler.run(task_vars=variables)
 File 
"/root/ansible/ansible/lib/ansible/plugins/action/include_vars.py", line 
41, in run
   source = 
self._loader.path_dwim_relative(self._loader.get_basedir(), 'vars', source)
 File "/root/ansible/ansible/lib/ansible/parsing/dataloader.py", 
line 236, in path_dwim_relative

   if source.startswith('~') or source.startswith('/'):
AttributeError: 'NoneType' object has no attribute 'startswith'

fatal: [MYHOST]: FAILED! => {"failed": true, "msg": "Unexpected failure 
during module execution.", "stdout": ""}


NO MORE HOSTS LEFT 
*****

   to retry, use: --limit @testmyvars_2.retry

PLAY RECAP 
*

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

$

I also tried to use the absolute path to myvars_1.yml to no avail.

I could of course use the free-form of include_vars, but I'd like to 
eventually get rid of the top level variable in ./myvars_1.yml and use 
the "name" parameter to assign the included variables to a specific name.


Ansible version: ansible-playbook 2.2.0 (devel 3afe50dfe2)
Platform: openSuSE 13.1

Is this my bug or ansible's?  If it's mine: Any idea how I can fix it?

Cheers
frank


--
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/b10fc5b1-166c-7213-ccd9-cd4f57b91438%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] playbooks hang forever when client is swapping or has (NFS) mount problems

2016-08-19 Thread Frank Thommen

On 08/19/2016 02:33 PM, Jean-Yves LENHOF wrote:


Le 19/08/2016 à 14:20, Frank Thommen a écrit :

On 08/19/2016 01:54 PM, Jean-Yves LENHOF wrote:




The first task ansible is doing is gathering facts In facts there
are mounted filesystems, so the NFS one too


[...]

However I found this feature to be quite hidden in the documentation.
IMHO gather_facts should be off by default and only on on request.


Hi,

No it is ok that's on by default and that should stay like this. A lot
of my playbooks (and from other people too) depends on facts
(|ansible_distribution,
||ansible_distribution_version, ||ansible_lsb.major_release, to name the
most currents one)|



I see it the same as with services, open ports, access permissions ecc. 
ecc.:  Minimum by default, more on request.  But of course, once the 
maximum has been established as default, a change can break established 
and working mechanisms.  Now it's probably too late to change this 
initial design decision.




|If you need, you can filter facts :
http://stackoverflow.com/questions/34485286/ansible-gathering-facts-with-filter-inside-a-playbook
But from my point of view, is NFS is not responding, it's your server
that is broken... Perhaps automouting (and so dismounting) NFS is an
option for you Regards, JYL


yes, there is a technical problem, but that's not the issue.  The issue 
is, that this shouldn't break my scripts.  When - very simplified - I 
run a script which does an `ls` in my homedirectory I don't want it to 
break (rather: it /must/ not break), just because some other, completely 
unrelated filesystem or service is not working.  But that's what was 
happening in our case until we disabled gather_facts.


Anyway: Our current problem is solved - thanks to your hint - and I will 
set "gathering = explicit" in the configuration file, which should also 
have the desired effect.



Cheers
frank





--
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/7c2bebb5-f3d7-2fe3-6bda-bbcdd5b7c896%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] playbooks hang forever when client is swapping or has (NFS) mount problems

2016-08-19 Thread Frank Thommen

On 08/19/2016 01:54 PM, Jean-Yves LENHOF wrote:

Le 19/08/2016 à 13:19, Frank Thommen a écrit :

Dear all,

doing my first steps with ansible I noticed, that on some clients
executing playbooks completely hangs.  The common problem on these
hosts is, that they are either swapping (even very small amounts of
swap used) or they have problems with hanging/not responding NFS
filesystems.  In all cases, these two problems appeared together.
Therefore I cannot say, which is the problematic issue.

However all local filesystems are perfectly ok and responding and
working.  The system over-all is also working fine.

Running even the simplest playbooks on these hosts hangs completely,
even though the playbooks don't access the problematic filesystems.
Running the same commands as ad-hoc commands, works fine:

$ ansible buggyhost -m shell -a '/bin/ls' --key=id_rsa
buggyhost | SUCCESS | rc=0 >>
[... `/bin/ls` output here..]

$

... but ...

$ ansible-playbook ls.yml --extra-vars "target=buggyhost"
--private-key=id_rsa

PLAY [buggyhost]
***

TASK [setup]
***
[...and here it hangs...]
^C
$

using -vvv doesn't really help:


$ ansible-playbook -vvv ls.yml --extra-vars "target=buggyhost"
--private-key=id_rsa
Using /root/ansible-config/ansible.cfg as config file

PLAYBOOK: ls.yml
***
1 plays in ls.yml

PLAY [buggyhost]
***

TASK [setup]
***
Using module file
/root/ansible/ansible/lib/ansible/modules/core/system/setup.py
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -q -C -o ControlMaster=auto -o
ControlPersist=60s -o StrictHostKeyChecking=no -o
'IdentityFile="id_rsa"' -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=10 -o
ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r buggyhost '/bin/sh
-c '"'"'( umask 77 && mkdir -p "` echo
$HOME/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534 `" && echo
ansible-tmp-1471604358.1-265208088531534="` echo
$HOME/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534 `" ) &&
sleep 0'"'"''
 PUT /tmp/tmp7cAXoN TO
/root/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534/setup.py
 SSH: EXEC sftp -b - -C -o ControlMaster=auto -o
ControlPersist=60s -o StrictHostKeyChecking=no -o
'IdentityFile="id_rsa"' -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=10 -o
ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r '[buggyhost]'
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -q -C -o ControlMaster=auto -o
ControlPersist=60s -o StrictHostKeyChecking=no -o
'IdentityFile="id_rsa"' -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=10 -o
ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r buggyhost '/bin/sh
-c '"'"'chmod -R u+x
/root/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534/ && sleep
0'"'"''
 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -q -C -o ControlMaster=auto -o
ControlPersist=60s -o StrictHostKeyChecking=no -o
'IdentityFile="id_rsa"' -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=10 -o
ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r -tt buggyhost
'/bin/sh -c '"'"'/usr/bin/python
/root/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534/setup.py;
rm -rf "/root/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534/"

/dev/null 2>&1 && sleep 0'"'"''

^C
$

The playbook being

$ cat ls.yml
---
- hosts: '{{ target }}'
  tasks:
  - name:Run ls
shell:  /bin/ls
$


I am using asible 2.2.0 (devel 3afe50dfe2).  Server and clients are
running openSuSE 13.1.

Any idea, why playbooks hang in this situation?

Cheers
frank


The first task ansible is doing is gathering facts In facts there
are mounted filesystems, so the NFS one too


Thanks a lot.  Using 'gather_facts: no' in the playbook solved this issue:

---
- hosts: '{{ target }}'
  gather_facts: no
  tasks:
  - name:Run ls
shell:  /bin/ls


However I found this feature to be quite hidden in the documentation. 
IMHO gather_

[ansible-project] playbooks hang forever when client is swapping or has (NFS) mount problems

2016-08-19 Thread Frank Thommen

Dear all,

doing my first steps with ansible I noticed, that on some clients 
executing playbooks completely hangs.  The common problem on these hosts 
is, that they are either swapping (even very small amounts of swap used) 
or they have problems with hanging/not responding NFS filesystems.  In 
all cases, these two problems appeared together.  Therefore I cannot 
say, which is the problematic issue.


However all local filesystems are perfectly ok and responding and 
working.  The system over-all is also working fine.


Running even the simplest playbooks on these hosts hangs completely, 
even though the playbooks don't access the problematic filesystems. 
Running the same commands as ad-hoc commands, works fine:


$ ansible buggyhost -m shell -a '/bin/ls' --key=id_rsa
buggyhost | SUCCESS | rc=0 >>
[... `/bin/ls` output here..]

$

... but ...

$ ansible-playbook ls.yml --extra-vars "target=buggyhost" 
--private-key=id_rsa


PLAY [buggyhost] 
***


TASK [setup] 
***

[...and here it hangs...]
^C
$

using -vvv doesn't really help:


$ ansible-playbook -vvv ls.yml --extra-vars "target=buggyhost" 
--private-key=id_rsa

Using /root/ansible-config/ansible.cfg as config file

PLAYBOOK: ls.yml 
***

1 plays in ls.yml

PLAY [buggyhost] 
***


TASK [setup] 
***
Using module file 
/root/ansible/ansible/lib/ansible/modules/core/system/setup.py

 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -q -C -o ControlMaster=auto -o 
ControlPersist=60s -o StrictHostKeyChecking=no -o 
'IdentityFile="id_rsa"' -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r buggyhost '/bin/sh -c 
'"'"'( umask 77 && mkdir -p "` echo 
$HOME/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534 `" && echo 
ansible-tmp-1471604358.1-265208088531534="` echo 
$HOME/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534 `" ) && 
sleep 0'"'"''
 PUT /tmp/tmp7cAXoN TO 
/root/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534/setup.py
 SSH: EXEC sftp -b - -C -o ControlMaster=auto -o 
ControlPersist=60s -o StrictHostKeyChecking=no -o 
'IdentityFile="id_rsa"' -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r '[buggyhost]'

 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -q -C -o ControlMaster=auto -o 
ControlPersist=60s -o StrictHostKeyChecking=no -o 
'IdentityFile="id_rsa"' -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o 	ConnectTimeout=10 -o 
ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r buggyhost '/bin/sh -c 
'"'"'chmod -R u+x 
/root/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534/ && sleep 
0'"'"''

 ESTABLISH SSH CONNECTION FOR USER: None
 SSH: EXEC ssh -q -C -o ControlMaster=auto -o 
ControlPersist=60s -o StrictHostKeyChecking=no -o 
'IdentityFile="id_rsa"' -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o ConnectTimeout=10 -o 
ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r -tt buggyhost 
'/bin/sh -c '"'"'/usr/bin/python 
/root/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534/setup.py; rm 
-rf "/root/.ansible/tmp/ansible-tmp-1471604358.1-265208088531534/" > 
/dev/null 2>&1 && sleep 0'"'"''

^C
$

The playbook being

$ cat ls.yml
---
- hosts: '{{ target }}'
  tasks:
  - name:Run ls
shell:  /bin/ls
$


I am using asible 2.2.0 (devel 3afe50dfe2).  Server and clients are 
running openSuSE 13.1.


Any idea, why playbooks hang in this situation?

Cheers
frank


--
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/a8bae753-08bb-4a4a-b775-3ba775624c26%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: on/off playooks for lots of resources w/o repeating them (minimal redundancy)

2016-07-11 Thread Frank Thommen

Thanks a lot.  I'll give these a try.
frank

On 07/11/2016 11:42 AM, 'J Hawkesworth' via Ansible Project wrote:

I can think of a couple of ways - there are probably more

One way would be by having both playbooks include a vars file which has
the list of mounts in it:

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

or you could add the list of mounts to a group variable and have it
apply to both playbooks by having both playbooks work against that group
of hosts

See 
http://docs.ansible.com/ansible/playbooks_best_practices.html#group-and-host-variables
for more about group vars.

Hope this helps,

Jon




On Monday, July 11, 2016 at 8:21:12 AM UTC+1, Frank Thommen wrote:

Hi,

I'm currently evaluating ansible as a candidate for our future CM tool.
   I'm stuck with the issue, that we have "blocks" of resources (e.g. a
list of around 30 NFS mounts) which we'd like to be able to switch on
and off w/o repeating the complete resources in two playbooks.  How can
we have two playbooks, one mounting the mounts, the other unmounting
them w/o having to duplicate the whole list in both playbooks?

I'm sure there is a way, I just dont seem to be able to find the
appropriate documentation page.

Any pointer is appreciated
frank


--
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
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To post to this group, send email to ansible-project@googlegroups.com
<mailto:ansible-project@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/d22afed3-6f07-412e-9cc5-03dd5c019c5d%40googlegroups.com
<https://groups.google.com/d/msgid/ansible-project/d22afed3-6f07-412e-9cc5-03dd5c019c5d%40googlegroups.com?utm_medium=email&utm_source=footer>.
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/5783DA50.4080308%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] on/off playooks for lots of resources w/o repeating them (minimal redundancy)

2016-07-11 Thread Frank Thommen

Hi,

I'm currently evaluating ansible as a candidate for our future CM tool. 
 I'm stuck with the issue, that we have "blocks" of resources (e.g. a 
list of around 30 NFS mounts) which we'd like to be able to switch on 
and off w/o repeating the complete resources in two playbooks.  How can 
we have two playbooks, one mounting the mounts, the other unmounting 
them w/o having to duplicate the whole list in both playbooks?


I'm sure there is a way, I just dont seem to be able to find the 
appropriate documentation page.


Any pointer is appreciated
frank


--
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/578348C9.80107%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to implement regular Ansible runs?

2016-01-20 Thread Frank Thommen
Thanks.  Will have a look at ansible-pull.   That seems to exactly do what 
we need.

frank

-- 
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/3dc78e56-b6c4-40f7-b339-2c4050bcacb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to implement regular Ansible runs?

2016-01-20 Thread Frank Thommen
Hi,

we plan to deploy Linux client configurations via Ansible.  Since not all 
clients are running all the time, we want Ansible to run the deployment in 
regular invervals, e.g. every 2-3 hours.  What is "the Ansible way" to 
implement this?  Is there a better way than to have a cronjob on the 
Ansible server, which runs the appropriate playbook (or playbooks) in 
regular intervals?  Is there some kind of "pull" mechanism supported by 
Ansible, so that the /clients/ can initiate Ansible runs?  I couldn't find 
anything in the documentation, but then I wasn't even sure what keywords I 
should look for ;-)

And no: Ansible Tower is not an option.  We can't afford it.

I appreciate any pointers
Frank

-- 
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/e77d73ca-7eb6-400a-872c-5aa15d166b91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Correct way to use fail module and negative conditionals

2016-01-05 Thread Frank Ly
Thanks for clarifying that for me Josh.

What I did was create a variable that contains the supported distributions 
and have my when condition check against it:

vars:
  supported_distros: "{{ ansible_distribution }} {{ 
ansible_distribution_major_version }}"

tasks:
  - name: check if server is running a supported distro
fail: msg='Unsupported platform!'
when: platform not in ["Ubuntu 14","CentOS 6"]

That did the tricks!


On Saturday, December 19, 2015 at 11:18:52 PM UTC-5, Frank Ly wrote:
>
> I am trying to use the fail module at the very beginning of my playbook to 
> check if the target server is a specific distribution and version. This way 
> I can stop the playbook from running early on before any making any chances.
>
> playbook:
> ---
> - hosts: all
>
>   tasks:
> - debug: msg='distro is {{ ansible_distribution }} and version is {{ 
> ansible_distribution_major_version }}'
>
> - name: check if target server is CentOS 6
>   fail: msg='You have attempted to run this playbook against an 
> unsupported platform!'
>   when: (ansible_distribution != "CentOS" and 
> ansible_distribution_major_version != "6")
>
> - name: check if target server is CentOS 6 or Ubuntu 14
>   fail: msg='unsupported platform detected!'
>   when: (ansible_distribution != "CentOS" and 
> ansible_distribution_major_version != "6") or (ansible_distribution != 
> "Ubuntu" and ansible_distribution_major_version != "14")
>
> - debug: msg="Supported platform detected!"
>
> playbook execution:
>
> ansible-playbook test.yml -i inventory -u root -k
> SSH password: 
>
> PLAY [all] 
>  
>
> GATHERING FACTS 
> *** 
> ok: [192.168.245.11]
>
> TASK: [debug msg='distro is {{ ansible_distribution }} and version is {{ 
> ansible_distribution_major_version }}'] *** 
> ok: [192.168.245.11] => {
> "msg": "distro is CentOS and version is 6"
> }
>
> TASK: [check if target server is CentOS 6] *** 
> skipping: [192.168.245.11]
>
> TASK: [check if target server is CentOS 6 or Ubuntu 14] 
> *** 
> failed: [192.168.245.11] => {"failed": true}
> msg: unsupported platform detected!
>
> FATAL: all hosts have already failed -- aborting
>
> PLAY RECAP 
>  
>to retry, use: --limit @/tmp/test.retry
>
> 192.168.245.11   : ok=2changed=0unreachable=0   
>  failed=1   
>
>
> Where am I going wrong ?
>

-- 
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/54cd1916-3068-4268-895a-91cc59236a69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Correct way to use fail module and negative conditionals

2015-12-23 Thread Frank Ly
anyone able to help ?

On Saturday, December 19, 2015 at 11:18:52 PM UTC-5, Frank Ly wrote:
>
> I am trying to use the fail module at the very beginning of my playbook to 
> check if the target server is a specific distribution and version. This way 
> I can stop the playbook from running early on before any making any chances.
>
> playbook:
> ---
> - hosts: all
>
>   tasks:
> - debug: msg='distro is {{ ansible_distribution }} and version is {{ 
> ansible_distribution_major_version }}'
>
> - name: check if target server is CentOS 6
>   fail: msg='You have attempted to run this playbook against an 
> unsupported platform!'
>   when: (ansible_distribution != "CentOS" and 
> ansible_distribution_major_version != "6")
>
> - name: check if target server is CentOS 6 or Ubuntu 14
>   fail: msg='unsupported platform detected!'
>   when: (ansible_distribution != "CentOS" and 
> ansible_distribution_major_version != "6") or (ansible_distribution != 
> "Ubuntu" and ansible_distribution_major_version != "14")
>
> - debug: msg="Supported platform detected!"
>
> playbook execution:
>
> ansible-playbook test.yml -i inventory -u root -k
> SSH password: 
>
> PLAY [all] 
>  
>
> GATHERING FACTS 
> *** 
> ok: [192.168.245.11]
>
> TASK: [debug msg='distro is {{ ansible_distribution }} and version is {{ 
> ansible_distribution_major_version }}'] *** 
> ok: [192.168.245.11] => {
> "msg": "distro is CentOS and version is 6"
> }
>
> TASK: [check if target server is CentOS 6] *** 
> skipping: [192.168.245.11]
>
> TASK: [check if target server is CentOS 6 or Ubuntu 14] 
> *** 
> failed: [192.168.245.11] => {"failed": true}
> msg: unsupported platform detected!
>
> FATAL: all hosts have already failed -- aborting
>
> PLAY RECAP 
>  
>to retry, use: --limit @/tmp/test.retry
>
> 192.168.245.11   : ok=2changed=0unreachable=0   
>  failed=1   
>
>
> Where am I going wrong ?
>

-- 
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/c2d91233-c3cc-4c89-8c97-7a813303403c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Correct way to use fail module and negative conditionals

2015-12-19 Thread Frank Ly
I am trying to use the fail module at the very beginning of my playbook to 
check if the target server is a specific distribution and version. This way 
I can stop the playbook from running early on before any making any chances.

playbook:
---
- hosts: all

  tasks:
- debug: msg='distro is {{ ansible_distribution }} and version is {{ 
ansible_distribution_major_version }}'

- name: check if target server is CentOS 6
  fail: msg='You have attempted to run this playbook against an 
unsupported platform!'
  when: (ansible_distribution != "CentOS" and 
ansible_distribution_major_version != "6")

- name: check if target server is CentOS 6 or Ubuntu 14
  fail: msg='unsupported platform detected!'
  when: (ansible_distribution != "CentOS" and 
ansible_distribution_major_version != "6") or (ansible_distribution != 
"Ubuntu" and ansible_distribution_major_version != "14")

- debug: msg="Supported platform detected!"

playbook execution:

ansible-playbook test.yml -i inventory -u root -k
SSH password: 

PLAY [all] 
 

GATHERING FACTS 
*** 
ok: [192.168.245.11]

TASK: [debug msg='distro is {{ ansible_distribution }} and version is {{ 
ansible_distribution_major_version }}'] *** 
ok: [192.168.245.11] => {
"msg": "distro is CentOS and version is 6"
}

TASK: [check if target server is CentOS 6] *** 
skipping: [192.168.245.11]

TASK: [check if target server is CentOS 6 or Ubuntu 14] 
*** 
failed: [192.168.245.11] => {"failed": true}
msg: unsupported platform detected!

FATAL: all hosts have already failed -- aborting

PLAY RECAP 
 
   to retry, use: --limit @/tmp/test.retry

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


Where am I going wrong ?

-- 
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/f20162a7-f857-4a88-be82-77335f04c9c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] with_items: expects a list or a set by using it with when:

2015-11-08 Thread Frank Ly
Markus,

That's exactly what I ended up doing. Thanks for your help. 

On Saturday, November 7, 2015 at 5:11:54 AM UTC-5, Markus Ellers wrote:
>
> you could put the tasks in a different yml file and do a conditional 
> include based on your "when".
>

-- 
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/086edd00-bbd3-4c6a-abb1-6ec4c0188d76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: execute shell script that starts background process

2015-11-05 Thread Frank Ly
Some resources for creating startup scripts:
https://github.com/fhd/init-script-template
https://github.com/jordansissel/pleaserun


On Friday, December 12, 2014 at 8:33:27 AM UTC-5, Torsten Reinhard wrote:
>
> Hi, 
>
> our development team delivers a start script for a "Listener process".
> It looks like:
>
> #!/bin/sh
> BASEDIR=$(dirname $0)
> echo "> Starting Global 
> Listener."
> ${BASEDIR}/cm listener &
>
> I can start this script manually and everything is fine. 
>
> If I start it using the Ansible shell module, the playbook "hangs" and 
> will not return. I tried to use the "command" Module instead, but it is 
> still the same.
>
> I than read about the "async" and "poll" options - but I cannot use async 
> [time] - because the process started will live as long as it is stopped 
> manually.
>
> What is recommended here? Is there a way to use the existing shell script 
> - or do we need to modify that script ?
>
> Any help appreciated, 
>
> Torsten
>

-- 
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/0f223e7f-0512-4f78-97c9-51a1d00cc249%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Use Ansible to discover/document an environment

2015-11-05 Thread Frank Ly
I've done something like this to create an inventory tracking spreadsheet. 
Haven't had the chance yet to improve it or convert it into a proper 
playbook. 

The setup module allows you to output facts to a tree structure with a JSON 
file for each host: 
$ ansible all -i inventory -u admin -m setup --tree hosts_facts

facts/
├── host_A
├── host_B
├── host_C
├── host_D
└── host_Z

I used a command-line utility called jq to parse the JSON. See here: 
http://xmodulo.com/how-to-parse-json-string-via-command-line-on-linux.html

Then, just had to create a bash script to go through each file and extract 
the facts that I needed into a csv:

$ cat facts/host_A | jq .ansible_facts.ansible_distribution



On Tuesday, November 3, 2015 at 2:37:39 PM UTC-5, Jon Dison wrote:
>
> I'm wondering if anyone has any existing playbooks and/or scripts to go 
> through an environment and document the findings.
>
> Basically a way to transform the results from the setup module into a 
> useful CSV would be a good start, but also adding on other facets like 
> lists of patches to be applied, etc would be very useful.
>
> I've made use of the setup module to create a directory of hosts files 
> showing the results in YAML, but transforming that into a useful report 
> would take some work and I figure someone out there may have already done 
> it.
>

-- 
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/2b4f45fe-0d21-47fa-b530-80491846d4f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] best location for async_status tasks in a playbook with multiple roles

2015-11-05 Thread Frank Ly
Say you have a playbook with multiple roles, for example:

roles:
 - A
 - B
 - C

in role A's or B's tasks/main.yml, there are a few tasks which are 
asynchronous fire and forget, do not poll tasks, for example:

- name: do the thing (asynchronously)
  shell: Zhu Li do the thing
  args:
creates: /etc/thething
  async: 300
  poll: 0
  register: thething_created

these tasks need to be checked on at the end of the playbook run before the 
handlers execute like so:

- name: verify that the thing was done
  async_status: jid={{ thething_created.ansible_job_id }}
  register: thething_result
  until: thething_result.finished
  retries: 100

currently I have these async_status tasks at the end of C's tasks/main.yml. 
If role C is removed or conditionally executed, it will cause the entire 
playbook to fail.

Where is the best location to put these kind of tasks? I could always 
create another role called D that contains just these tasks but I'm 
interested to learn how the rest of you are handling this. 

-- 
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/85aaa315-a17c-4451-b6dc-dd5ebdb89fa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] with_items: expects a list or a set by using it with when:

2015-11-05 Thread Frank Lye
I'm having the same issue. How can we make this task check if the variable 
exists before looping ? If we can't use when here, what can we do ?

On Monday, October 20, 2014 at 5:02:25 PM UTC-4, Michael DeHaan wrote:
>
> The when is evaluated for each step in the loop, not before looping, which 
> is the source of confusion here.
>
> On Fri, Oct 17, 2014 at 6:04 AM, bshbg  > wrote:
>
>> I have the following two statements which have the same when part. The 
>> first one is skipped correctly but the second creates an error. It should 
>> be skipped also.
>>
>> - debug: var="{{ sites[env].restricted_areas }}"
>>   when: sites[env].restricted_areas is defined
>>  
>> - template: src="apache/site_credentials" dest="{{ 
>> apache_vhost_base_path }}/{{ sites[env].server_name }}/conf/{{ 
>> item.area.internal_name }}"
>>   with_items: sites[env].restricted_areas | list
>>   when: sites[env].restricted_areas is defined 
>>   tags: create
>>
>>
>>
>> result:
>>
>> TASK: [website | debug var="{{sites[env].restricted_areas}}"] 
>> *
>> skipping: [TSSDMZPORTAL002]
>>
>>
>> TASK: [website | template src="apache/site_credentials" dest=
>> "{{apache_vhost_base_path}}/{{sites[env].server_name}}/conf/{{item.area.internal_name}}"
>> ] ***
>> fatal: [TSSDMZPORTAL002] => with_items expects a list or a set
>>
>>
>> can someone help me?
>>
>> -- 
>> 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/eb330a83-d434-4d8f-8022-0f9acafff636%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/e7586ace-55d4-495c-85b4-704d9047d76c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Gathering ec2 instance facts with only a region and instance id?

2015-10-06 Thread Frank Perks
I ended up just creating an ansible module. Which is here if anyone runs 
into this issue in the future.

https://gist.github.com/fperks/475e3e58d60cef8fc922

Honestly i would really like this kind of functionality to be added the 
ec2_remote_facts. 

On Monday, October 5, 2015 at 4:42:15 PM UTC-4, Frank Perks wrote:
>
> Thanks. Unfortunately it is not part of my dynamic inventory. 
>
> Anisble runs a tool that provisions a bunch of ec2 instances, installs and 
> configures a bunch of software on the systems (eventually this will be 
> replaced by ansible i hope). The tool returns a series of instance ids and 
> their regions to stdout. Unfortunately the tool does not properly tag the 
> instances which means it can't be discovered by my dynamic inventory, nor 
> do the output instances follow any sort of logical naming convention. 
>
> What i would like to do is to:
>
> 1. Get the metadata related to that instance id
> 2. Add the host to an ansible group
> 3. ssh into it, pull out some internal metadata about the server purpose
> 4. tag it correspondingly
>
> My use case is kind of really weird and super specific. Unfortunately :(
>
> On Monday, October 5, 2015 at 4:22:48 PM UTC-4, Josh Smift wrote:
>>
>> If it's in your (dynamic) inventory, you might be able to do something 
>> with with_dict and hostvars and when, because the instance ID is one of 
>> the things in hostvars. I can try to put together an example if that 
>> makes 
>> no sense or sounds hard. 
>>
>>   -Josh (j...@care.com) 
>>
>>
>>
>> This email is intended for the person(s) to whom it is addressed and may 
>> contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized 
>> use, distribution, copying, or disclosure by any person other than the 
>> addressee(s) is strictly prohibited. If you have received this email in 
>> error, please notify the sender immediately by return email and delete the 
>> message and any attachments from your system. 
>>
>

-- 
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/66f086ce-be35-4722-8612-11cb6231956e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Gathering ec2 instance facts with only a region and instance id?

2015-10-05 Thread Frank Perks
Thanks. Unfortunately it is not part of my dynamic inventory. 

Anisble runs a tool that provisions a bunch of ec2 instances, installs and 
configures a bunch of software on the systems (eventually this will be 
replaced by ansible i hope). The tool returns a series of instance ids and 
their regions to stdout. Unfortunately the tool does not properly tag the 
instances which means it can't be discovered by my dynamic inventory, nor 
do the output instances follow any sort of logical naming convention. 

What i would like to do is to:

1. Get the metadata related to that instance id
2. Add the host to an ansible group
3. ssh into it, pull out some internal metadata about the server purpose
4. tag it correspondingly

My use case is kind of really weird and super specific. Unfortunately :(

On Monday, October 5, 2015 at 4:22:48 PM UTC-4, Josh Smift wrote:
>
> If it's in your (dynamic) inventory, you might be able to do something 
> with with_dict and hostvars and when, because the instance ID is one of 
> the things in hostvars. I can try to put together an example if that makes 
> no sense or sounds hard. 
>
>   -Josh (j...@care.com ) 
>
>
>
> This email is intended for the person(s) to whom it is addressed and may 
> contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized 
> use, distribution, copying, or disclosure by any person other than the 
> addressee(s) is strictly prohibited. If you have received this email in 
> error, please notify the sender immediately by return email and delete the 
> message and any attachments from your system. 
>

-- 
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/a7aa72c8-21ea-43d0-9db5-a0ab15ee8669%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Gathering ec2 instance facts with only a region and instance id?

2015-10-05 Thread Frank Perks
So i have a small problem, the only thing i have from the output of another 
tool is just an instance_id, along with its region. I need to grab some 
more information about the ec2 instance (such as the platform, tags, etc) 
in order to actually determine what inventory groups it belongs in. 

Unfortunately i cannot figure out how to actually acquire facts about this 
through ansible.

The ec2 module seems to be soly for the purpose of creating ec2 instances, 
and attempting to pass in region, instance_id, and state=present results in 
errors, about image not being defined. (which i get since if the ec2 
instance doesn't exist it will create it).

ec2_remote_facts only seems to work with ec2 instance tags/values, and 
unfortunately i don't have those. 

ec2_facts actually requires me to connect to the ec2 instance and gather 
facts locally. (which i can't do since i can't figure out the actual 
public_ip of the instance).

Is there any other options/alternatives? (I know i can get it from the 
awscli tool and pipe the json into yaml and then into a variable, but that 
feels kind of gross). 

-- 
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/09cc5606-ce1a-40cd-b992-000b1b92e4fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Setting fact name dynamically in set_fact?

2015-09-27 Thread Frank Perks
Thanks brian. action_plugins directory worked fine for me. :D

On Friday, September 25, 2015 at 6:08:18 PM UTC-4, Brian Coca wrote:
>
> first, you should be able to just write the var into a facts file on 
> the target machine and fact gathering shoudl automatically pick it up 
> (http://docs.ansible.com/ansible/setup_module.html read fact_path). 
>
>
> as for the action plugin, each plugin type has it's own directory 
> name, you cannot mix plugin types in the same directory, for action 
> plugins the directory is 'action_plugins' 
>
> -- 
> 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/1bede1dc-de15-49d1-83c8-4933e487610a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Setting fact name dynamically in set_fact?

2015-09-25 Thread Frank Perks
Unfortunately it seems like include_vars only looks for the vars file on 
the ansible server, and will not fetch it on the remote server. Trying to 
elegantly handle these cases ended up becoming a huge mess. 

I ended up just creating my own action plugin that pulls the a key/value 
parameter and adds them as a fact. Unfortunately i can't actually figure 
out how to get Ansible to properly use my action plugin without shoving it 
in the ansible install directory. Action plugins in plugin directory seem 
to be ignored. 

On Wednesday, September 23, 2015 at 3:39:24 AM UTC-4, George Boobyer wrote:
>
> This might provide some inspiration, where a vars file is templated and 
> then included allowing dynamic variable names and values.
> I think it would be 'more elegant' to build up an in memory YAML/JSON  as 
> opposed to creating a file - but haven't got a good example - so hope this 
> helps! and it may prompt some 'better' suggestions! ; )
> https://groups.google.com/d/msg/ansible-project/X1Q93QOk6Ew/ZygP5rXmfEkJ
>
> On Tuesday, September 22, 2015 at 12:49:13 AM UTC+1, Frank Perks wrote:
>>
>> I am trying to shrink ~30+ roles into a single role to drastically reduce 
>> the amount of duplicate and copy and pasted code into a single nice and 
>> neat role. One of the problems is each role sets a specifically named fact 
>> basically like: 
>>
>> ec2__foo
>>
>> What i want to do is this:
>>
>> set_fact:
>>   "{{ some var }}" : "{{ some value }}"
>>
>> The problem is that i can't seem to figure out how to do this. Now i know 
>> i could simply on the playbook task, copy the value into its corresponding 
>> var through set_fact. However a lot of the roles are run one after another, 
>> so that doesn't really work.
>>
>> I was thinking i could just setup redis and push the fact there 
>> temporarily, however that seems like a lot of 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/8fc5e78f-5cb4-47c0-bb67-5ce806eb638f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Setting fact name dynamically in set_fact?

2015-09-22 Thread Frank Perks
Any ideas? This is really blocking me. 

On Monday, September 21, 2015 at 7:49:13 PM UTC-4, Frank Perks wrote:
>
> I am trying to shrink ~30+ roles into a single role to drastically reduce 
> the amount of duplicate and copy and pasted code into a single nice and 
> neat role. One of the problems is each role sets a specifically named fact 
> basically like: 
>
> ec2__foo
>
> What i want to do is this:
>
> set_fact:
>   "{{ some var }}" : "{{ some value }}"
>
> The problem is that i can't seem to figure out how to do this. Now i know 
> i could simply on the playbook task, copy the value into its corresponding 
> var through set_fact. However a lot of the roles are run one after another, 
> so that doesn't really work.
>
> I was thinking i could just setup redis and push the fact there 
> temporarily, however that seems like a lot of 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/550ed3bd-fd0a-45dc-893d-03804baee9f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Setting fact name dynamically in set_fact?

2015-09-21 Thread Frank Perks
I am trying to shrink ~30+ roles into a single role to drastically reduce 
the amount of duplicate and copy and pasted code into a single nice and 
neat role. One of the problems is each role sets a specifically named fact 
basically like: 

ec2__foo

What i want to do is this:

set_fact:
  "{{ some var }}" : "{{ some value }}"

The problem is that i can't seem to figure out how to do this. Now i know i 
could simply on the playbook task, copy the value into its corresponding 
var through set_fact. However a lot of the roles are run one after another, 
so that doesn't really work.

I was thinking i could just setup redis and push the fact there 
temporarily, however that seems like a lot of 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/7473cfa5-ef33-415e-80ad-3710212ee0b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Rescue block doesn't seem to work when error is in an included file

2015-09-15 Thread Frank Perks
I am dumb, and the issue is because i have:

- rescue



when it should be:

  
rescue

My mistake.
 

On Tuesday, September 15, 2015 at 9:03:04 AM UTC-4, Frank Perks wrote:
>
> So i was hoping to use blocks as an easy way to notify success/failure of 
> ansible runs.
>
> - block:
>   - include: build.yml
>   - include: deploy_site.yml
>
>   - name: Notify Slack it successfully deployed
> slack: 
>
> - rescue:
>   - name: Notify Slack it failed
> slack: 
>
> When there is an error in ether of the included yml files. Rescue never 
> seems to be executed. 
>
> This is running the latest devel. 
>

-- 
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/2217b12b-d9d4-406d-9d5f-c2f8a1410b23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Rescue block doesn't seem to work when error is in an included file

2015-09-15 Thread Frank Perks
So i was hoping to use blocks as an easy way to notify success/failure of 
ansible runs.

- block:
  - include: build.yml
  - include: deploy_site.yml

  - name: Notify Slack it successfully deployed
slack: 

- rescue:
  - name: Notify Slack it failed
slack: 

When there is an error in ether of the included yml files. Rescue never 
seems to be executed. 

This is running the latest devel. 

-- 
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/042798d5-7300-432a-b106-788842a3c7b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Setting hostname

2015-09-15 Thread Frank Perks
Like i said move your ansible-hostname into the roles folder (if you don't 
have one make one). As far as i know ansible only loads roles from the 
roles folder, which is probably your issue.

Also his documentation is wrong, he doesn't use hostname_domain, he 
actually in the code uses hostname_fqdn instead. 

On Tuesday, September 15, 2015 at 1:41:52 AM UTC-4, Kuberboef wrote:
>
>
>
> On Monday, 14 September 2015 18:01:34 UTC+2, Frank Perks wrote:
>>
>> ansible-hostname is a role, and should be in the roles directory.
>>
>> Assuming /home/stefaansm/trusty64/Ansible/ is where your playbooks are. 
>> Then ansible-hostname should be located at 
>> /home/stefaansm/trusty64/Ansible/roles/ansible-hostname
>>
>>
>>
>> On Monday, September 14, 2015 at 8:20:06 AM UTC-4, Kuberboef wrote:
>>>
>>>
>>> Morning all
>>>
>>> I am sure this has been asked before, I just struggle to find it.
>>> I cloned https://github.com/knopki/ansible-hostname
>>> Looks good and vagrant calls ansible successfully and all goes wel, 
>>> untill
>>> I need to specify variables in the vars/main.yml file.
>>>
>>> hostname_name = mozzi
>>> hostname_domain = mozzi.mydomain.com
>>>
>>> My error:
>>> ERROR: vars from 
>>> '/home/stefaansm/trusty64/Ansible/ansible-hostname/vars/main.yml' are not a 
>>> dict
>>>
>>> Now being a nube at this and not a programmers backside, I seem to be 
>>> lost here and doc's seem scarce.
>>>
>>> Mozzi
>>>
>>>
> Morning
>
> Okay contents of  ~/trusty64/Ansible
>  Ansible
> │   ├── ansible-hostname
> │   │   ├── defaults
> │   │   │   └── main.yml
> │   │   ├── LICENSE
> │   │   ├── meta
> │   │   │   └── main.yml
> │   │   ├── README.md
> │   │   ├── tasks
> │   │   │   └── main.yml
> │   │   └── vars
> │   │   └── main.yml
>
> │   └── playbook.yml
>
> config in playbook:
>
> - hosts: all
>   roles:
> - { role: ansible-hostname }
>
> So according to me the role is found and executed correctly, but there is 
> something wrong
> with the way I specify the hostnames in vars/main.yml.
>
> From the README.md:
>
> Role Variables
> --
>
>  * *hostname_name* - new hostname (not FQDN, before first dot)
>  * *hostname_domain* - new domain name
>
> Config in vars/main.yml:
>
> ---
> # vars file for hostname
>   hostname_name = mozzi
>   hostname_domain = mozzi.mydomain.com
>
> Error I get:
>
> ERROR: vars from 
> '/home/stefaansm/trusty64/Ansible/ansible-hostname/vars/main.yml' are not a 
> dict
>
> How do I make this a dict?
>
> Again apologies for such a n00b question.
>
>

-- 
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/c55ece08-0b4a-416d-87df-112b51206bb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Newbie question on ansible inventory?

2015-09-14 Thread Frank Perks
Hi,

The easiest way imo is to define groups in your inventory. Group the 
servers that use the same war file togther, and then add a corresponding 
var file for that group in group_vars. In group vars define a list of the 
wars on that server. 

E.g.: qa01.yml

war_files: 
  - /something/app1.war
  - /something/app2.war


Then in your playbook you can simply just call:

tasks:
 - name: rename war files
   shell: cp /tmp/staging.war /usr/local/tomcat1/webapps/{{ item }}
   with_items: war_files


Depending on which server you are on, it will deploy the specific war files 
defines in your corresponding group vars


On Monday, September 14, 2015 at 8:20:07 AM UTC-4, Aaron Eldridge wrote:
>
> Hi there, Im just starting with ansible so I appologise if this is a 
> stupid question.
>
> I have am wanting to try do use ansible to deploy .war web app's to 
> several QA servers. Each QA server hosts serveral instances of the app's 
> across multiple instances of tomcat per server (production is 1 per 
> server). 
>
> I was wanting to write a play book that would connect to each QA server, 
> copy the war files to each insteance on tomcat in on the server then move 
> onto the next box.
>
> The problem I originally had was I put each app as its own inventory item 
> (with the same host name), I found that this did not work. So I now have 
> just the 4 QA servers in there now. 
>
> Is there a good way do declare what app should be on what tomcat under 
> each server in the inventory or should that be in the playbook?
>
> Thank you for reading.
>

-- 
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/0be22b44-7c25-44be-abce-c94d52da0757%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Required variables in var in inline vars

2015-09-14 Thread Frank Perks
You make an variable mandatory to throw an error if a var is not defined:

- hosts:
  vars:
var_required_by_role: 
  - name: "{{ variable | mandatory }}"
user: "foo"
  roles:
- myrole

Alternatively you can edit ansible.cfg to change this setting to True

error_on_undefined_vars = False


On Monday, September 14, 2015 at 8:20:07 AM UTC-4, Andrew Wade wrote:
>
> Hey,
>
> (I'm using Ansible 1.9.2)
>
> I've got a playbook like this:
>
> - hosts:
>   vars:
> var_required_by_role: 
>   - name: "{{ variable }}"
> user: "foo"
>   roles:
> - myrole
>
>
> My issue is that no error is raised if 'variable' is undefined; Ansible 
> outputs a changed line like:
>
> => ... 'name': u'{# variable #}'
>
> I'm constructing a more complex variable form a simple value passed in 
> with -e and I don't want to define the complex variable on the command line.
>
> Is there a better way to do this, or to force error checking? I tried the 
> mandatory filter, but I don't think it gets parsed.
>
> 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/8cdcbd66-9902-41cf-a8d6-512c841412c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Setting hostname

2015-09-14 Thread Frank Perks
ansible-hostname is a role, and should be in the roles directory.

Assuming /home/stefaansm/trusty64/Ansible/ is where your playbooks are. 
Then ansible-hostname should be located at 
/home/stefaansm/trusty64/Ansible/roles/ansible-hostname



On Monday, September 14, 2015 at 8:20:06 AM UTC-4, Kuberboef wrote:
>
>
> Morning all
>
> I am sure this has been asked before, I just struggle to find it.
> I cloned https://github.com/knopki/ansible-hostname
> Looks good and vagrant calls ansible successfully and all goes wel, 
> untill
> I need to specify variables in the vars/main.yml file.
>
> hostname_name = mozzi
> hostname_domain = mozzi.mydomain.com
>
> My error:
> ERROR: vars from 
> '/home/stefaansm/trusty64/Ansible/ansible-hostname/vars/main.yml' are not a 
> dict
>
> Now being a nube at this and not a programmers backside, I seem to be lost 
> here and doc's seem scarce.
>
> Mozzi
>
>

-- 
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/56ee2a06-9b05-4965-a114-a88a2029c1bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] wierd substitution at regex_replace filter

2015-09-14 Thread Frank Tamás
Hi,

I need a list with the ip address of play_hosts. This template worked with 
1.6.5, but it does not work with 1.9.3. I would appreciate any help, what 
could be wrong.

---
- hosts: test

  vars:
galera_cluster_members: "{{ play_hosts|map('regex_replace','(.*)', \"{{ 
hostvars['1']['ansible_eth0']['ipv4']['address'] }}\")|list() }}"

  tasks:
- name: register members
  debug:
msg: "{{ galera_cluster_members }}"


Ansible: 1.9.3
Jinja: 2.7.2


thanks,
Tamas

-- 
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/cda6df53-9ab7-4b1e-958d-007f5567878a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Can't use local_action in Windows playbook in devel?

2015-09-12 Thread Frank Perks
delegate_to: localhost seems to work okay for most cases when working in a 
playbook. Unfortunately the solution doesn't seem to work when doing it 
inside a role:

- wait_for host={{ ansible_ssh_host }} port={{ ansible_ssh_port }} delay=30 
timeout=300
  delegate_to: localhost

I get: "ERROR! The module wait_for was not found in configured module 
paths" Is there any other sort of workaround that exists (i cannot live 
without blocks anymore). 

On Thursday, September 10, 2015 at 5:35:49 AM UTC-4, J Hawkesworth wrote:
>
> Looks like you have hit https://github.com/ansible/ansible/issues/12053
>
> changing over to 
>delegate_to: localhost
>
> will likely work around the problem for now, until the above can be fixed.
>
> Jon
>
> On Thursday, September 10, 2015 at 9:09:20 AM UTC+1, Trond Hindenes wrote:
>>
>> That is very strange. I spent a lot of time making sure it would work in 
>> both 1.9 and 2.0. Will test and report back.
>>
>> On Wednesday, September 9, 2015 at 5:46:39 PM UTC+2, Frank Perks wrote:
>>>
>>> Just to add something else, in 1.9.4 both Trond and my stuff works fine. 
>>>
>>> On Wednesday, September 9, 2015 at 10:44:35 AM UTC-4, Frank Perks wrote:
>>>>
>>>> Hi Trond,
>>>>
>>>> I tried your module, and it fails with the same issue as above. 
>>>>
>>>> fatal: [52.8.31.205]: FAILED! => {"failed": true, "msg": "ERROR! The 
>>>> module stat was not found in configured module paths"}
>>>>
>>>> I have found a really ugly way to get around it, and that is by simply 
>>>> defining another play with the wait_for winrm. Then starting another play 
>>>> for the remaining windows tasks. 
>>>>
>>>>
>>>> On Wednesday, September 9, 2015 at 10:29:05 AM UTC-4, Trond Hindenes 
>>>> wrote:
>>>>>
>>>>> Frank, I actually put a lot of work into the trondhindenes.win_reboot 
>>>>> role you can find on Galaxy. WIth it you can force reboots, run reboots 
>>>>> for 
>>>>> nodes needing a reboot or whatever, and it will correctly run cooldown 
>>>>> scripts and loop until it has a stable winrm service running before it 
>>>>> will 
>>>>> allow continuation. Maybe see if that solves this exact case for you?
>>>>>
>>>>> as for connection: local, I've had far better results with 
>>>>> delegate_to: localhost on the current devel branch.
>>>>>
>>>>> On Wednesday, September 9, 2015 at 3:38:03 PM UTC+2, Frank Perks wrote:
>>>>>>
>>>>>> This is running latest version of devel (i updated this morning). 
>>>>>>
>>>>>> delegate_to / connnection: local does not seem to work.
>>>>>>
>>>>>> On Wednesday, September 9, 2015 at 8:45:47 AM UTC-4, Brian Coca wrote:
>>>>>>>
>>>>>>> What version of ansible? have you tried with connection: local or 
>>>>>>> delegate_to: localhost:? 
>>>>>>>
>>>>>>>  It seems we lookup the module before making the connection local, 
>>>>>>> in 
>>>>>>> which case it is still looking for .ps1 files. 
>>>>>>>
>>>>>>>
>>>>>>> -- 
>>>>>>> Brian Coca 
>>>>>>>
>>>>>>

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


Re: [ansible-project] Ansible develop branch, callback_plugins are not triggered

2015-09-11 Thread Frank van Tol
Thanx for pointing me to the whitelist feature.

I found the plugins, some have different interfaces (some starting with 
v2_) and don't seem to work as-is.
For example, profile_tasks says to be upgraded to v2 but gives this:

 [WARNING]: Error when using >: global name 'display' is not defined



Op vrijdag 11 september 2015 17:31:32 UTC+2 schreef Brian Coca:
>
> devel includes it's own timer plugin, you can enable it by updating 
> ansible.cfg: 
>
> callback_whitelist = timer 
>
>
> -- 
> 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/09af0659-a24c-4e1a-8230-699781af1054%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible develop branch, callback_plugins are not triggered

2015-09-11 Thread Frank van Tol

I am trying to get a timing/profile callback plugin to work, so far I've 
found several versions, each with different interfaces but none of them are 
triggered.

I did add a callback_plugins item to ansible.cfg.

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


Re: [ansible-project] Can't use local_action in Windows playbook in devel?

2015-09-09 Thread Frank Perks
Just to add something else, in 1.9.4 both Trond and my stuff works fine. 

On Wednesday, September 9, 2015 at 10:44:35 AM UTC-4, Frank Perks wrote:
>
> Hi Trond,
>
> I tried your module, and it fails with the same issue as above. 
>
> fatal: [52.8.31.205]: FAILED! => {"failed": true, "msg": "ERROR! The 
> module stat was not found in configured module paths"}
>
> I have found a really ugly way to get around it, and that is by simply 
> defining another play with the wait_for winrm. Then starting another play 
> for the remaining windows tasks. 
>
>
> On Wednesday, September 9, 2015 at 10:29:05 AM UTC-4, Trond Hindenes wrote:
>>
>> Frank, I actually put a lot of work into the trondhindenes.win_reboot 
>> role you can find on Galaxy. WIth it you can force reboots, run reboots for 
>> nodes needing a reboot or whatever, and it will correctly run cooldown 
>> scripts and loop until it has a stable winrm service running before it will 
>> allow continuation. Maybe see if that solves this exact case for you?
>>
>> as for connection: local, I've had far better results with delegate_to: 
>> localhost on the current devel branch.
>>
>> On Wednesday, September 9, 2015 at 3:38:03 PM UTC+2, Frank Perks wrote:
>>>
>>> This is running latest version of devel (i updated this morning). 
>>>
>>> delegate_to / connnection: local does not seem to work.
>>>
>>> On Wednesday, September 9, 2015 at 8:45:47 AM UTC-4, Brian Coca wrote:
>>>>
>>>> What version of ansible? have you tried with connection: local or 
>>>> delegate_to: localhost:? 
>>>>
>>>>  It seems we lookup the module before making the connection local, in 
>>>> which case it is still looking for .ps1 files. 
>>>>
>>>>
>>>> -- 
>>>> Brian Coca 
>>>>
>>>

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


Re: [ansible-project] Can't use local_action in Windows playbook in devel?

2015-09-09 Thread Frank Perks
Hi Trond,

I tried your module, and it fails with the same issue as above. 

fatal: [52.8.31.205]: FAILED! => {"failed": true, "msg": "ERROR! The module 
stat was not found in configured module paths"}

I have found a really ugly way to get around it, and that is by simply 
defining another play with the wait_for winrm. Then starting another play 
for the remaining windows tasks. 


On Wednesday, September 9, 2015 at 10:29:05 AM UTC-4, Trond Hindenes wrote:
>
> Frank, I actually put a lot of work into the trondhindenes.win_reboot role 
> you can find on Galaxy. WIth it you can force reboots, run reboots for 
> nodes needing a reboot or whatever, and it will correctly run cooldown 
> scripts and loop until it has a stable winrm service running before it will 
> allow continuation. Maybe see if that solves this exact case for you?
>
> as for connection: local, I've had far better results with delegate_to: 
> localhost on the current devel branch.
>
> On Wednesday, September 9, 2015 at 3:38:03 PM UTC+2, Frank Perks wrote:
>>
>> This is running latest version of devel (i updated this morning). 
>>
>> delegate_to / connnection: local does not seem to work.
>>
>> On Wednesday, September 9, 2015 at 8:45:47 AM UTC-4, Brian Coca wrote:
>>>
>>> What version of ansible? have you tried with connection: local or 
>>> delegate_to: localhost:? 
>>>
>>>  It seems we lookup the module before making the connection local, in 
>>> which case it is still looking for .ps1 files. 
>>>
>>>
>>> -- 
>>> Brian Coca 
>>>
>>

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


Re: [ansible-project] Confused about windows passwords and working with ec2?

2015-09-09 Thread Frank Perks
This does not actually work, i get 

FAILED! => {"failed": true, "msg": "ERROR! The module ec2_win_password was 
not found in configured module paths"}

I am assuming this is related to this issue: 
https://groups.google.com/forum/#!topic/ansible-project/PqwMiIHV0js

On Wednesday, September 9, 2015 at 7:30:25 AM UTC-4, Frank Perks wrote:
>
> I didn't realize you can specify the ansible connection on a per task 
> level!
>
> That completely changes stuff!
>
> I will give this a shot!
>
> On Tuesday, September 8, 2015 at 4:51:48 PM UTC-4, Brian Coca wrote:
>>
>> have you tried this? 
>>
>> - hosts: windows 
>>   gather_facts: false 
>>   tasks: 
>>
>> - ec2_win_password:  
>>   connection: local 
>>
>> - set_fact: ansible_ssh_host="{{ ec2_win_password.whatver}}" 
>>
>> - do_other_stuff 
>> -- 
>> 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/45012680-f58b-4a6b-9931-815e113e926d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Can't use local_action in Windows playbook in devel?

2015-09-09 Thread Frank Perks
This is running latest version of devel (i updated this morning). 

delegate_to / connnection: local does not seem to work.

On Wednesday, September 9, 2015 at 8:45:47 AM UTC-4, Brian Coca wrote:
>
> What version of ansible? have you tried with connection: local or 
> delegate_to: localhost:? 
>
>  It seems we lookup the module before making the connection local, in 
> which case it is still looking for .ps1 files. 
>
>
> -- 
> Brian Coca 
>

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


[ansible-project] Can't use local_action in Windows playbook in devel?

2015-09-09 Thread Frank Perks
I am trying to reboot a windows server after installing .net + a bunch of 
dependencies. I have a super simple PS module to schedule a reboot. However 
afterwords i would like to wait for the WinRM connection to come back:

- name: Configuring windows
  hosts: windows
  roles:
- win_dotnet_46
- win_nodejs
- win_msvc
- win_jdk
  tasks:
- name: Rebooting for .NET 4.6
  win_reboot:
force: yes

- name: Waiting for Windows Server to Come up
  local_action: wait_for host={{ ansible_ssh_host }} port={{ 
ansible_ssh_port }} delay=30 timeout=300

However actually running this local_action seems to result in:

TASK [Waiting for Windows Server to Come up] 
***
fatal: [XX]: FAILED! => {"failed": true, "msg": "ERROR! The module 
wait_for was not found in configured module paths"}

I can use wait_for everywhere else, but not 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/bdd072cc-8798-4c24-821d-10473ddb2353%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Confused about windows passwords and working with ec2?

2015-09-09 Thread Frank Perks
I didn't realize you can specify the ansible connection on a per task level!

That completely changes stuff!

I will give this a shot!

On Tuesday, September 8, 2015 at 4:51:48 PM UTC-4, Brian Coca wrote:
>
> have you tried this? 
>
> - hosts: windows 
>   gather_facts: false 
>   tasks: 
>
> - ec2_win_password:  
>   connection: local 
>
> - set_fact: ansible_ssh_host="{{ ec2_win_password.whatver}}" 
>
> - do_other_stuff 
> -- 
> 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/25b7ce52-82e7-4171-bc50-b4d1e0894c85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   >