[ansible-devel] Re: Cannot import module from ~/.ansible/plugins/module_utils

2019-06-07 Thread Modest Sokolov
If in the code I change

*from ansible.module_utils.network.comware5.comware5 import 
comware5_provider_spec*

to

*from ansible.module_utils.network import comware5_provider_spec*

The ansible-playbook ends with:

  File "/Users/bob/.ansible/plugins/action/comware5_config.py", line 18, in 

from ansible.module_utils.network import comware5_provider_spec
*ImportError*: cannot import name 'comware5_provider_spec' from 
'ansible.module_utils.network' (
*/usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7/site-packages/ansible/module_utils/network/__init__.py*
) 

Does this mean, that ansible doesn't use $DEFAULT_MODULE_UTILS_PATH? that 
is 

DEFAULT_MODULE_UTILS_PATH(default) = 
['/Users/bob/.ansible/plugins/module_utils', 
'/usr/share/ansible/plugins/module_utils']

пятница, 7 июня 2019 г., 17:05:55 UTC+3 пользователь Modest Sokolov написал:
>
> bob@Mac:~/.ansible$ ansible --version  
>   
> ansible 2.8.0
>   config file = /Users/bob/Work/Ansible/lab/ansible.cfg
>   configured module search path = ['/Users/bob/.ansible/plugins/modules', 
> '/usr/share/ansible/plugins/modules']
>   ansible python module location = 
> /usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7/site-packages/ansible
>   executable location = /usr/local/bin/ansible
>   python version = 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 
> (clang-1001.0.46.3)]
>
> In the pdb I've got:
>
> (Pdb) sys.meta_path
> [ 0x11010b518>, ,  '_frozen_importlib.FrozenImporter'>,  '_frozen_importlib_external.PathFinder'>, 
> , 
> , 
> ]
> (Pdb) p sys.path
> ['/usr/local/Cellar/ansible/2.8.0/libexec/bin', 
> '/usr/local/Cellar/ansible/2.8.0/libexec/lib/python37.zip', 
> '/usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7', 
> '/usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7/lib-dynload', 
> '/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7',
>  
> '/usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7/site-packages']
>
> Regards,
> Modest
>
> четверг, 6 июня 2019 г., 21:18:31 UTC+3 пользователь Modest Sokolov 
> написал:
>>
>> Hello,
>> I develop the modules for comware5.
>>
>> They run, when are in ansible standard directoriу, for my installation it 
>> is 
>> /usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7/site-packages/ansible/
>>
>> I've tried to move them in other directories - in ~/.ansible
>>
>> at running time of ansible-playbook now I've got error:
>>
>>   File "/usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7/imp.py", 
>> line 171, in load_source
>> module = _load(spec)
>>   File "", line 696, in _load
>>   File "", line 677, in _load_unlocked
>>   File "", line 728, in exec_module
>>   File "", line 219, in 
>> _call_with_frames_removed
>>   File "/Users/modest/.ansible/plugins/action/comware5_config.py", line 
>> 18, in 
>> from ansible.module_utils.network.comware5.comware5 import 
>> comware5_provider_spec
>> *ModuleNotFoundError: No module named 
>> 'ansible.module_utils.network.comware5'*
>>
>>
>> In ansible module I've got the string:
>>
>> from ansible.module_utils.network.comware5.comware5 import 
>> comware5_provider_spec
>>
>>
>> The ansible.conf file is empty.
>>
>> bob@Mac:~/.ansible$ ansible-config dump| grep MODULE_UTILS_PATH
>> DEFAULT_MODULE_UTILS_PATH(default) = 
>> ['/Users/bob/.ansible/plugins/module_utils', 
>> '/usr/share/ansible/plugins/module_utils']
>>
>> bob@Mac:~/.ansible$ uname -a  
>> Darwin Mac.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 
>> PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
>>
>>
>> bob@Mac:~/.ansible$ tree  
>>   
>> .
>> ├── cp
>> ├── modules
>> │   └── network
>> │   └── comware5
>> │   ├── __init__.py
>> │   ├── comware5_command.py
>> │   └── comware5_config.py
>> ├── pc
>> ├── *plugins*
>> │   ├── action
>> │   │   ├── comware5.py
>> │   │   ├── comware5_config.py
>> │   │   └── comware5_template.py
>> │   ├── cliconf
>> │   │   └── comware5.py
>> │   ├── doc_fragments
>> │   │   └── comware5.py
>> │   ├── *module_utils*
>> │   │   ├── __init__.py
>> │   │   ├── comware5.py
>> │   │   └── network
>> │   │   ├── __init__.py
>> │   │   └── *comware5*
>> │   │   ├── __init__.py
>> │   │   └── comware5.py
>> │   ├── netconf
>> │   │   └── comware5.py
>> │   └── terminal
>> │   └── comware5.py
>> └── tmp
>>
>> 15 directories, 15 files
>> bob@Mac:~/.ansible$  
>> 
>>
>> Could you please give me advice, why ansible can not import module from 
>> DEFAULT_MODULE_UTILS_PATH?
>> Where can be my mistake?
>>
>> Regards,
>> Modest
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web 

