Re: [ansible-project] Ansible Tower and Facts

2020-01-31 Thread Glen Collins
It does set the fact in tower. When I review the host in the inventory and 
click on the facts, they show up as set. If this is supposed to not work 
because of the invalid host, it could be a bug. But for me (using tower 
3.5.4) it's working.

Regards,

Glen

On Friday, January 31, 2020 at 10:30:04 PM UTC-8, Vladimir Botka wrote:
>
> On Fri, 31 Jan 2020 20:14:51 -0800 (PST) 
> Glen Collins > wrote: 
>
> > - name: Set facts 
> >   set_fact: 
> >dummy_fact: "Hello world" 
> >cacheable: yes 
> >   delegate_to: fake_host 
> >   delegate_facts: true 
> > 
> > This sets the fact in the hostname fake_host just fine. 
> > [...] 
> > I have tried to target the playbook using host: fake_host but the 
> playbook 
> > run tells me the host is invalid or something to that effect. 
>
> This *can't* set the fact in the hostname fake_host just fine if the host 
> in not valid. The play 
>
>   - hosts: all 
> tasks: 
>   - set_fact: 
>   dummy_fact: "Hello world" 
>   cacheable: yes 
> delegate_to: fake_host 
> delegate_facts: true 
> run_once: true 
>   - debug: 
>   var: hostvars.fake_host.ansible_facts 
> run_once: true 
>
>
> should report 
>
> "hostvars.fake_host.ansible_facts": "VARIABLE IS NOT DEFINED!" 
>
> > Can someone tell me if this is even possible to do? Possible to target 
> > directly? 
>
> If the host is valid. All works as expected. For example, the playbook 
>   
>   - hosts: all 
> tasks: 
>   - set_fact: 
>   dummy_fact: "Hello world" 
>   cacheable: yes 
> delegate_to: test_01 
> delegate_facts: true 
> run_once: true 
>   - debug: 
>   var: hostvars.test_01.ansible_facts 
> run_once: true 
>
>   - hosts: test_01 
> tasks: 
>   - debug: 
>   var: hostvars.test_01.ansible_facts 
>   - meta: clear_facts 
>   - debug: 
>   var: hostvars.test_01.ansible_facts 
>
> gives 
>
>   PLAY [all] 
>   ok: [test_01] => { 
> "hostvars.test_01.ansible_facts": { 
> "dummy_fact": "Hello world" 
> } 
>   } 
>
>   PLAY [test_01] 
>   ok: [test_01] => { 
> "hostvars.test_01.ansible_facts": { 
> "dummy_fact": "Hello world" 
> } 
>   } 
>   ok: [test_01] => { 
> "hostvars.test_01.ansible_facts": {} 
>   } 
>
> To make it reproducible test it without tower. HTH, 
>
> -vlado 
>

-- 
You received this message because you are 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/b643721a-2dca-4a41-8bff-6acc0b817c52%40googlegroups.com.


Re: [ansible-project] Ansible Tower and Facts

2020-01-31 Thread Vladimir Botka
On Fri, 31 Jan 2020 20:14:51 -0800 (PST)
Glen Collins  wrote:

> - name: Set facts
>   set_fact:
>dummy_fact: "Hello world"
>cacheable: yes
>   delegate_to: fake_host
>   delegate_facts: true
> 
> This sets the fact in the hostname fake_host just fine.
> [...]
> I have tried to target the playbook using host: fake_host but the playbook 
> run tells me the host is invalid or something to that effect.

This *can't* set the fact in the hostname fake_host just fine if the host
in not valid. The play 

  - hosts: all
tasks:
  - set_fact:
  dummy_fact: "Hello world"
  cacheable: yes
delegate_to: fake_host
delegate_facts: true
run_once: true
  - debug:
  var: hostvars.fake_host.ansible_facts
run_once: true


should report

"hostvars.fake_host.ansible_facts": "VARIABLE IS NOT DEFINED!"

> Can someone tell me if this is even possible to do? Possible to target
> directly?

If the host is valid. All works as expected. For example, the playbook
  
  - hosts: all
tasks:
  - set_fact:
  dummy_fact: "Hello world"
  cacheable: yes
delegate_to: test_01
delegate_facts: true
run_once: true
  - debug:
  var: hostvars.test_01.ansible_facts
run_once: true

  - hosts: test_01
tasks:
  - debug:
  var: hostvars.test_01.ansible_facts
  - meta: clear_facts
  - debug:
  var: hostvars.test_01.ansible_facts

