[ansible-project] selecting file based on hostname

2020-07-10 Thread Krushna Chandra Sahu
Hi Team,

  I need a playbook to update the sudoer file based on os distribution. I 
have written below code but it is failing.

- name: Copy sudoers files
  copy:
src: files/{{ file_name }}
dest: /etc/sudoers
validate: /usr/sbin/visudo -csf %s
  {% if ansible_distribution == "amazon" %}
  file_name: 'sudoers.aspera'
  {% elif ansible_distribution == "Debian" %}
  file_name: 'sudoers.debian'
  {% else %}
  file_name: 'sudoers.general'
  {% end %}


The offending line appears to be:

validate: /usr/sbin/visudo -csf %s
  {% if ansible_distribution == "amazon" %}
   ^ here

Regards


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


Re: [ansible-project] selecting file based on hostname

2020-07-10 Thread Abhijeet Kasurde
Do as the following, which will make playbook readable

file_name: sudoers.general
tasks:
- name: Set file name when Amazon
set_fact:
file_name: "sudoers.aspera"
when: ansible_distribution == 'amazon'

- name: Set file name when Debian
set_fact:
file_name: "sudoers.debian"
when: ansible_distribution == 'Debian'

- debug:
msg: "{{ file_name }}"



On Fri, Jul 10, 2020 at 3:24 PM Krushna Chandra Sahu 
wrote:

> Hi Team,
>
>   I need a playbook to update the sudoer file based on os distribution. I
> have written below code but it is failing.
>
> - name: Copy sudoers files
>   copy:
> src: files/{{ file_name }}
> dest: /etc/sudoers
> validate: /usr/sbin/visudo -csf %s
>   {% if ansible_distribution == "amazon" %}
>   file_name: 'sudoers.aspera'
>   {% elif ansible_distribution == "Debian" %}
>   file_name: 'sudoers.debian'
>   {% else %}
>   file_name: 'sudoers.general'
>   {% end %}
>
>
> The offending line appears to be:
>
> validate: /usr/sbin/visudo -csf %s
>   {% if ansible_distribution == "amazon" %}
>^ here
>
> Regards
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5b6297e0-ffb1-4724-8cd9-4bb2975e2dd0o%40googlegroups.com
> 
> .
>


-- 
Thanks,
Abhijeet Kasurde

-- 
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/CAFwWkHpr%3DTyYUcnZvE5NutNTsbF72gx%2B03%3DOpgMHMtkPp%3DEN2g%40mail.gmail.com.


Re: [ansible-project] selecting file based on hostname

2020-07-10 Thread Abhijeet Kasurde
This is also possible

vars:
file_name_mapping:
amazon: "sudoers.general"
debian: "sudoers.debian"
tasks:
- debug:
msg: "{{ file_name_mapping[ansible_distribution] |
default('sudoers.general')}}"

On Fri, Jul 10, 2020 at 4:13 PM Abhijeet Kasurde 
wrote:

> Do as the following, which will make playbook readable
>
> file_name: sudoers.general
> tasks:
> - name: Set file name when Amazon
> set_fact:
> file_name: "sudoers.aspera"
> when: ansible_distribution == 'amazon'
>
> - name: Set file name when Debian
> set_fact:
> file_name: "sudoers.debian"
> when: ansible_distribution == 'Debian'
>
> - debug:
> msg: "{{ file_name }}"
>
>
>
> On Fri, Jul 10, 2020 at 3:24 PM Krushna Chandra Sahu <
> mailkrus...@gmail.com> wrote:
>
>> Hi Team,
>>
>>   I need a playbook to update the sudoer file based on os distribution. I
>> have written below code but it is failing.
>>
>> - name: Copy sudoers files
>>   copy:
>> src: files/{{ file_name }}
>> dest: /etc/sudoers
>> validate: /usr/sbin/visudo -csf %s
>>   {% if ansible_distribution == "amazon" %}
>>   file_name: 'sudoers.aspera'
>>   {% elif ansible_distribution == "Debian" %}
>>   file_name: 'sudoers.debian'
>>   {% else %}
>>   file_name: 'sudoers.general'
>>   {% end %}
>>
>>
>> The offending line appears to be:
>>
>> validate: /usr/sbin/visudo -csf %s
>>   {% if ansible_distribution == "amazon" %}
>>^ here
>>
>> Regards
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ansible-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/5b6297e0-ffb1-4724-8cd9-4bb2975e2dd0o%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Thanks,
> Abhijeet Kasurde
>


-- 
Thanks,
Abhijeet Kasurde

-- 
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/CAFwWkHp4Rz_Ua-6Tz_DNbqPcePH33T376Nj-zNktHn2Osu0ZOQ%40mail.gmail.com.


[ansible-project] Need help with registered variable

2020-07-10 Thread Rahul Kumar
I have a task output like this:
- name: Print Response of status resource
  debug:
msg: " {{ result }}"

