How to run ansible 2.10 in a tox venv?

20 views
Skip to first unread message

Rich Megginson

unread,
Feb 27, 2020, 7:59:00 PM2/27/20
to ansibl...@googlegroups.com
https://github.com/ansible-collections/overview/blob/master/README.rst#pre-release-versions-of-ansible-base

I think this should work?
"Checkout and run the source
https://github.com/ansible-collection-migration/ansible-base (pip
install in a Python virtual environment, or do source hacking/env-setup)"

So something like this in my tox.ini?

deps =

git+https://github.com/ansible-collection-migration/ansible-base.git@devel#egg=pkg

However, there are no modules installed - I think it is because the
MANIFEST.in excludes them?
https://github.com/ansible-collection-migration/ansible-base/blob/devel/MANIFEST.in

recursive-include lib/ansible/module_utils/powershell *.psm1
recursive-include lib/ansible/modules/windows *.ps1
recursive-include lib/ansible/galaxy/data *.yml *.j2 README.md
ansible.cfg inventory .git_keep

because that's exactly what I see in
.tox/env-py38-ansible210/lib/python3.8/site-packages/ansible/modules/

Will I have to use the `source hacking/env-setup` method to use
ansible2.10 in my tox env? If so, does anyone have any examples about
how to do this?

Chris Church

unread,
Feb 27, 2020, 10:11:33 PM2/27/20
to Rich Megginson, Ansible Development
Hi Rich,

You can install from git+https://github.com/ansible/ansible.git@devel as a dep in your tox.ini. At least it works for me to test Ansible roles against devel (https://github.com/cchurch/ansible-role-testing/blob/master/tox.ini#L21). 


--
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-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/ecba334d-b864-4736-ea54-ac7ea1cc0ef3%40redhat.com.

Rich Megginson