gives

  PLAY [all]
  ok: [test_01] => {
"hostvars.test_01.ansible_facts": {
"dummy_fact": "Hello world"
}
  }

  PLAY [test_01]
  ok: [test_01] => {
"hostvars.test_01.ansible_facts": {
"dummy_fact": "Hello world"
}
  }
  ok: [test_01] => {
"hostvars.test_01.ansible_facts": {}
  }

To make it reproducible test it without tower. HTH,

-vlado

-- 
You received this message because you are 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/20200201072943.32bd43d9%40gmail.com.


pgpbXo9oaHKBU.pgp
Description: OpenPGP digital signature


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade

trying like this 

 with_items:
- "{{ dashboards_imported_from_latest_backup ~ 
'/Artifactory_Monitoring.json' }}"



On Saturday, February 1, 2020 at 11:24:05 AM UTC+5:30, Vishal Bobade wrote:
>
> HI kai,
>
> thanks for the response. however I am trying to use inside looping 
> with_items it isn't working.
>
>  "msg": "error : Can't load json file [Errno 2] No such file or directory: 
> '{\\'stderr_lines\\':
>
>
>
> On Saturday, February 1, 2020 at 12:57:57 AM UTC+5:30, Kai Stian Olstad 
> wrote:
>>
>> On 31.01.2020 18:17, Vishal Bobade wrote: 
>> > *Is it possible to concatenate like below?* 
>> > 
>> > - name: Retaining latest backup directory 
>> >   shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; 
>> > |tail -1 
>> >   register: import_back_up_dir 
>> > 
>> > - name: Import dashboard 
>> >   grafana_dashboard: 
>> > state: present 
>> > message: Updated by ansible 
>> > overwrite: no 
>> > path: "{{ item }}" 
>> >   with_items: 
>> >  - "{{ import_back_up_dir }} + SonarQube_Dashboard.json" 
>> > *>> I am trying to concatenate like this however this is not 
>> > working - 
>> > could some one please suggest how can we achieve this concatenation.* 
>>
>> Concatenate need to be done in inside of {{ }} and use tilde 
>>
>> "{{ import_back_up_dir ~ 'SonarQube_Dashboard.json' }}" 
>>
>> -- 
>> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a65c6e22-ba85-4873-978d-0a5710ee4002%40googlegroups.com.


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade
HI kai,

thanks for the response. however I am trying to use inside looping 
with_items it isn't working.

 "msg": "error : Can't load json file [Errno 2] No such file or directory: 
'{\\'stderr_lines\\':



On Saturday, February 1, 2020 at 12:57:57 AM UTC+5:30, Kai Stian Olstad 
wrote:
>
> On 31.01.2020 18:17, Vishal Bobade wrote: 
> > *Is it possible to concatenate like below?* 
> > 
> > - name: Retaining latest backup directory 
> >   shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; 
> > |tail -1 
> >   register: import_back_up_dir 
> > 
> > - name: Import dashboard 
> >   grafana_dashboard: 
> > state: present 
> > message: Updated by ansible 
> > overwrite: no 
> > path: "{{ item }}" 
> >   with_items: 
> >  - "{{ import_back_up_dir }} + SonarQube_Dashboard.json" 
> > *>> I am trying to concatenate like this however this is not 
> > working - 
> > could some one please suggest how can we achieve this concatenation.* 
>
> Concatenate need to be done in inside of {{ }} and use tilde 
>
> "{{ import_back_up_dir ~ 'SonarQube_Dashboard.json' }}" 
>
> -- 
> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6287a30e-8a13-45a7-8a15-453b2aa38839%40googlegroups.com.


[ansible-project] Ansible Tower and Facts

2020-01-31 Thread Glen Collins
Hello.

I am currently running my playbooks using Ansible Tower. I'm trying to 
work with facts as a method to store information that I can keep around 
until I want to get rid of it. Use it in multiple playbooks, etc. While I 
have it fully functional I'm wondering how I can clear the facts to that 
host in the inventory that's not a valid host. So here is what I do...


My hostname in tower is called: fake_host

I'm using the set_fact module and delegate_to function to set the facts in 
the fake_host hostname.

- name: Set facts
  set_fact:
   dummy_fact: "Hello world"
   cacheable: yes
  delegate_to: fake_host
  delegate_facts: true

This sets the fact in the hostname fake_host just fine. But if I want to 
clear the fact, I cannot because it's not targeted by the playbook. So 
it'll never clear the cache. The manner I tried is:

- name: clear fact cache
  meta: clear_facts
  delegate_to: fake_host

The meta tag does not obviously work with the delegate_to function since 
it's not clearing the facts.

I have tried to target the playbook using host: fake_host but the playbook 
run tells me the host is invalid or something to that effect. Can someone 
tell me if this is even possible to do? Possible to target directly?