[ansible-devel] Re: Cannot import module from ~/.ansible/plugins/module_utils

2019-06-07 Thread Modest Sokolov
bob@Mac:~/.ansible$ ansible --version  
  
ansible 2.8.0
  config file = /Users/bob/Work/Ansible/lab/ansible.cfg
  configured module search path = ['/Users/bob/.ansible/plugins/modules', 
'/usr/share/ansible/plugins/modules']
  ansible python module location = 
/usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 
(clang-1001.0.46.3)]

In the pdb I've got:

(Pdb) sys.meta_path
[, , , , 
, 
, 
]
(Pdb) p sys.path
['/usr/local/Cellar/ansible/2.8.0/libexec/bin', 
'/usr/local/Cellar/ansible/2.8.0/libexec/lib/python37.zip', 
'/usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7', 
'/usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7/lib-dynload', 
'/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7', 
'/usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7/site-packages']

Regards,
Modest

четверг, 6 июня 2019 г., 21:18:31 UTC+3 пользователь Modest Sokolov написал:
>
> Hello,
> I develop the modules for comware5.
>
> They run, when are in ansible standard directoriу, for my installation it 
> is 
> /usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7/site-packages/ansible/
>
> I've tried to move them in other directories - in ~/.ansible
>
> at running time of ansible-playbook now I've got error:
>
>   File "/usr/local/Cellar/ansible/2.8.0/libexec/lib/python3.7/imp.py", 
> line 171, in load_source
> module = _load(spec)
>   File "", line 696, in _load
>   File "", line 677, in _load_unlocked
>   File "", line 728, in exec_module
>   File "", line 219, in 
> _call_with_frames_removed
>   File "/Users/modest/.ansible/plugins/action/comware5_config.py", line 
> 18, in 
> from ansible.module_utils.network.comware5.comware5 import 
> comware5_provider_spec
> *ModuleNotFoundError: No module named 
> 'ansible.module_utils.network.comware5'*
>
>
> In ansible module I've got the string:
>
> from ansible.module_utils.network.comware5.comware5 import 
> comware5_provider_spec
>
>
> The ansible.conf file is empty.
>
> bob@Mac:~/.ansible$ ansible-config dump| grep MODULE_UTILS_PATH
> DEFAULT_MODULE_UTILS_PATH(default) = 
> ['/Users/bob/.ansible/plugins/module_utils', 
> '/usr/share/ansible/plugins/module_utils']
>
> bob@Mac:~/.ansible$ uname -a  
> Darwin Mac.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 
> PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
>
>
> bob@Mac:~/.ansible$ tree  
>   
> .
> ├── cp
> ├── modules
> │   └── network
> │   └── comware5
> │   ├── __init__.py
> │   ├── comware5_command.py
> │   └── comware5_config.py
> ├── pc
> ├── *plugins*
> │   ├── action
> │   │   ├── comware5.py
> │   │   ├── comware5_config.py
> │   │   └── comware5_template.py
> │   ├── cliconf
> │   │   └── comware5.py
> │   ├── doc_fragments
> │   │   └── comware5.py
> │   ├── *module_utils*
> │   │   ├── __init__.py
> │   │   ├── comware5.py
> │   │   └── network
> │   │   ├── __init__.py
> │   │   └── *comware5*
> │   │   ├── __init__.py
> │   │   └── comware5.py
> │   ├── netconf
> │   │   └── comware5.py
> │   └── terminal
> │   └── comware5.py
> └── tmp
>
> 15 directories, 15 files
> bob@Mac:~/.ansible$
>   
>
> Could you please give me advice, why ansible can not import module from 
> DEFAULT_MODULE_UTILS_PATH?
> Where can be my mistake?
>
> Regards,
> Modest
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/dd29a711-33fc-4a73-a5e3-69a8c23ed54a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-devel] New Ansible releases 2.8.1

