Git Product home page Git Product logo

ansible-role-authorized-key's People

Contributors

markopolo123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ansible-role-authorized-key's Issues

Template error while templating string

ASK [GROG.authorized-key : Manage authorized keys] *********************************************************************************************************************************************************************************************
task path: /private/etc/ansible/roles/GROG.authorized-key/tasks/main.yml:3
fatal: [10.82.136.9]: FAILED! => {
"failed": true,
"msg": "{{ authorized_key_list + authorized_key_list_host + authorized_key_list_group }}: [{u'authorized_keys': [{u'key': u"{{ lookup('file', 'files/user.keys) }}"}], u'name': u'user'}]: template error while templating string: unexpected char u"'" at 18. String: {{ lookup('file', 'files/user.keys) }}"
}
fatal: [10.104.136.14]: FAILED! => {
"failed": true,
"msg": "{{ authorized_key_list + authorized_key_list_host + authorized_key_list_group }}: [{u'authorized_keys': [{u'key': u"{{ lookup('file', 'files/user.keys) }}"}], u'name': u'user'}]: template error while templating string: unexpected char u"'" at 18. String: {{ lookup('file', 'files/user.keys) }}"
}
fatal: [10.3.8.5]: FAILED! => {
"failed": true,
"msg": "{{ authorized_key_list + authorized_key_list_host + authorized_key_list_group }}: [{u'authorized_keys': [{u'key': u"{{ lookup('file', 'files/user.keys) }}"}], u'name': u'user'}]: template error while templating string: unexpected char u"'" at 18. String: {{ lookup('file', 'files/user.keys) }}"
}

ssh-keys.yaml:

---
- hosts: azure
  roles:
    - { role: GROG.authorized-key, become: yes }

servers.yaml

authorized_key_list_group:
  - name: egilb1
    authorized_keys:
      - key: "{{ lookup('file', 'files/egilb1.keys) }}"

files/user.keys is in the dir I'm running the playbook from, so the path is relative.

exclusive option with several key not working

exclusive option is not working as exepected for me
maybe linked to this :
http://docs.ansible.com/ansible/authorized_key_module.html
say :
This option is not loop aware, so if you use with_ , it will be exclusive per iteration of the loop, if you want multiple keys in the file you need to pass them all to key in a single batch as mentioned above.

i want to manage root ssh key (only used for emergency issue) for several user but i want/need to be sure, no other person can connect as root with ssh keys
I have create :
authorized_key_list:

  • name: root
    • key: "ssh-rsa ssh_user2_key1"
    • key: "ssh-rsa ssh_user2_key1"
      authorized_key_list_group:
  • name: root
    authorized_keys:
    • key: "ssh-rsa ssh_user3_key1"

so if

  • i set "authorized_key_exclusive: no" and exclusive: no,
    anyone can edit manually the root ssh key and this ansible role will not change it or even detect it
  • i add authorized_key_exclusive: yes
    i get only the ssh-rsa ssh_user3_key1 in my root account
  • if i add exclusive: yes on first ssh key ( aka "ssh-rsa ssh_user2_key1")
    it's always recreate the root ssh keys and the result will be always "changed=1"

AttributeError: 'module' object has no attribute 'HTTPSConnection'

On a fresh opensuse 15.1 installation i get an AttributeError.
Another opensuse 15.1 installation works flawlessly.
Any clue what kind of dependency is missing?

thanks!

The full traceback is:
Traceback (most recent call last):
File "", line 114, in
File "", line 106, in _ansiballz_main
File "", line 49, in invoke_module
File "/tmp/ansible_authorized_key_payload_4oX_0b/main.py", line 230, in
File "/tmp/ansible_authorized_key_payload_4oX_0b/ansible_authorized_key_payload.zip/ansible/module_utils/urls.py", line 402, in
AttributeError: 'module' object has no attribute 'HTTPSConnection'

failed: [test] (item=[{'name': 'acb'}, {'key': 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFS3XxUR92/mvUnjDgYBW7tUl0sp6uT28WG9CzIIPQXP 20190710 - harkonnen - kallisti'}]) => {
"ansible_loop_var": "item",
"changed": false,
"item": [
{
"name": "acb"
},
{
"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFS3XxUR92/mvUnjDgYBW7tUl0sp6uT28WG9CzIIPQXP 20190710 - harkonnen - kallisti"
}
],
"module_stderr": "Traceback (most recent call last):\n File "", line 114, in \n File "", line 106, in _ansiballz_main\n File "", line 49, in invoke_module\n File "/tmp/ansible_authorized_key_payload_4oX_0b/main.py", line 230, in \n File "/tmp/ansible_authorized_key_payload_4oX_0b/ansible_authorized_key_payload.zip/ansible/module_utils/urls.py", line 402, in \nAttributeError: 'module' object has no attribute 'HTTPSConnection'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.