If not, I'll have to find other ways to keep this information for usage in 
other playbooks. And while I can save the facts to a file, it's something 
I've decided not to do at this time.

Thanks.

Glen


-- 
You received this message because you are 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/41d23112-c20a-442c-aeaa-240d2f50c6a9%40googlegroups.com.


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Kai Stian Olstad

On 31.01.2020 18:17, Vishal Bobade wrote:

*Is it possible to concatenate like below?*

- name: Retaining latest backup directory
  shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; 
|tail -1

  register: import_back_up_dir

- name: Import dashboard
  grafana_dashboard:
state: present
message: Updated by ansible
overwrite: no
path: "{{ item }}"
  with_items:
 - "{{ import_back_up_dir }} + SonarQube_Dashboard.json"
*>> I am trying to concatenate like this however this is not 
working -

could some one please suggest how can we achieve this concatenation.*


Concatenate need to be done in inside of {{ }} and use tilde

"{{ import_back_up_dir ~ 'SonarQube_Dashboard.json' }}"

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9a4e528c63307a3763eeedbc027494af%40olstad.com.


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade
Thanks Stefan for looking into this. actually I want to import some grafana 
dashboards and I need to map this import_back_up_dir (which I cannot 
hardcode) to appropriate json files. so I want to find a way to concatenate 
these.

On Friday, January 31, 2020 at 11:56:45 PM UTC+5:30, Vishal Bobade wrote:
>
> Replied
>
> On Friday, January 31, 2020 at 11:07:36 PM UTC+5:30, Stefan Hornburg 
> (Racke) wrote:
>>
>> On 1/31/20 6:17 PM, Vishal Bobade wrote: 
>> > *_Is it possible to concatenate like below?_* 
>> > 
>> > - name: Retaining latest backup directory  
>> >   shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; 
>> |tail -1 
>> >   register: import_back_up_dir 
>> > 
>> > - name: Import dashboard 
>> >   grafana_dashboard: 
>> > state: present 
>> > message: Updated by ansible 
>> > overwrite: no 
>> > path: "{{ item }}" 
>> >   with_items: 
>> >  - "{{ import_back_up_dir }} + SonarQube_Dashboard.json"  
>>   _>> I am trying to concatenate like this however 
>> > this is not working - could some one please suggest how can we achieve 
>> this concatenation. 
>>
>> Maybe you give us the objective of your task first ... 
>>
>> Regards 
>>  Racke 
>> > _ 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> Groups "Ansible Project" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an email to 
>> > ansible...@googlegroups.com > ansible-project+unsubscr...@googlegroups.com>. 
>> > To view this discussion on the web visit 
>> > 
>> https://groups.google.com/d/msgid/ansible-project/98f66710-6fc0-4b1f-afdf-6190afab69c2%40googlegroups.com
>>  
>> > <
>> https://groups.google.com/d/msgid/ansible-project/98f66710-6fc0-4b1f-afdf-6190afab69c2%40googlegroups.com?utm_medium=email_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/d8605c75-f314-49a2-9545-713edecad681%40googlegroups.com.


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade
Replied

On Friday, January 31, 2020 at 11:07:36 PM UTC+5:30, Stefan Hornburg 
(Racke) wrote:
>
> On 1/31/20 6:17 PM, Vishal Bobade wrote: 
> > *_Is it possible to concatenate like below?_* 
> > 
> > - name: Retaining latest backup directory  
> >   shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; 
> |tail -1 
> >   register: import_back_up_dir 
> > 
> > - name: Import dashboard 
> >   grafana_dashboard: 
> > state: present 
> > message: Updated by ansible 
> > overwrite: no 
> > path: "{{ item }}" 
> >   with_items: 
> >  - "{{ import_back_up_dir }} + SonarQube_Dashboard.json"  
>   _>> I am trying to concatenate like this however 
> > this is not working - could some one please suggest how can we achieve 
> this concatenation. 
>
> Maybe you give us the objective of your task first ... 
>
> Regards 
>  Racke 
> > _ 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to 
> > ansible...@googlegroups.com   ansible-project+unsubscr...@googlegroups.com >. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/98f66710-6fc0-4b1f-afdf-6190afab69c2%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/ansible-project/98f66710-6fc0-4b1f-afdf-6190afab69c2%40googlegroups.com?utm_medium=email_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/e34eeb4d-c95d-4995-b5aa-2aea4143249c%40googlegroups.com.


[ansible-project] Re: Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade
Thanks Stefan for looking into this. actually I want to import some grafana 
dashboards and I need to map this import_back_up_dir (which I cannot 
hardcode) to appropriate json files. so I want to find a way to concatenate 
these.