unread,
Feb 28, 2020, 12:05:42 PM2/28/20
to ansibl...@googlegroups.com
On 2/27/20 8:11 PM, Chris Church wrote:
> Hi Rich,
>
> You can install from git+https://github.com/ansible/ansible.git@devel as
> a dep in your tox.ini. At least it works for me to test Ansible roles
> against devel
> (https://github.com/cchurch/ansible-role-testing/blob/master/tox.ini#L21).

This works. Thanks!
> <mailto:ansible-devel%2Bunsu...@googlegroups.com>.
> --
> 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-deve...@googlegroups.com
> <mailto:ansible-deve...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-devel/CAH%2BKTJ67sN37%2BNH3Hvk%2B1Jz6d5V4x84_3jVc8xvhj%3DLA2KH-fQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-devel/CAH%2BKTJ67sN37%2BNH3Hvk%2B1Jz6d5V4x84_3jVc8xvhj%3DLA2KH-fQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Matt Martz

unread,
Feb 28, 2020, 12:09:10 PM2/28/20
to Rich Megginson, Ansible Development
Rich, as far as ansible-base is concerned, there is/was a bug that was errantly removing `__ini__.py` files, which is likely the cause on python2.  It's being worked on currently.

fwiw, ansible/ansible is more similar to Ansible 2.9 at this point. ansible-base is what ansible/ansible will look like on March 23.

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/87814f0d-0a8d-f968-d0be-c36966cc9485%40redhat.com.


--
Matt Martz
@sivel
sivel.net

Rich Megginson

unread,
Feb 28, 2020, 12:16:55 PM2/28/20
to ansibl...@googlegroups.com
On 2/28/20 10:08 AM, Matt Martz wrote:
> Rich, as far as ansible-base is concerned, there is/was a bug that was
> errantly removing `__ini__.py` files, which is likely the cause on
> python2.  It's being worked on currently.

Is there an issue/pr that I can follow? I would like to run my tests
with as close to ansible 2.10 as possible.

Also, I tested with python3, so at least for me, the problem manifested
using other than python2 (or I'm running into a separate issue).

>
> fwiw, ansible/ansible is more similar to Ansible 2.9 at this point.
> ansible-base is what ansible/ansible will look like on March 23.
>
> On Fri, Feb 28, 2020 at 11:05 AM Rich Megginson <rmeg...@redhat.com
> <mailto:rmeg...@redhat.com>> wrote:
>
> On 2/27/20 8:11 PM, Chris Church wrote:
> > Hi Rich,
> >
> > You can install from
> git+https://github.com/ansible/ansible.git@devel as
> > a dep in your tox.ini. At least it works for me to test Ansible
> roles
> > against devel
> >
> (https://github.com/cchurch/ansible-role-testing/blob/master/tox.ini#L21).
>
> This works.  Thanks!
>
> >
> >
> > On Thu, Feb 27, 2020 at 7:58 PM Rich Megginson
> <rmeg...@redhat.com <mailto:rmeg...@redhat.com>
> >     <mailto:ansible-devel%2Bunsu...@googlegroups.com
> <mailto:ansible-devel%252Buns...@googlegroups.com>>.
> >     To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-devel/ecba334d-b864-4736-ea54-ac7ea1cc0ef3%40redhat.com.
> >
> > --
> > 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-deve...@googlegroups.com
> <mailto:ansible-devel%2Bunsu...@googlegroups.com>
> > <mailto:ansible-deve...@googlegroups.com
> <mailto:ansible-devel%2Bunsu...@googlegroups.com>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-devel/CAH%2BKTJ67sN37%2BNH3Hvk%2B1Jz6d5V4x84_3jVc8xvhj%3DLA2KH-fQ%40mail.gmail.com
>
> >
> <https://groups.google.com/d/msgid/ansible-devel/CAH%2BKTJ67sN37%2BNH3Hvk%2B1Jz6d5V4x84_3jVc8xvhj%3DLA2KH-fQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
> --
> 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-deve...@googlegroups.com
> <mailto:ansible-devel%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> sivel.net <http://sivel.net>
>
> --
> 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-deve...@googlegroups.com
> <mailto:ansible-deve...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-devel/CAD8N0v9c1LqA7RzQNL1xFB8gUduQt%3D61gP_aenmF0gj1AzGk7w%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-devel/CAD8N0v9c1LqA7RzQNL1xFB8gUduQt%3D61gP_aenmF0gj1AzGk7w%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Matt Martz

unread,
Feb 28, 2020, 12:48:09 PM2/28/20
to Rich Megginson, Ansible Development
I've tested more, and can not reproduce this.  Installing ansible-base I do have modules installed.

I've not tested in tox, but depending if you have ansible installed in a place where tox can see, that may cause issues.

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/28029468-8c2d-54d9-6638-ba83ee23b4c4%40redhat.com.

Rich Megginson

unread,
Feb 28, 2020, 6:45:28 PM2/28/20
to Ansible Development
On 2/28/20 10:47 AM, Matt Martz wrote:
> I've tested more, and can not reproduce this.  Installing ansible-base I
> do have modules installed.
>
> I've not tested in tox, but depending if you have ansible installed in a
> place where tox can see, that may cause issues.

It's working now - not sure why it wasn't before.

Something like this:

commands_pre =
bash {toxinidir}/install_ansible_for_testing.sh {envdir}/ansible devel
commands =
bash {toxinidir}/run_ansible_for_testing.sh {envdir}/ansible bash
{toxinidir}/run_tests.sh

where install downloads it from github (if it doesn't already exist),
and run does a `source {envdir}/ansible/hacking/env-setup` before
running the rest of the command line.

>
> On Fri, Feb 28, 2020 at 11:16 AM Rich Megginson <rmeg...@redhat.com
> <mailto:rmeg...@redhat.com>> wrote:
>
> On 2/28/20 10:08 AM, Matt Martz wrote:
> > Rich, as far as ansible-base is concerned, there is/was a bug
> that was
> > errantly removing `__ini__.py` files, which is likely the cause on
> > python2.  It's being worked on currently.
>
> Is there an issue/pr that I can follow?  I would like to run my tests
> with as close to ansible 2.10 as possible.
>
> Also, I tested with python3, so at least for me, the problem manifested
> using other than python2 (or I'm running into a separate issue).
>
> >
> > fwiw, ansible/ansible is more similar to Ansible 2.9 at this point.
> > ansible-base is what ansible/ansible will look like on March 23.
> >
> > On Fri, Feb 28, 2020 at 11:05 AM Rich Megginson
> <rmeg...@redhat.com <mailto:rmeg...@redhat.com>
> >      >     <mailto:ansible-devel%2Bunsu...@googlegroups.com
> <mailto:ansible-devel%252Buns...@googlegroups.com>
> >     <mailto:ansible-devel%252Buns...@googlegroups.com
> <mailto:ansible-devel%25252Bun...@googlegroups.com>>>.
> >      >     To view this discussion on the web visit
> >      >
> >
> https://groups.google.com/d/msgid/ansible-devel/ecba334d-b864-4736-ea54-ac7ea1cc0ef3%40redhat.com.
> >      >
> >      > --
> >      > 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-deve...@googlegroups.com
> <mailto:ansible-devel%2Bunsu...@googlegroups.com>
> >     <mailto:ansible-devel%2Bunsu...@googlegroups.com
> <mailto:ansible-devel%252Buns...@googlegroups.com>>
> >      > <mailto:ansible-deve...@googlegroups.com
> <mailto:ansible-devel%2Bunsu...@googlegroups.com>
> >     <mailto:ansible-devel%2Bunsu...@googlegroups.com
> <mailto:ansible-devel%252Buns...@googlegroups.com>>>.
> >      > To view this discussion on the web visit
> >      >
> >
> https://groups.google.com/d/msgid/ansible-devel/CAH%2BKTJ67sN37%2BNH3Hvk%2B1Jz6d5V4x84_3jVc8xvhj%3DLA2KH-fQ%40mail.gmail.com
> >
> >      >
> >
>  <https://groups.google.com/d/msgid/ansible-devel/CAH%2BKTJ67sN37%2BNH3Hvk%2B1Jz6d5V4x84_3jVc8xvhj%3DLA2KH-fQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> >
> >     --
> >     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-deve...@googlegroups.com
> <mailto:ansible-devel%2Bunsu...@googlegroups.com>
> >     <mailto:ansible-devel%2Bunsu...@googlegroups.com
> <mailto:ansible-devel%252Buns...@googlegroups.com>>.
> >     To view this discussion on the web visit
> >
> > sivel.net <http://sivel.net> <http://sivel.net>
> >
> > --
> > 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-deve...@googlegroups.com
> <mailto:ansible-devel%2Bunsu...@googlegroups.com>
> > <mailto:ansible-deve...@googlegroups.com
> <mailto:ansible-devel%2Bunsu...@googlegroups.com>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-devel/CAD8N0v9c1LqA7RzQNL1xFB8gUduQt%3D61gP_aenmF0gj1AzGk7w%40mail.gmail.com
>
> >
> <https://groups.google.com/d/msgid/ansible-devel/CAD8N0v9c1LqA7RzQNL1xFB8gUduQt%3D61gP_aenmF0gj1AzGk7w%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
> --
> 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-deve...@googlegroups.com
> <mailto:ansible-devel%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> sivel.net <http://sivel.net>

Reply all
Reply to author
Forward
0 new messages