ok: [node-3] => {
"msg": " {'msg': u'All items completed', 'changed': False, 'results':
[{'ansible_loop_var': u'item', 'failed': False, 'changed': False,
u'content': {u'body': None, u'node': u'node-3', u'allServicesLocked': True,
u'appServer': u'1', u'type': u'iMIME', u'data': True,]} "
}

But when i try to access like that in some task, it does not work:
until : result['results'].data == True   , it complains saying dict does
not have results attribute !
Here result is my registered variable. As per above response , it should
work fine ?

-- 
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/CAGH8rEyOHqmrA7diB3AznLqRncRaj_r539gA5-oZpkEwMrzwCA%40mail.gmail.com.


Re: [ansible-project] Need help with registered variable

2020-07-10 Thread Abhijeet Kasurde
'data' is inside 'content' you might want to check around that


On Fri, Jul 10, 2020 at 5:24 PM Rahul Kumar  wrote:

> I have a task output like this:
> - name: Print Response of status resource
>   debug:
> msg: " {{ result }}"
>
> ok: [node-3] => {
> "msg": " {'msg': u'All items completed', 'changed': False, 'results':
> [{'ansible_loop_var': u'item', 'failed': False, 'changed': False,
> u'content': {u'body': None, u'node': u'node-3', u'allServicesLocked': True,
> u'appServer': u'1', u'type': u'iMIME', u'data': True,]} "
> }
>
> But when i try to access like that in some task, it does not work:
> until : result['results'].data == True   , it complains saying dict does
> not have results attribute !
> Here result is my registered variable. As per above response , it should
> work fine ?
>
>
> --
> 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/CAGH8rEyOHqmrA7diB3AznLqRncRaj_r539gA5-oZpkEwMrzwCA%40mail.gmail.com
> 
> .
>


-- 
Thanks,
Abhijeet Kasurde

-- 
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/CAFwWkHpb0WcE8jKLcPsM2i1mzA_PX%2BGBRF7Jtefqtmp4wFC6Sw%40mail.gmail.com.


[ansible-project] jinja2 template error in ansible

2020-07-10 Thread Pradeep Ghorpade
Hello, I am searching which packages are available to install on windows 
using win_update module. for example I am getting 3 package name.

I want print them like below.

  ServerNamePatch 
Details
   serverA 2019-08 Security Only Quality Update for 
Windows Server 2012 R2 for x64-based Systems (KB4512489)
   serverA  2020-06 Security Monthly Quality Rollup for 
Windows Server 2012 R2 for x64-based Systems (KB4561666)
   serverA  2019-07 Security Only Quality Update for 
Windows Server 2012 R2 for x64-based Systems (KB4507457)
 
i am using below template.


--


Server Name
Patch Title




{% for (list_of_updates.updates| length) %} {{ inventory_hostname }} {% 
endfor %}



{% for win_update in list_of_updates.updates | dict2items %}
{{ win_update.value.title }}
{% endfor %}




Can you help me to get 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2e77d6b1-eb56-4f74-889a-28634c0beb45o%40googlegroups.com.


Re: [ansible-project] Re: Using lineinfile to append items to the END of a line

2020-07-10 Thread Karn Gusain


I have an Ansible playbook where I need to change the Server Name in one 
line and an Specific IP address in another line, as in this line there are 
a bunch of IP address separated by a comma.

I have the below play which works absolutely fine in case I have to change 
the entire IP address line with the defined set of IP addresses, But I'm 
looking for specific IP address i.e. 191.168.1.4 to be looked upon and if 
found then just replace that only and leave the rest of the IP as it is.
--- - name: Playbook to replace line in zabbix_agentd.conf hosts: all 
#remote_user: root gather_facts: False tasks: - name: Changing the 
zabbix-agent configuration on the client lineinfile: path: 
/tmp/zabbix_agentd.conf ### line to be searched & matched regexp: '{{ 
item.From }}' ### new line to be replaced with the old matched one line: 
'{{ item.To }}' state: present backup: yes backrefs: yes with_items: - { 
From: '#ServerActive=myzabbix1.example.com', To: 
'ServerActive=myzabbix2.example.com'} - { From: 
'Server=192.168.1.1,192.168.1.2,192.168.1.3,192.168.1.4,192.168.1.5', To: 
'Server=192.168.1.1,192.168.1.2,192.168.1.3,192.168.1.10,192.168.1.5'} # 
Actions will be triggered at the end of each block of task and notifies a 
handler. notify: restart_zabbix_service handlers: - name: 
restart_zabbix_service # referenced by a globally unique name and are 
notified by notifiers. service: name: zabbix-agentd state: restarted  

On Thursday, September 12, 2019 at 7:38:32 PM UTC+5:30 philipp...@gmail.com 
wrote:

> not idempotent when the list ordering change, plus some others
>  
> for each item in the list you have to add it if not already there 
> (requires a look-ahead expression in regex)
> that is what make it quite complex at the end, but doable as long as
> per the spec the only need is to append to an existing list.
>
> hence the idea to leverage the template module
> that also can deal with removal of item from the list
>
> --
> Phil
>
>
> Le jeu. 12 sept. 2019 à 12:27, Dick Visser  a écrit :
>
>> This will work, but it's not idempotent.
>> So if you run it again it will add the two CIDRs again.
>> For it to work idempotently, the regex will need to match both what
>> you have before and what you get after.
>> Something like this should work:
>>
>>
>> ---
>> - hosts: localhost
>>   connection: local
>>   gather_facts: false
>>   vars:
>> cidrs:
>>   - 1.1.1.1/255.255.255.255
>>   - 2.2.2.2/255.255.255.255
>>
>>   tasks:
>>  - name: "insert values to a list"
>>lineinfile:
>>dest: /tmp/test.txt
>>regexp: "^(?PALL:.*?)((,{{ cidrs | join(',') }})*)$"
>>line: "\\g,{{ cidrs | join(',') }}"
>>backrefs: yes
>>
>>
>> The named group 'start' is to avoid clashing with a CIDR that begins
>> with a number.
>>
>>
>> Dick
>>
>>
>>
>> On Thu, 12 Sep 2019 at 09:15, Shivharsh Singh  
>> wrote:
>> >
>> > Hello Morrissey,
>> >
>> > You may use the below playbook to fulfill your requirements. It makes 
>> use of lineinfile module with regular expression to capture the line to be 
>> modified.
>> >
>> > ---
>> > - hosts: localhost
>> >   connection: local
>> >   gather_facts: false
>> >   tasks:
>> >  - name: "insert values to a list"
>> >lineinfile:
>> >dest: /opt/test.txt
>> >regexp: '(^ALL.*$)'
>> >line: '\1, {{item}}'
>> >backrefs: yes
>> >with_items:
>> >- 1.1.1.1/255.255.255.255
>> >- 2.2.2.2/255.255.255.255
>> >
>> > The file would be modified as shown below:
>> > Hello world !
>> > ALL, 1.1.1.1/255.255.255.255, 2.2.2.2/255.255.255.255
>> > This is a test file
>> >
>> > Hope this is helpful !
>> >
>> > Thanks,
>> > Shivharsh
>> >
>> > On Wednesday, 11 September 2019 19:36:27 UTC+5:30, TheSmiths wrote:
>> >>
>> >> Hi,
>> >>
>> >> I would like to use lineinfile module to do the next:
>> >>
>> >> 1. go over list of items (with_items)
>> >> 2. look for specific line that always starts with the word "ALL:"  
>> (hosts.allow)
>> >> 3. append each item at the END of the line with comma before the item
>> >>
>> >> for example
>> >>
>> >> ALL ,1.1.1.1/255.255.255.255 , 2.2.2.2/255.255.255.255
>> >>
>> >> Thanks,
>> >> Morrissey
>> >>
>> >>
>> > --
>> > 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/acbe7f26-fea5-403b-92f3-b8e2c1506b1a%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-proje...@googlegroups.com.
>>
> To view this

Re: [ansible-project] Re: Using lineinfile to append items to the END of a line

2020-07-10 Thread Karn Gusain
I have an Ansible playbook where I need to change the Server Name in one 
line and an Specific IP address in another line, as in this line there are 
a bunch of IP address separated by a comma.

I have the below play which works absolutely fine in case I have to change 
the entire IP address line with the defined set of IP addresses, But I'm 
looking for specific IP address i.e. 191.168.1.4 to be looked upon and if 
found then just replace that only and leave the rest of the IP as it is.
Below is the Playbook...



Below is  just the with_items section which is not visible in the above..

with_items: 
  - { From: '#ServerActive=myzabbix1.example.com', To: 
'ServerActive=myzabbix2.example.com'} 
  - { From: 
'Server=192.168.1.1,192.168.1.2,192.168.1.3,192.168.1.4,192.168.1.5', To: 
'Server=192.168.1.1,192.168.1.2,192.168.1.3,192.168.1.10,192.168.1.5'} 
  
 
I am looking for a regex to match `192.168.1.4` and replace it with 
`192.168.1.10`.

On Thursday, September 12, 2019 at 7:38:32 PM UTC+5:30 philipp...@gmail.com 
wrote:

> not idempotent when the list ordering change, plus some others
>  
> for each item in the list you have to add it if not already there 
> (requires a look-ahead expression in regex)
> that is what make it quite complex at the end, but doable as long as
> per the spec the only need is to append to an existing list.
>
> hence the idea to leverage the template module
> that also can deal with removal of item from the list
>
> --
> Phil
>
>
> Le jeu. 12 sept. 2019 à 12:27, Dick Visser  a écrit :
>
>> This will work, but it's not idempotent.
>> So if you run it again it will add the two CIDRs again.
>> For it to work idempotently, the regex will need to match both what
>> you have before and what you get after.
>> Something like this should work:
>>
>>
>> ---
>> - hosts: localhost
>>   connection: local
>>   gather_facts: false
>>   vars:
>> cidrs:
>>   - 1.1.1.1/255.255.255.255
>>   - 2.2.2.2/255.255.255.255
>>
>>   tasks:
>>  - name: "insert values to a list"
>>lineinfile:
>>dest: /tmp/test.txt
>>regexp: "^(?PALL:.*?)((,{{ cidrs | join(',') }})*)$"
>>line: "\\g,{{ cidrs | join(',') }}"
>>backrefs: yes
>>
>>
>> The named group 'start' is to avoid clashing with a CIDR that begins
>> with a number.
>>
>>
>> Dick
>>
>>
>>
>> On Thu, 12 Sep 2019 at 09:15, Shivharsh Singh  
>> wrote:
>> >
>> > Hello Morrissey,
>> >
>> > You may use the below playbook to fulfill your requirements. It makes 
>> use of lineinfile module with regular expression to capture the line to be 
>> modified.
>> >
>> > ---
>> > - hosts: localhost
>> >   connection: local
>> >   gather_facts: false
>> >   tasks:
>> >  - name: "insert values to a list"
>> >lineinfile:
>> >dest: /opt/test.txt
>> >regexp: '(^ALL.*$)'
>> >line: '\1, {{item}}'
>> >backrefs: yes
>> >with_items:
>> >- 1.1.1.1/255.255.255.255
>> >- 2.2.2.2/255.255.255.255
>> >
>> > The file would be modified as shown below:
>> > Hello world !
>> > ALL, 1.1.1.1/255.255.255.255, 2.2.2.2/255.255.255.255
>> > This is a test file
>> >
>> > Hope this is helpful !
>> >
>> > Thanks,
>> > Shivharsh
>> >
>> > On Wednesday, 11 September 2019 19:36:27 UTC+5:30, TheSmiths wrote:
>> >>
>> >> Hi,
>> >>
>> >> I would like to use lineinfile module to do the next:
>> >>
>> >> 1. go over list of items (with_items)
>> >> 2. look for specific line that always starts with the word "ALL:"  
>> (hosts.allow)
>> >> 3. append each item at the END of the line with comma before the item
>> >>
>> >> for example
>> >>
>> >> ALL ,1.1.1.1/255.255.255.255 , 2.2.2.2/255.255.255.255
>> >>
>> >> Thanks,
>> >> Morrissey
>> >>
>> >>
>> > --
>> > 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/acbe7f26-fea5-403b-92f3-b8e2c1506b1a%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-proje...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwOCE8wrZa0gdhgzB4fiNk5QuihfUxnLTFp0WgA0_UXQLg%40mail.gmail.com
>> .
>>
>

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