On Friday, January 31, 2020 at 10:47:01 PM UTC+5:30, Vishal Bobade wrote:
>
> *Is it possible to concatenate like below?*
>
> - name: Retaining latest backup directory 
>   shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; |tail 
> -1
>   register: import_back_up_dir
>
> - name: Import dashboard
>   grafana_dashboard:
> state: present
> message: Updated by ansible
> overwrite: no
> path: "{{ item }}"
>   with_items:
>  - "{{ import_back_up_dir }} + SonarQube_Dashboard.json"
> *>> I am trying to concatenate like this however this is not working - 
> could some one please suggest how can we achieve this concatenation.*
>
>

-- 
You received this message because you are 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/abecac3f-691a-44ee-b15f-cf3a1ff7d603%40googlegroups.com.


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Stefan Hornburg (Racke)
On 1/31/20 6:17 PM, Vishal Bobade wrote:
> *_Is it possible to concatenate like below?_*
> 
>     - name: Retaining latest backup directory 
>       shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; |tail -1
>       register: import_back_up_dir
> 
>     - name: Import dashboard
>       grafana_dashboard:
>         state: present
>         message: Updated by ansible
>         overwrite: no
>         path: "{{ item }}"
>       with_items:
>          - "{{ import_back_up_dir }} + SonarQube_Dashboard.json"    _>> I 
> am trying to concatenate like this however
> this is not working - could some one please suggest how can we achieve this 
> concatenation.

Maybe you give us the objective of your task first ...

Regards
 Racke
> _
> 
> -- 
> You received this message because you are 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/98f66710-6fc0-4b1f-afdf-6190afab69c2%40googlegroups.com
> .


-- 
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/253cbec9-7f16-4995-06c8-f20de9fd9857%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade
*Is it possible to concatenate like below?*

- name: Retaining latest backup directory 
  shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; |tail -1
  register: import_back_up_dir

- name: Import dashboard
  grafana_dashboard:
state: present
message: Updated by ansible
overwrite: no
path: "{{ item }}"
  with_items:
 - "{{ import_back_up_dir }} + SonarQube_Dashboard.json"
*>> I am trying to concatenate like this however this is not working - 
could some one please suggest how can we achieve this concatenation.*

-- 
You received this message because you are 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/98f66710-6fc0-4b1f-afdf-6190afab69c2%40googlegroups.com.


[ansible-project] Re: please advise - Not generating logs after with ansible log_group

2020-01-31 Thread Work-Hard
If you have an example for the playbook and other config to log 
ansible-recap, please share

On Thursday, January 30, 2020 at 4:12:52 PM UTC-8, Work-Hard wrote:
>
> I am unable to generate logs with the playbook. Please advise?
>
> *ansible.cfg*
> [defaults]
> inventory = ./hosts
>
> [callback_log_plays]
> log_folder = /var/log/ansible/hosts
> env:ANSIBLE_LOG_FOLDER
>
>
> *host file *
> [windows]
> windows mach...@abc.com
>
> [windows:vars]
> ansible_connection = winrm
> ansible_ssh_port = 5986
> ansible_winrm_transport = kerberos
> ansible_winrm_server_cert_validation = ignore
> validate_certs = false
>
>

-- 
You received this message because you are 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/eb592c4f-2583-4828-8f27-9174184eec1c%40googlegroups.com.


Re: [ansible-project] Ansible Replace a value in a File

2020-01-31 Thread Dick Visser
Hi

Search and replacing of strings in XML tends to be very fragile, as
you experience.
Adding win_shell powershell and pipes will only make that worse.

If your desired changes allow, you should use the dedicated XML module:

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


On Fri, 31 Jan 2020 at 14:32, Sai Prasha  wrote:
>
> I am trying to Replace a String in an xml file . but using win_lineinfile 
> module only the last occurence of it is replaced
> how can i replace a String in all occurences .
> One Solution i found is tro run from powershell
> (Get-Content C:\Program Files\dd\config.xml).replace('ToReplace','replaced') 
> | Set-Content C:\Program Files\dd\config.xml
>
> But when i try to use the same powershell from playbook
> win_shell: (Get-Content C:\Program 
> Files\dd\config.xml).replace('ToReplace','sss') | Set-Content C:\Program 
> Files\dd\config.xml
>
> Its executing but chnages are not happening ., Any solutions please
>
> --
> You received this message because you are 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/97458bf6-691e-4407-ad0b-c7b962e79230%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
You received this message because you are 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/CAL8fbwPj9dv7yA7hqGFo9L_Ogxqh739jag-9Au03M2NuVbnZZw%40mail.gmail.com.


