Re: [ansible-project] Authorized_Key module not compatible with Python3?
I'm running (ansible 2.2.1.0), how do I get the system package versions? PS: I just opened this issue on the Ansible GitHub repo: https://github.com/ansible/ansible/issues/22984 On Sunday, March 26, 2017 at 1:26:39 PM UTC-7, Andrew Latham wrote: > > Interesting, this or the ansible-dev list are both good places to bring > this up. Can you share the exact version you are using and maybe some > system package versions? > > On Sun, Mar 26, 2017 at 3:15 PM, Brian Huddleston > wrote: > >> >> I use the "authorized_key" module ( >> https://docs.ansible.com/ansible/authorized_key_module.html), for adding >> SSH keys to the admins of our boxes. >> >> Today I had to use one of my playbooks against a box that only has >> Python3. I learned about the "ansible_python_interpreter=/usr/bin/python3" >> variable I had to set, and my playbook worked through everything until I >> got to the "authorized_key" where it failed. I tried the same playbook >> against an Ubuntu box that still has Python2.7 and it worked fine. So it >> seems to be only the Python3. >> >> Here is the task: >> >> - name: Add SSH keys for the administrators >> authorized_key: >> user: bhuddleston >> key: https://github.com/bhuddleston.keys >> state: present >> >> >> Here is the Error: >> >> { >> "changed": false, >> "failed": true, >> "module_stderr": "Shared connection to collector.oitd.net closed.\r\n", >> "module_stdout": "Traceback (most recent call last):\r\n File >> \"/tmp/ansible__ftramx6/ansible_module_authorized_key.py\", line 527, in >> \r\nmain()\r\n File >> \"/tmp/ansible__ftramx6/ansible_module_authorized_key.py\", line 523, in >> main\r\nresults = enforce_state(module, module.params)\r\n File >> \"/tmp/ansible__ftramx6/ansible_module_authorized_key.py\", line 433, in >> enforce_state\r\nkey = [s for s in key.splitlines() if s and not >> s.startswith('#')]\r\n File >> \"/tmp/ansible__ftramx6/ansible_module_authorized_key.py\", line 433, in >> \r\nkey = [s for s in key.splitlines() if s and not >> s.startswith('#')]\r\nTypeError: startswith first arg must be bytes or a >> tuple of bytes, not str\r\n", >> "msg": "MODULE FAILURE" >> } >> >> Is this the place to mention this or can I be directed to the correct >> support channel/group? >> >> -- >> 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 post to this group, send email to ansible...@googlegroups.com >> . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/d43b5e66-6861-4cb7-97d6-3b639339937b%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/d43b5e66-6861-4cb7-97d6-3b639339937b%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > - Andrew "lathama" Latham lat...@gmail.com > http://lathama.org - > -- 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/d84140c2-619e-4e28-bcff-a42af18b1ab1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Authorized_Key module not compatible with Python3?
I use the "authorized_key" module (https://docs.ansible.com/ansible/authorized_key_module.html), for adding SSH keys to the admins of our boxes. Today I had to use one of my playbooks against a box that only has Python3. I learned about the "ansible_python_interpreter=/usr/bin/python3" variable I had to set, and my playbook worked through everything until I got to the "authorized_key" where it failed. I tried the same playbook against an Ubuntu box that still has Python2.7 and it worked fine. So it seems to be only the Python3. Here is the task: - name: Add SSH keys for the administrators authorized_key: user: bhuddleston key: https://github.com/bhuddleston.keys state: present Here is the Error: { "changed": false, "failed": true, "module_stderr": "Shared connection to collector.oitd.net closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible__ftramx6/ansible_module_authorized_key.py\", line 527, in \r\nmain()\r\n File \"/tmp/ansible__ftramx6/ansible_module_authorized_key.py\", line 523, in main\r\nresults = enforce_state(module, module.params)\r\n File \"/tmp/ansible__ftramx6/ansible_module_authorized_key.py\", line 433, in enforce_state\r\nkey = [s for s in key.splitlines() if s and not s.startswith('#')]\r\n File \"/tmp/ansible__ftramx6/ansible_module_authorized_key.py\", line 433, in \r\nkey = [s for s in key.splitlines() if s and not s.startswith('#')]\r\nTypeError: startswith first arg must be bytes or a tuple of bytes, not str\r\n", "msg": "MODULE FAILURE" } Is this the place to mention this or can I be directed to the correct support channel/group? -- 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/d43b5e66-6861-4cb7-97d6-3b639339937b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Re: Any way to gather localhost information to use in templates for remote hosts?
I think I've figured out (2) of them: ### Last updated : {{ ansible_date_time.iso8601 }}{{ ansible_date_time.tz }}" ### Last run by : {{ lookup('env','USER') }}" But I have no idea how to lookup the Playbook that is calling the roles and such: ### Playbook : testbox.yml" Any pointers? On Tuesday, April 19, 2016 at 4:06:04 PM UTC-7, Brian Huddleston wrote: > > I'm trying to write a task that updates the MODT (Message of the Day) for > the target host the playbook is touching. > > I'm trying to capture localhost information and the > and add those to the MOTD for > each target host the playbook touches, here is an example: > > ### > ### THIS BOX IS BEING MANAGED BY ANSIBLE: > ### > ### Last updated : Saturday, Apr. 16, 2016 > ### Last playbook : testbox.yml > ### Last run by : johndoe > ###-- > > All of the variables and facts I find reference the target machine, not > the machine running the commands. > -- 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/b5a35c14-bab9-447f-9d03-f8102b4aac82%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Any way to gather localhost information to use in templates for remote hosts?
I'm trying to write a task that updates the MODT (Message of the Day) for the target host the playbook is touching. I'm trying to capture localhost information and the and add those to the MOTD for each target host the playbook touches, here is an example: ### ### THIS BOX IS BEING MANAGED BY ANSIBLE: ### ### Last updated : Saturday, Apr. 16, 2016 ### Last playbook : testbox.yml ### Last run by : johndoe ###-- All of the variables and facts I find reference the target machine, not the machine running the commands. -- 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/5597b899-37a6-4714-9e0f-a6ea8b174261%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] Possible to loop over conditional variables?
Thanks for the feedback, it took a bit for me to understand. I think I might be better off declare them individually in my example since that is much easier for other to read and add to and I can see possible text errors with all the brackets and parens that have to be used for each additional item. (say I wanted to add 3 more variables to check) On Monday, February 8, 2016 at 10:22:38 AM UTC-8, Brian Coca wrote: > > when executes inside the loop so it cannot prevent undefined errors, > the following does a union of the lists but makes sure to default each > to an empty list in case they are undefined: > > with_items:"{{nginx_domain|default([])|union(nginx_port|default([]))}}" > > > > > -- > 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/c3e00435-0d45-48b8-9595-eabedd606ce8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Possible to loop over conditional variables?
Hi all, I'm pretty new to Ansible but trying to learn quickly. I was building a role and wanted to perform a check for required variables, and was trying to put them in a loop instead of individually. Here is what I am trying but I keep getting errors: - name: Check for requirement variables fail: msg="Bailing out. This role requires {{ item }}" when: {{ item }} is undefined with_items: - nginx_domain - nginx_port Instead of having declare them individually like this: - name: Check for requirement nginx_domain fail: msg="Bailing out. This role requires 'nginx_domain'" when: nginx_domain is undefined - name: Check for requirement nginx_port fail: msg="Bailing out. This role requires 'nginx_port'" when: nginx_domain is undefined Is this possible? Or am I trying to fit a square peg in a round hole? Thanks for any feedback -- BrianH -- 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/f295241a-38dc-4ba9-ac7a-b09043d6a413%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Re: Ansible 2.0 RC1 is available for testing!
When will we be able to install v2.0 via PIP? (I'm still seeing 1.9.4) On Thursday, November 19, 2015 at 1:52:46 PM UTC-8, James Cammarata wrote: > > Hi all, for those not at AnsibleFest we have officially release the first > release candidate for Ansible 2.0! > > For details and background, please see the original beta announcement > here: > https://groups.google.com/d/msg/ansible-project/_hTjEIpbA_Y/GtllImCkCQAJ > > How do you get it? > -- > > The tar.gz of the release can be found here: > > http://releases.ansible.com/ansible/ansible-2.0.0-0.6.rc1.tar.gz > SHA256: 6d45c6ed5c36e92e3fce32f971bd6e2c58a4d5cf892b2af5dd9fa6874fc4ee6c > > You can also test against the git repository as follows: > > $ git clone https://github.com/ansible/ansible.git > $ cd ansible > $ git checkout v2.0.0-0.6.rc1 > $ git submodule update --init > > You can then source our testing script: > > $ . hacking/env-setup > > or you can build your own .tar.gz (output will be > dist/ansible-2.0.0.tar.gz): > > $ make sdist > > If you discover any errors related to this beta release, or if you see any > regressions from playbooks which work on 1.9.x and prior, please open a > Github issue and be sure to mention you're testing against this release > candidate. > > Thanks! > > James Cammarata > Director, Ansible Core Engineering > github: jimi-c > -- 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/35a30f05-892f-4d80-a875-1302fc0d1b9a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Problems with a variable list in a loop
I have a odd problem iterating through a list, I'm trying to define a role that will install multiple SSH keys from GitHub. -- THIS WORKS (in a playbook) -- - name: Add SSH Keys to the common login user authorized_key: user={{ ubuntu_common_login_user }} key="{{ item }}" with_items: - https://github.com/user1.keys - https://github.com/user2.keys -- THIS DOES NOT WORK (in a role) -- (tasks/main.yml) - name: Add SSH Keys to the common login user #authorized_key: user={{ ubuntu_common_login_user }} key="{{ ssh_key_list }}" (vars/main.yml) ssh_key_list: - https://github.com/user1.keys - https://github.com/user2.keys I'm assuming the problem is in how the variable is being handed off to the loop and what possible object it might be, but I don't know how to get it to a format/object that the loop likes. -- 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/182ef87a-e6e8-4d57-b160-d2df57215d64%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.