2019-06-07 Thread Toshio Kuratomi
Hi all- we're happy to announce that the general release of Ansible
2.8.1 is now available!


How do you get it?
--

$ pip install ansible==2.8.1 --user

The tar.gz of the releases can be found here:

* 2.8.1
  https://releases.ansible.com/ansible/ansible-2.8.1.tar.gz
  SHA256: e1d51d3a88e21238f9e7a49b2b17a49e76c13880242b936ac8a37aee4fe84445


What's new in 2.8.1
---

This release is a maintenance releases containing numerous bugfixes. The full
changelog is at:

* 2.8.1
  
https://github.com/ansible/ansible/blob/stable-2.8/changelogs/CHANGELOG-v2.8.rst


What's the schedule for future maintenance releases?


Future maintenance releases will occur approximately every 3 weeks.  So expect
the next one around 2019-06-27.


Porting Help


We've published a porting guide at
https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.8.html to
help migrate your content to 2.8.


If you discover any errors or if any of your working playbooks break when you
upgrade to 2.8.1, please use the following link to report the regression:

  https://github.com/ansible/ansible/issues/new/choose

In your issue, be sure to mention the Ansible version that works and the one
that doesn't.

Thanks!

-Toshio Kuratomi

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


Re: [ansible-devel] conditionally give value to src of win_copy

2019-06-07 Thread Martin Krizek
I have not tested but you want to do something like the following:

- set_fact
win_copy_src_var: phoenix_x86
  when:  "{{ ansible_architecture }} == 32-bit"

- set_fact
win_copy_src_var: phoenix_x64
  when:  "{{ ansible_architecture }} == 64-bit"

- name: copy_phoenix_folder
  win_copy:
src: "{{ win_copy_src_var }}"
dest: c:\\

There might be better solutions depending on the structure of your playbook.

Thanks,
Martin

On Fri, Jun 7, 2019 at 2:58 PM Deepak Asawa  wrote:
>
> Hi,
>
> - name: copy_phoenix_folder
>   win_copy:
>  src: phoenix_x86
>  when:  "{{ ansible_architecture }} == 32-bit"
>  src: phoenix_x64
>  when:  "{{ ansible_architecture }} == 64-bit"
>  dest: c:\\
>
> I have written above code but scr will always be set to phoenix_x64, giving 
> below warning
>
>  [WARNING]: While constructing a mapping from 
> /etc/ansible/roles/deepak_role/tasks/copy_phoenix_folder.yml, line 3, column 
> 10, found a duplicate dict key (when). Using
> last defined value only.
>
> where phoenix_x86 and phoenix_x64 are the folders copied in files folder of 
> role.
>
> Please guide me so that the scr should be set to phoenix_x86 when 
> ansible_architecture is "32-bit" and it should set to phoenix_x64 when 
> ansible_architecture is "64-bit"
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-devel/e84c2ba3-9e42-49e7-ad00-d92bcab9e5a5%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 Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CADDq2EPazWR_816jL2fPgZf4Ez4AXktkzMG7JR9X%2BB1Y8wUMCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-devel] conditionally give value to src of win_copy

2019-06-07 Thread Deepak Asawa
Hi,

- name: copy_phoenix_folder
  win_copy:
 src: phoenix_x86
 when:  "{{ ansible_architecture }} == 32-bit"
 src: phoenix_x64
 when:  "{{ ansible_architecture }} == 64-bit"
 dest: c:\\

I have written above code but scr will always be set to phoenix_x64, giving 
below warning 

 [WARNING]: While constructing a mapping from 
/etc/ansible/roles/deepak_role/tasks/copy_phoenix_folder.yml, line 3, 
column 10, found a duplicate dict key (when). Using
last defined value only.

where phoenix_x86 and phoenix_x64 are the folders copied in files folder of 
role.

Please guide me so that the scr should be set to phoenix_x86 when 
ansible_architecture is "32-bit" and it should set to phoenix_x64 when 
ansible_architecture is "64-bit"

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/e84c2ba3-9e42-49e7-ad00-d92bcab9e5a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.