[ansible-project] Ansible Replace a value in a File

2020-01-31 Thread Sai Prasha
I am trying to Replace a String in an xml file . but using win_lineinfile 
module only the last occurence of it is replaced
how can i replace a String in all occurences .
One Solution i found is tro run from powershell
*(Get-Content C:\Program 
Files\dd\config.xml).replace('ToReplace','replaced') | Set-Content 
C:\Program Files\dd\config.xml*

But when i try to use the same powershell from playbook 
*win_shell: (Get-Content C:\Program 
Files\dd\config.xml).replace('ToReplace','sss') | Set-Content C:\Program 
Files\dd\config.xml *

Its executing but chnages are not happening ., Any solutions please

-- 
You received this message because you are 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/97458bf6-691e-4407-ad0b-c7b962e79230%40googlegroups.com.


Re: [ansible-project] Kerberos error

2020-01-31 Thread Dick Visser
"Name or service not known"

Means that your DNS resolution is not working.

On Thu, 30 Jan 2020 at 21:07, Work-Hard  wrote:
>
> I don;t know why i keep getting Kerberos error on every new machine, Any idea?
>
> HTTPSConnectionPool(host='workstation', port=5986): Max retries exceeded with 
> url: /wsman (Caused by 
> NewConnectionError(' 0x7f8e5a1fad90>: Failed to establish a new connection: [Errno -2] Name or 
> service not known',))",
> "unreachable": true
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/34548d9d-dc8f-43a8-9035-3344b439480b%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
You received this message because you are 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/CAL8fbwOTMuYf2YcGW7-f3a54tMcVn%2BoKZjRKo6mxq3yvzCdejg%40mail.gmail.com.


Re: [ansible-project] format List comparison ansible

2020-01-31 Thread Vladimir Botka
On Thu, 30 Jan 2020 20:20:53 -0800 (PST)
Pawan Kumar  wrote:

> > > 
> > > list1: 
> > >   - iam-python-common-1.0.0 
> > >   - iam-service-default-3.1.42 
> > >   - dp-steps-common-3.0.12 
> > > list2: 
> > >   - dp-steps-common-3.0.15-1911280809_d103a.noarch 
> > >   - iam-service-default-3.1.37-1911141021_63e48.noarch 
> > >   - iam-python-common-1.0.1-1910242116.noarch   

> >
> >  - debug: 
> >  msg: "{{ item.0 }} is not equal to {{ item.1 }}" 
> >loop: "{{ list1|sort|zip(list2|sort)|list }}" 
> >when: item.0.split('-')[-1] is not version(item.1.split('-')[-2]) 
> >
> > gives 
> >
> > "msg": "dp-steps-common-3.0.12 is not equal to 
> > dp-steps-common-3.0.15-1911280809_d103a.noarch" 
> > "msg": "iam-python-common-1.0.0 is not equal to 
> > iam-python-common-1.0.1-1910242116.noarch" 
> > "msg": "iam-service-default-3.1.42 is not equal to 
> > iam-service-default-3.1.37-1911141021_63e48.noarch" 

> Just for curiosity , would be please explain the steps in solution. 

Sure. The steps are self-explaining, I think.

1) See "zip"
https://docs.ansible.com/ansible/devel/user_guide/playbooks_filters.html#combining-items-from-multiple-lists-zip-and-zip-longest

 - debug:
 msg: "{{ item.0 }}
   {{ item.1 }}"
   loop: "{{ list1|sort|zip(list2|sort)|list }}"

gives

"msg": "dp-steps-common-3.0.12 
dp-steps-common-3.0.15-1911280809_d103a.noarch"
"msg": "iam-python-common-1.0.0 iam-python-common-1.0.1-1910242116.noarch"
"msg": "iam-service-default-3.1.42 
iam-service-default-3.1.37-1911141021_63e48.noarch"


2) See "split" and "Common Sequence Operations"
https://docs.python.org/3/library/stdtypes.html?highlight=split#str.split
https://docs.python.org/3/library/stdtypes.html?highlight=split#common-sequence-operations

 - debug:
 msg: "{{ item.0.split('-')[-1] }}
   {{ item.1.split('-')[-2] }}"
   loop: "{{ list1|sort|zip(list2|sort)|list }}"

gives

"msg": "3.0.12 3.0.15"
"msg": "1.0.0 1.0.1"
"msg": "3.1.42 3.1.37"


3) See "Version Comparison"
https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#version-comparison

HTH,

-vlado

-- 
You received this message because you are 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/20200131092004.54054cb4%40gmail.com.


pgp6p5rXtmlWB.pgp
Description: OpenPGP digital signature