[ansible-project] Ansible regex to search and replace an IP Address in a line

2020-07-10 Thread Karn Gusain


I have an Ansible playbook where I need to change the Server Name in one 
line and an Specific IP address in another line, as in this line there are 
a bunch of IP address separated by a comma.

I have the below play which works absolutely fine in case I have to change 
the entire IP address line with the defined set of IP addresses, But I'm 
looking for specific IP address i.e. 191.168.1.4 to be looked upon and if 
found then just replace that only and leave the rest of the IP as it is.

Below is the Playbook..


In case below section not visible in above..

with_items:
  - { From: '#ServerActive=myzabbix1.example.com', To: 
'ServerActive=myzabbix2.example.com'}

   - { From: 
'Server=192.168.1.1,192.168.1.2,192.168.1.3,192.168.1.4,192.168.1.5', To: 
'Server=192.168.1.1,192.168.1.2,192.168.1.3,192.168.1.10,192.168.1.5'} 


-- 
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/1e5b3efb-2885-4b15-89ed-6ce2cd45ccbcn%40googlegroups.com.


[ansible-project] Re: Ansible regex to search and replace an IP Address in a line

2020-07-10 Thread Karn Gusain

I see the attachment is missing for the playbook section hence pasting it 
here again..

---
- name: Playbook to replace line in zabbix_agentd.conf
  hosts: all
  #remote_user: root
  gather_facts: False

  tasks:
  - name: Changing the zabbix-agent configuration on the client
lineinfile:
  path: /tmp/zabbix_agentd.conf
  ### line to be searched & matched
  regexp: '{{ item.From }}'
  ### new line to be replaced with the old matched one
  line: '{{ item.To }}'
  state: present
  backup: yes
  backrefs: yes

with_items:
- { From: '#ServerActive=myzabbix1.example.com', To: 
'ServerActive=myzabbix2.example.com'}
- { From: 
'Server=192.168.1.1,192.168.1.2,192.168.1.3,192.168.1.4,192.168.1.5', To: 
'Server=192.168.1.1,192.168.1.2,192.168.1.3,192.168.1.10,192.168.1.5'}
# Actions will be triggered at the end of each block of task and 
notifies a handler.
notify: restart_zabbix_service

  handlers:
  - name: restart_zabbix_service
# referenced by a globally unique name and are notified by notifiers.
service:
  name: zabbix-agentd
  state: restarted

On Friday, July 10, 2020 at 7:45:56 PM UTC+5:30 Karn Gusain wrote:

> I have an Ansible playbook where I need to change the Server Name in one 
> line and an Specific IP address in another line, as in this line there are 
> a bunch of IP address separated by a comma.
>
> I have the below play which works absolutely fine in case I have to change 
> the entire IP address line with the defined set of IP addresses, But I'm 
> looking for specific IP address i.e. 191.168.1.4 to be looked upon and if 
> found then just replace that only and leave the rest of the IP as it is.
>
> Below is the Playbook..
>
>
> In case below section not visible in above..
>
> with_items:
>   - { From: '#ServerActive=myzabbix1.example.com', To: 'ServerActive=
> myzabbix2.example.com'}
>
>- { From: 
> 'Server=192.168.1.1,192.168.1.2,192.168.1.3,192.168.1.4,192.168.1.5', To: 
> 'Server=192.168.1.1,192.168.1.2,192.168.1.3,192.168.1.10,192.168.1.5'} 
>
>
>

-- 
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/378fad87-f0ed-4649-8b6c-348ca2ba77c6n%40googlegroups.com.


Re: [ansible-project] Need help with registered variable

2020-07-10 Thread Rahul Kumar
Thanks Abhijeet ! I tried even result[‘results’][0].content.data but still
it complains results is not dict attribute !

On Fri, 10 Jul 2020 at 5:32 PM, Abhijeet Kasurde 
wrote:

> 'data' is inside 'content' you might want to check around that
>
>
> On Fri, Jul 10, 2020 at 5:24 PM Rahul Kumar 
> wrote:
>
>> I have a task output like this:
>> - name: Print Response of status resource
>>   debug:
>> msg: " {{ result }}"
>>
>> ok: [node-3] => {
>> "msg": " {'msg': u'All items completed', 'changed': False, 'results':
>> [{'ansible_loop_var': u'item', 'failed': False, 'changed': False,
>> u'content': {u'body': None, u'node': u'node-3', u'allServicesLocked': True,
>> u'appServer': u'1', u'type': u'iMIME', u'data': True,]} "
>> }
>>
>> But when i try to access like that in some task, it does not work:
>> until : result['results'].data == True   , it complains saying dict does
>> not have results attribute !
>> Here result is my registered variable. As per above response , it should
>> work fine ?
>>
>>
>> --
>> 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/CAGH8rEyOHqmrA7diB3AznLqRncRaj_r539gA5-oZpkEwMrzwCA%40mail.gmail.com
>> 
>> .
>
>
>>
>
> --
> Thanks,
> Abhijeet Kasurde
>
> --
> 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/CAFwWkHpb0WcE8jKLcPsM2i1mzA_PX%2BGBRF7Jtefqtmp4wFC6Sw%40mail.gmail.com
> 
> .
>

-- 
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/CAGH8rEwgRWxNLYf1WaxNyqb7e0gmEDyC4nMZnw_0wwUJa32_ew%40mail.gmail.com.


Re: [ansible-project] Need help with registered variable

2020-07-10 Thread Srinivas Naram
Try by removing  quotes

result[results][0].content.data

On Fri, Jul 10, 2020 at 8:04 PM Rahul Kumar  wrote:

> Thanks Abhijeet ! I tried even result[‘results’][0].content.data but still
> it complains results is not dict attribute !
>
> On Fri, 10 Jul 2020 at 5:32 PM, Abhijeet Kasurde 
> wrote:
>
>> 'data' is inside 'content' you might want to check around that
>>
>>
>> On Fri, Jul 10, 2020 at 5:24 PM Rahul Kumar 
>> wrote:
>>
>>> I have a task output like this:
>>> - name: Print Response of status resource
>>>   debug:
>>> msg: " {{ result }}"
>>>
>>> ok: [node-3] => {
>>> "msg": " {'msg': u'All items completed', 'changed': False,
>>> 'results': [{'ansible_loop_var': u'item', 'failed': False, 'changed':
>>> False, u'content': {u'body': None, u'node': u'node-3',
>>> u'allServicesLocked': True, u'appServer': u'1', u'type': u'iMIME', u'data':
>>> True,]} "
>>> }
>>>
>>> But when i try to access like that in some task, it does not work:
>>> until : result['results'].data == True   , it complains saying dict does
>>> not have results attribute !
>>> Here result is my registered variable. As per above response , it should
>>> work fine ?
>>>
>>>
>>> --
>>> 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/CAGH8rEyOHqmrA7diB3AznLqRncRaj_r539gA5-oZpkEwMrzwCA%40mail.gmail.com
>>> 
>>> .
>>
>>
>>>
>>
>> --
>> Thanks,
>> Abhijeet Kasurde
>>
>> --
>> 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/CAFwWkHpb0WcE8jKLcPsM2i1mzA_PX%2BGBRF7Jtefqtmp4wFC6Sw%40mail.gmail.com
>> 
>> .
>>
> --
> 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/CAGH8rEwgRWxNLYf1WaxNyqb7e0gmEDyC4nMZnw_0wwUJa32_ew%40mail.gmail.com
> 
> .
>

-- 
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/CAG-N3P7fK4PGzb7OKmfSyvsSB9tLSmipVNLoPW%3DPdfe7EwGzTA%40mail.gmail.com.


[ansible-project] Re: pywinrm, winrm, ansible - no go

2020-07-10 Thread Eric Holzapfel
Hello And Thanks for reply,

I will try this PIP command (again) but I do not have an RH subscription. 

Also a new symptom, I can run a python program that imports winrm, but I 
get an error "no winrm" if I try
to run the program as a regular user. If I run it as sudo - the python 
program runs, no errors and returns the command from the windows machine.
I was running the "ifconfig /all" .  So as sudo, and running a python 
program that imports winrm, I can access the windows box.

If I try a basic command line progarm "ansible windows -i hosts -m 
win_ping" as a regular user or as sudo I get the same error:
"no winrm or request module available" What does ansible need to find 
winrm??? Supposedly I have pywinrm installed but cannot
access it.

On Wednesday, July 8, 2020 at 3:34:35 PM UTC-7, ameya agashe wrote:
>
> Try this,
>
> pip install pywinrm==0.2.2
> If you have RHEL subscription, check this link too
> k this page too
> https://access.redhat.com/solutions/4459791
>
> Cheers
> Ameya Agashe
>
> On Thursday, 9 July 2020 07:42:32 UTC+10, Eric Holzapfel wrote:
>>
>> I have a Redhat Linux server RH7.8 
>>
>> It is running AWX no problem and Ansible no problem as far as LINUX 
>> servers are concerned.
>>
>> I am trying to communicate to a w2k16 server via winrm from my linux 
>> server.
>> The linux box has python3, and pip3 and supposedly pywinrm is installed.
>>
>> The windows box appears to be setup correctly to listen for winrm 
>> requests.
>> When I try to run  "sudo ansible -i inventory windows -m win_ping" I get 
>> the error that everyone else gets:
>> 10.125.8.56 | FAILED! => {
>> "msg": "winrm or requests is not installed: No module named winrm"
>>
>> If I check installed packages for requests - it say dependencies are met. 
>> It also say that pywinrm dependencies are met.
>> What does it take to get the winrm module to be found by python?
>>
>> Thanks
>>
>> ewholz
>>
>
> On Thursday, 9 July 2020 07:42:32 UTC+10, Eric Holzapfel wrote:
>>
>> I have a Redhat Linux server RH7.8 
>>
>> It is running AWX no problem and Ansible no problem as far as LINUX 
>> servers are concerned.
>>
>> I am trying to communicate to a w2k16 server via winrm from my linux 
>> server.
>> The linux box has python3, and pip3 and supposedly pywinrm is installed.
>>
>> The windows box appears to be setup correctly to listen for winrm 
>> requests.
>> When I try to run  "sudo ansible -i inventory windows -m win_ping" I get 
>> the error that everyone else gets:
>> 10.125.8.56 | FAILED! => {
>> "msg": "winrm or requests is not installed: No module named winrm"
>>
>> If I check installed packages for requests - it say dependencies are met. 
>> It also say that pywinrm dependencies are met.
>> What does it take to get the winrm module to be found by python?
>>
>> Thanks
>>
>> ewholz
>>
>

-- 
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/74deafb5-381a-43a5-8b24-8dee79c7b527o%40googlegroups.com.


[ansible-project] Using Ansible Collections in molecule test

2020-07-10 Thread ksam...@redhat.com
I am trying to use Ansible collections with my molecule test 

molecule.yml

```
---
dependency:
name: galaxy
options:
requirements-file: molecule/common/requirements.yml
driver:
name: delegated
options:
managed: False
ansible_connection_options:
ansible_connection: local
lint: |
set -e
yamllint .
platforms:
- name: molecule-kind-ingress
provisioner:
name: ansible
verifier:
name: ansible
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
```

With my converge.yml 

```
---
- name: Converge
hosts: localhost
connection: local

collections:
- community.kubernetes

vars:
ansible_python_interpreter: '{{ ansible_playbook_python }}'
cluster_name: molecule-ingress
kind_home_dir: "/tmp/kind_test"
deploy_ingress: True

roles:
- role: kameshsampath.kind
```

When running the test molecule is not picking up my collection, eventually 
resulting in a playbook error like:

```
fatal: [localhost]: FAILED! => {
"reason": "couldn't resolve module/action 'helm_repository'. This often 
indicates a misspelling, missing collection, or incorrect module 
path.\n\nThe error appears to be in 
'/Users/kameshs/git/kameshsampath/kameshsampath.kind/tasks/ingress.yml': 
line 2, 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: Add 
stable chart Repo\n  ^ here\n"
}
```

my requirements.yml does have the following entry 

```
---
collections:
- community.kubernetes
```

I am not sure if I am missing anything 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1f2320e3-e0ff-41eb-ad27-234e467adeadn%40googlegroups.com.


Re: [ansible-project] Using Ansible Collections in molecule test

2020-07-10 Thread Abhijeet Kasurde
Hi,

Could you please provide `ansible-galaxy collection list` output?
helm_repository is added in Kubernetes collection 0.11.0. If your version
Kubernetes collection is less than this then you need to update.


On Sat, Jul 11, 2020 at 8:51 AM ksam...@redhat.com 
wrote:

> I am trying to use Ansible collections with my molecule test
>
> molecule.yml
>
> ```
> ---
> dependency:
> name: galaxy
> options:
> requirements-file: molecule/common/requirements.yml
> driver:
> name: delegated
> options:
> managed: False
> ansible_connection_options:
> ansible_connection: local
> lint: |
> set -e
> yamllint .
> platforms:
> - name: molecule-kind-ingress
> provisioner:
> name: ansible
> verifier:
> name: ansible
> playbooks:
> converge: ${MOLECULE_PLAYBOOK:-converge.yml}
> ```
>
> With my converge.yml
>
> ```
> ---
> - name: Converge
> hosts: localhost
> connection: local
>
> collections:
> - community.kubernetes
>
> vars:
> ansible_python_interpreter: '{{ ansible_playbook_python }}'
> cluster_name: molecule-ingress
> kind_home_dir: "/tmp/kind_test"
> deploy_ingress: True
>
> roles:
> - role: kameshsampath.kind
> ```
>
> When running the test molecule is not picking up my collection, eventually
> resulting in a playbook error like:
>
> ```
> fatal: [localhost]: FAILED! => {
> "reason": "couldn't resolve module/action 'helm_repository'. This
> often indicates a misspelling, missing collection, or incorrect module
> path.\n\nThe error appears to be in
> '/Users/kameshs/git/kameshsampath/kameshsampath.kind/tasks/ingress.yml':
> line 2, 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: Add
> stable chart Repo\n  ^ here\n"
> }
> ```
>
> my requirements.yml does have the following entry
>
> ```
> ---
> collections:
> - community.kubernetes
> ```
>
> I am not sure if I am missing anything 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/1f2320e3-e0ff-41eb-ad27-234e467adeadn%40googlegroups.com
> 
> .
>


-- 
Thanks,
Abhijeet Kasurde

-- 
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/CAFwWkHqPvnL2BeV_1fp7Cus6zCSNxN_PON7Xg3rZ-mjmfpPDsg%40mail.gmail.com.


[ansible-project] Re: pywinrm, winrm, ansible - no go

2020-07-10 Thread ameya agashe
You do need an RH subscription if you want to use RHEL, else go for CentOS.




On Saturday, 11 July 2020 05:07:12 UTC+10, Eric Holzapfel wrote:
>
> Hello And Thanks for reply,
>
> I will try this PIP command (again) but I do not have an RH subscription. 
>
> Also a new symptom, I can run a python program that imports winrm, but I 
> get an error "no winrm" if I try
> to run the program as a regular user. If I run it as sudo - the python 
> program runs, no errors and returns the command from the windows machine.
> I was running the "ifconfig /all" .  So as sudo, and running a python 
> program that imports winrm, I can access the windows box.
>
> If I try a basic command line progarm "ansible windows -i hosts -m 
> win_ping" as a regular user or as sudo I get the same error:
> "no winrm or request module available" What does ansible need to find 
> winrm??? Supposedly I have pywinrm installed but cannot
> access it.
>
> On Wednesday, July 8, 2020 at 3:34:35 PM UTC-7, ameya agashe wrote:
>>
>> Try this,
>>
>> pip install pywinrm==0.2.2
>> If you have RHEL subscription, check this link too
>> k this page too
>> https://access.redhat.com/solutions/4459791
>>
>> Cheers
>> Ameya Agashe
>>
>> On Thursday, 9 July 2020 07:42:32 UTC+10, Eric Holzapfel wrote:
>>>
>>> I have a Redhat Linux server RH7.8 
>>>
>>> It is running AWX no problem and Ansible no problem as far as LINUX 
>>> servers are concerned.
>>>
>>> I am trying to communicate to a w2k16 server via winrm from my linux 
>>> server.
>>> The linux box has python3, and pip3 and supposedly pywinrm is installed.
>>>
>>> The windows box appears to be setup correctly to listen for winrm 
>>> requests.
>>> When I try to run  "sudo ansible -i inventory windows -m win_ping" I get 
>>> the error that everyone else gets:
>>> 10.125.8.56 | FAILED! => {
>>> "msg": "winrm or requests is not installed: No module named winrm"
>>>
>>> If I check installed packages for requests - it say dependencies are 
>>> met. 
>>> It also say that pywinrm dependencies are met.
>>> What does it take to get the winrm module to be found by python?
>>>
>>> Thanks
>>>
>>> ewholz
>>>
>>
>> On Thursday, 9 July 2020 07:42:32 UTC+10, Eric Holzapfel wrote:
>>>
>>> I have a Redhat Linux server RH7.8 
>>>
>>> It is running AWX no problem and Ansible no problem as far as LINUX 
>>> servers are concerned.
>>>
>>> I am trying to communicate to a w2k16 server via winrm from my linux 
>>> server.
>>> The linux box has python3, and pip3 and supposedly pywinrm is installed.
>>>
>>> The windows box appears to be setup correctly to listen for winrm 
>>> requests.
>>> When I try to run  "sudo ansible -i inventory windows -m win_ping" I get 
>>> the error that everyone else gets:
>>> 10.125.8.56 | FAILED! => {
>>> "msg": "winrm or requests is not installed: No module named winrm"
>>>
>>> If I check installed packages for requests - it say dependencies are 
>>> met. 
>>> It also say that pywinrm dependencies are met.
>>> What does it take to get the winrm module to be found by python?
>>>
>>> Thanks
>>>
>>> ewholz
>>>
>>

-- 
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/18fd7184-dbba-4c81-94c1-605497c13577o%40googlegroups.com.


Re: [ansible-project] Using Ansible Collections in molecule test

2020-07-10 Thread kameshs
I don't see a `ansible-galaxy collection list ` command but this is what I 
see with debug at start of `molecule test`


```
ANSIBLE_COLLECTIONS_PATHS=/Users/kameshs/.cache/molecule/kameshsampath.kind/deploy_ingress/collections:
 
...
```

and during dependency step of the scenario I see the output like 

```
 ...
Reading requirement file at 
'/Users/kameshs/git/kameshsampath/kameshsampath.kind/molecule/common/requirements.yml'
Process install dependency map
Opened /Users/kameshs/.ansible/galaxy_token
Processing requirement collection 'community.kubernetes'
Collection 'community.kubernetes' obtained from server default 
https://galaxy.ansible.com/api/
Starting collection install process
Installing 'community.kubernetes:0.11.1' to 
'/Users/kameshs/.cache/molecule/kameshsampath.kind/deploy_ingress/collections/ansible_collections/community/kubernetes'
Downloading 
https://galaxy.ansible.com/download/community-kubernetes-0.11.1.tar.gz to 
/Users/kameshs/.ansible/tmp/ansible-local-7917k7r02p09/tmph3nh7p5h
/

```

On Saturday, July 11, 2020 at 9:05:15 AM UTC+5:30 Abhijeet Kasurde wrote:

> Hi,
>
> Could you please provide `ansible-galaxy collection list` output? 
> helm_repository is added in Kubernetes collection 0.11.0. If your version 
> Kubernetes collection is less than this then you need to update.
>
>
> On Sat, Jul 11, 2020 at 8:51 AM ksam...@redhat.com  
> wrote:
>
>> I am trying to use Ansible collections with my molecule test 
>>
>> molecule.yml
>>
>> ```
>> ---
>> dependency:
>> name: galaxy
>> options:
>> requirements-file: molecule/common/requirements.yml
>> driver:
>> name: delegated
>> options:
>> managed: False
>> ansible_connection_options:
>> ansible_connection: local
>> lint: |
>> set -e
>> yamllint .
>> platforms:
>> - name: molecule-kind-ingress
>> provisioner:
>> name: ansible
>> verifier:
>> name: ansible
>> playbooks:
>> converge: ${MOLECULE_PLAYBOOK:-converge.yml}
>> ```
>>
>> With my converge.yml 
>>
>> ```
>> ---
>> - name: Converge
>> hosts: localhost
>> connection: local
>>
>> collections:
>> - community.kubernetes
>>
>> vars:
>> ansible_python_interpreter: '{{ ansible_playbook_python }}'
>> cluster_name: molecule-ingress
>> kind_home_dir: "/tmp/kind_test"
>> deploy_ingress: True
>>
>> roles:
>> - role: kameshsampath.kind
>> ```
>>
>> When running the test molecule is not picking up my collection, 
>> eventually resulting in a playbook error like:
>>
>> ```
>> fatal: [localhost]: FAILED! => {
>> "reason": "couldn't resolve module/action 'helm_repository'. This 
>> often indicates a misspelling, missing collection, or incorrect module 
>> path.\n\nThe error appears to be in 
>> '/Users/kameshs/git/kameshsampath/kameshsampath.kind/tasks/ingress.yml': 
>> line 2, 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: Add 
>> stable chart Repo\n  ^ here\n"
>> }
>> ```
>>
>> my requirements.yml does have the following entry 
>>
>> ```
>> ---
>> collections:
>> - community.kubernetes
>> ```
>>
>> I am not sure if I am missing anything 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-proje...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/1f2320e3-e0ff-41eb-ad27-234e467adeadn%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> Thanks,
> Abhijeet Kasurde
>

-- 
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/0aa12841-50dc-43f1-a8be-9b1d61515716n%40googlegroups.com.


Re: [ansible-project] Using Ansible Collections in molecule test

2020-07-10 Thread kameshs
I tried using the fully qualified name like 
`community.kubernetes.helm_repository`, then it does pick it up. I don't 
understand why that way inspite of me adding `collections: 
["community.kubernetes"]` as part of the playbook

On Saturday, July 11, 2020 at 11:46:24 AM UTC+5:30 kameshs wrote:

> I don't see a `ansible-galaxy collection list ` command but this is what I 
> see with debug at start of `molecule test`
>
>
> ```
> ANSIBLE_COLLECTIONS_PATHS=/Users/kameshs/.cache/molecule/kameshsampath.kind/deploy_ingress/collections:
>  
> ...
> ```
>
> and during dependency step of the scenario I see the output like 
>
> ```
>  ...
> Reading requirement file at 
> '/Users/kameshs/git/kameshsampath/kameshsampath.kind/molecule/common/requirements.yml'
> Process install dependency map
> Opened /Users/kameshs/.ansible/galaxy_token
> Processing requirement collection 'community.kubernetes'
> Collection 'community.kubernetes' obtained from server default 
> https://galaxy.ansible.com/api/
> Starting collection install process
> Installing 'community.kubernetes:0.11.1' to 
> '/Users/kameshs/.cache/molecule/kameshsampath.kind/deploy_ingress/collections/ansible_collections/community/kubernetes'
> Downloading 
> https://galaxy.ansible.com/download/community-kubernetes-0.11.1.tar.gz to 
> /Users/kameshs/.ansible/tmp/ansible-local-7917k7r02p09/tmph3nh7p5h
> /
> 
> ```
>
> On Saturday, July 11, 2020 at 9:05:15 AM UTC+5:30 Abhijeet Kasurde wrote:
>
>> Hi,
>>
>> Could you please provide `ansible-galaxy collection list` output? 
>> helm_repository is added in Kubernetes collection 0.11.0. If your version 
>> Kubernetes collection is less than this then you need to update.
>>
>>
>> On Sat, Jul 11, 2020 at 8:51 AM ksam...@redhat.com  
>> wrote:
>>
>>> I am trying to use Ansible collections with my molecule test 
>>>
>>> molecule.yml
>>>
>>> ```
>>> ---
>>> dependency:
>>> name: galaxy
>>> options:
>>> requirements-file: molecule/common/requirements.yml
>>> driver:
>>> name: delegated
>>> options:
>>> managed: False
>>> ansible_connection_options:
>>> ansible_connection: local
>>> lint: |
>>> set -e
>>> yamllint .
>>> platforms:
>>> - name: molecule-kind-ingress
>>> provisioner:
>>> name: ansible
>>> verifier:
>>> name: ansible
>>> playbooks:
>>> converge: ${MOLECULE_PLAYBOOK:-converge.yml}
>>> ```
>>>
>>> With my converge.yml 
>>>
>>> ```
>>> ---
>>> - name: Converge
>>> hosts: localhost
>>> connection: local
>>>
>>> collections:
>>> - community.kubernetes
>>>
>>> vars:
>>> ansible_python_interpreter: '{{ ansible_playbook_python }}'
>>> cluster_name: molecule-ingress
>>> kind_home_dir: "/tmp/kind_test"
>>> deploy_ingress: True
>>>
>>> roles:
>>> - role: kameshsampath.kind
>>> ```
>>>
>>> When running the test molecule is not picking up my collection, 
>>> eventually resulting in a playbook error like:
>>>
>>> ```
>>> fatal: [localhost]: FAILED! => {
>>> "reason": "couldn't resolve module/action 'helm_repository'. This 
>>> often indicates a misspelling, missing collection, or incorrect module 
>>> path.\n\nThe error appears to be in 
>>> '/Users/kameshs/git/kameshsampath/kameshsampath.kind/tasks/ingress.yml': 
>>> line 2, 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: Add 
>>> stable chart Repo\n  ^ here\n"
>>> }
>>> ```
>>>
>>> my requirements.yml does have the following entry 
>>>
>>> ```
>>> ---
>>> collections:
>>> - community.kubernetes
>>> ```
>>>
>>> I am not sure if I am missing anything 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-proje...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/1f2320e3-e0ff-41eb-ad27-234e467adeadn%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>
>>
>> -- 
>> Thanks,
>> Abhijeet Kasurde
>>
>

-- 
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/afbda868-f904-43fc-9b2b-d61eeec0c7fdn%40googlegroups.com.