[ansible-project] Re: Trying to hack a module, but external dependency cannot be found despite being installed
So, I found the problem. Actually, I'm not sure if it's a problem or desired behaviour :) When I run 'source hacking/env-setup', the PYTHONPATH environmental variable gets set to the 'lib' directory in the ansible repository used for development. This directory however does not contain the external Python dependencies (installed with pip) which are installed in /usr/lib/python2.7/site-packages. If a PYTHONPATH environmental variable is defined before running 'source hacking/env-setup' however, this original path is prepended to the new PYTHONPATH. So, I'm now simply exporting PYTHONPATH=/usr/lib/python2.7/site-packages before I run env-setup and all is well. I can now use test-module to test modules that rely on external dependencies. Hopefully this is useful to somebody in a similar situation. Feel free to let me know if I'm overlooking something and made this more difficult than necessary. Regards, Simon -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/34446686-f039-4920-8343-f2360b2bd6e7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Re: Trying to hack a module, but external dependency cannot be found despite being installed
So, I found the problem. Actually, I'm not sure if it's a problem or desired behaviour :) When I run 'source hacking/env-setup', the PYTHONPATH environmental variable gets set to the 'lib' directory in the ansible repository used for development. This directory however does not contain the external Python dependencies (installed with pip) which are installed in /usr/lib/python2.7/site-packages. If a PYTHONPATH environmental variable is defined before running 'source hacking/env-setup' however, this original path is prepended to the new PYTHONPATH. So, I'm now simply exporting PYTHONPATH=/usr/lib/python2.7/site-packages before I run env-setup and all is well. I can now use test-module to test modules that rely on external dependencies. Hopefully this is useful to somebody in a similar situation. Feel free to let me know if I'm overlooking something and made this more difficult than necessary. Regards, Simon On Wednesday, November 30, 2016 at 1:00:22 PM UTC+1, Simon Wydooghe wrote: > > Hey Brian and Greg, > > Thanks for the feedback. I run Arch Linux, where python3 is the default > python. For this reason, I've tried getting the Ansible hacking setup both > in a python2 virtualenv and in a python2 docker image. Both result in the > same issue. > > This is the output of which python and env python in my Docker image: > > root@939639e10ec5:/code# which python > /usr/local/bin/python > root@939639e10ec5:/code# python > Python 2.7.12 (default, Nov 17 2016, 22:18:11) > [GCC 4.9.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> exit() > root@939639e10ec5:/code# env python > Python 2.7.12 (default, Nov 17 2016, 22:18:11) > [GCC 4.9.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> exit() > root@939639e10ec5:/code# > > As you can see, python points to the right python executable. I'm using > the official python2 Docker image and have installed the necessary > dependencies. This is the Dockerfile: > > FROM python:2 > > RUN pip install paramiko PyYAML Jinja2 httplib2 six > > RUN apt-get update && apt-get install -y libvirt-dev \ > && pip install libvirt-python > RUN pip install boto boto3 > > VOLUME /code > WORKDIR /code > > VOLUME /data > > CMD ["bash"] > > I then load then Ansible repo under /data. > > I ran the setup module and it confirms the python executable being 2.7.12: > > root@c52acee259c9:/code# ansible localhost -m setup -a filter=ansible_env > [WARNING]: Host file not found: /etc/ansible/hosts > > [WARNING]: provided hosts list is empty, only localhost is available > > localhost | SUCCESS => { > "ansible_facts": { > "ansible_env": { > "ANSIBLE_HOME": "/code", > "GPG_KEY": "C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF", > "HOME": "/root", > "HOSTNAME": "c52acee259c9", > "LANG": "C.UTF-8", > "MANPATH": "/code/docs/man:", > "PATH": > "/code/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", > > "PWD": "/code", > "PYTHONPATH": "/code/lib:", > "PYTHON_PIP_VERSION": "9.0.1", > "PYTHON_VERSION": "2.7.12", > "SHLVL": "1", > "TERM": "xterm", > "_": "/code/bin/ansible" > } > }, > "changed": false > } > > > Any more ideas? :) > > Regards, > Simon > > On Tuesday, November 29, 2016 at 9:29:07 AM UTC+1, Greg Langford wrote: >> >> Hello, >> >> You could also try and run the command without quotes 'which python' that >> will give you the path to the Python executable >> >> Then run again without the quotes '/usr/bin/python --version' replacing >> the path with the one returned from the which command you ran before which >> will give you the python version. >> >> Ansible afaik requires Python 2.7 so if the version of the system python >> is Python 3 you may want to symlink /usr/bin/python to the python2 >> executable. >> >> Kind Regards >> >> On Sunday, 27 November 2016 17:48:51 UTC, Simon Wydooghe wrote: >>> >>> I'm following the Developing Modules guide to get myself started with >>> Ansible hacking ( >>> http://docs.ansible.com/ansible/dev_guide/developing_modules.html). >>> >>> I've sourced hacking/env-setup and now I'm simply trying to use >>> test-module to test an original unedited module. >>> >>> The module I'm trying to test is 'virt', under extras/cloud/extra. It >>> has a python dependency: libvirt-python. This dependency has been installed >>> and I can open a Python terminal and import 'libvirt' without a problem. >>> >>> root@9ba2749b80b0:/code# python2 >>> Python 2.7.12 (default, Nov 17 2016, 22:18:11) >>> [GCC 4.9.2] on linux2 >>> Type "help", "copyright", "credits" or "license" for more information. >>> >>> import libvirt >>> >>> >>> >>> However, when using test-module to test 'virt', it seems unable to >>> import 'libvirt': >>> >>>
[ansible-project] Right way to wait for service start
Hi, I would like to restart a server and wait till the services start up. I can us the wait_for module to wait for ports to be up, but how can I wait for the services to be up? The service modules seem to start,stop or restart service, but I don't want to do any of these operations. Only wait till services are up. On linux I am able to run a command and loop until it returns true. But is there a direct support for this in Ansible or the Services module? Thanks -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/db5a8963-0285-4d12-89b9-fa20df038270%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] ssh failing
Hi i am connecting to my ec2 instance and i am getting this error , please help ssh centos@10.103.1.235 -vvv OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013 debug1: Reading configuration data /root/.ssh/config debug1: /root/.ssh/config line 1: Applying options for 10.103* debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 56: Applying options for * debug1: Executing proxy command: exec ssh -A -W 10.103.1.235:22 ec2-user@10.100.140.213 debug1: permanently_set_uid: 0/0 debug3: Incorrect RSA1 identifier debug3: Could not load "/home/swathi/.ssh/swathikadem.pem" as a RSA1 public key debug1: identity file /home/swathi/.ssh/swathikadem.pem type -1 debug1: identity file /home/swathi/.ssh/swathikadem.pem-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.6.1 debug1: permanently_drop_suid: 0 channel 0: open failed: connect failed: Connection timed out ssh_exchange_identification: Connection closed by remote host the key is placed in /home/swathi/.ssh/sathikadem.pem -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2544b04a-f776-43f1-880e-b4b20083661c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] flaky apt installs today on ubuntu
We're just using the stock ec2 and ubuntu mirrors. Running apt directly on the cli has no issues. On Friday, December 2, 2016 at 7:54:23 PM UTC-8, Andreas Olsson wrote: > > fre 2016-12-02 klockan 15:16 -0800 skrev ja...@blendlabs.com : > > > {"failed": true, "invocation": {"module_args": {"cache_valid_time": > > null, "deb": null, "default_release": null, "dpkg_options": "force- > > confdef,force-confold", "force": false, "install_recommends": null, > > "name": ["cryptsetup", "liblz4-tool", "mdadm", "sysstat"], "package": > > ["cryptsetup", "liblz4-tool", "mdadm", "sysstat"], "purge": false, > > "state": "present", "update_cache": true, "upgrade": null}, > > "module_name": "apt"}, "item": ["cryptsetup", "liblz4-tool", "mdadm", > > "sysstat"], "msg": "Could not fetch updated apt files"} > > Looks more like an issue with your particular apt mirror, rather than a > general Ubuntu issue? > > // Andreas > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/04179e01-454c-4675-b55f-9cacecb05dba%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Ansible Dynamic Vagrant Inventory script
Hi, this inventory script can be useful if you use Vagrant: https://github.com/harobed/ansible-dynamic-vagrant-inventory Best regards, Stéphane -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9a9fd5ca-c95f-4d28-adf5-273220b21871%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] Ansible Galaxy/GitHub Issues
>From the ticket, looks like a simple perms issue -- but I would like to hear if anyone else is experiencing this. On Mon, Dec 5, 2016 at 11:28 AM, 'Chris Short' via Ansible Projectwrote: > I've filed a ticket on this but there does not seem to be a workaround > (https://github.com/ansible/galaxy-issues/issues/217). I wrote a role that I > want to deploy to Galaxy but the GitHub integration fails to work every > time. Has anyone experienced this and is there a fix? > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to ansible-project+unsubscr...@googlegroups.com. > To post to this group, send email to ansible-project@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/a87595d7-c024-4d7c-8b75-b80908d675a0%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Greg DeKoenigsberg Ansible Community Guy -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAM1FbhEN7_LWFVVuaz3QXyywvWgHQPnXRSM62ZqBE%3DtLQvAhQA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Ansible Galaxy/GitHub Issues
I've filed a ticket on this but there does not seem to be a workaround (https://github.com/ansible/galaxy-issues/issues/217). I wrote a role that I want to deploy to Galaxy but the GitHub integration fails to work every time. Has anyone experienced this and is there a fix? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a87595d7-c024-4d7c-8b75-b80908d675a0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Re: How can tell my docker_container module to always pull an Image only sometimes when i specify using extra vars or something
Bump!! There is got to be some trick involved but i can't think of any. On Wednesday, 30 November 2016 13:30:01 UTC+1, ishan jain wrote: > > I have a number of playbooks each related to starting a container for a > microservice using docker_container module. I supply the variables like > image name from the outside using YAML var files. Since we never update a > tagged image in our repo, we have deliberately not used "pull: always" in > the module as it will pull image if absent anyways and there will never be > an update to that image ever. This is the reason that i don't want to > change that for a specific scenario i have encountered. > > I am working on experimental images for these microservices and i am using > the same playbooks to install them. Now there is a single tag for these > experimental images and it keeps on updating in the repo and to handle > that, i need to tell the docker_container module to always pull. I do not > wish to change the scripts but i have the flexibility to provide extra vars > to the playbook. I cannot even do something like adding the pull: {{var}} > to the playbooks with the default value of var as false but changing it to > true in my case. The original scripts shall remain untouched. > > *How can i tell the docker_container to always pull with the help of extra > vars.* > > Maybe i should ask a more generic question. It will be cool if this is > possible. > > *How can i override/add the values of parameters of a module inside the > playbook/role with the help of extra vars ?* > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b398b3f9-b296-4b6a-9168-37ca8885b256%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] Re: Problems with Solaris 8 & 9 in Ansible 2.2.0.0
Also tested on a bare metal Solaris 8 machine, and it has the same problems, so it does not seem to be related to the zones. Maybe I should file a proper bug report, but since I´m new to Ansible I want to rule out my incompetence as the cause first. On Tuesday, November 29, 2016 at 7:31:26 PM UTC+1, Brian Coca wrote: > > Ansible just uses python's syslog library, if that does not work in the > solaris branded zones ... not sure what to do at this point. > > > -- > -- > Brian Coca > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1e39de32-961b-4d70-93a7-9fffe75c3c8d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Re: Global variable to pas dynamic data between plays with different hosts
OK, so I looked at Ansible's code, and I now know how to implement this. I tried my modification locally and it works fine. It basically adds a module that adds an 'extra_vars' variable if it does not yet exist. That way, any variable set on the commandline using the '--extra-vars' argument cannot be overruled by the playbook. Now this scenario works : Inventory : group_all = { host_1, host_2, host_3 } group_one = { host_1 } group_two = { host_2, host3 } Playbook 'my_playbook.yml' : --- - hosts: group_one tasks: - name: list /tmp shell: ls /tmp register: out - name: set global variable setglobal: name=myvar value="{{out}}" - hosts: group_two tasks: - debug: msg="{{myvar}}" command : 'ansible-playbook my_playbook.yml --limit group_all' Anyone interested in this modification ? I can create a pull request... -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e8f483b0-e215-4675-93ba-8243d19f5504%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] with_dict and with_items together in ansible task
Hi My requirement is to install multiple patches on different machines based on which all tiers the patch is supported for install. Say patch1 should be installed on client group and service group, patch2 should be installed on client group and database group machines. - name: Install patch on services tier include: roles/common/tasks/install_patch_services.yml when: ({{item.value.services_repo}} == True) with_dict: "{{patches_dict}}" delegate_to: "{{ groups.is_services[0] }}" Here I am using dict to traverse through all patches and install on different groups. If there are multiple hosts in a group, how can I write a task? It should consider patch1 install on services[0], services[1] and patch2 on services[0],services[1] and so on.. Please provide your inputs how it can be achieved ? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/cee2bf08-b18b-47a6-94b5-18ed6f6a68b2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.