Browse Source

improve usage of variables

users
Lilian Roller 1 year ago
parent
commit
475e86ca64
No account linked to committer's email address
3 changed files with 8 additions and 4 deletions
  1. +1
    -0
      tasks/main.yml
  2. +4
    -2
      templates/authorized_keys.j2
  3. +3
    -2
      vars/main.yml

+ 1
- 0
tasks/main.yml View File

@@ -22,6 +22,7 @@
vars:
local_user: 'root'
remote_users: '{{ admins_ssh_root_prefix }}'
restict_ssh_user_access: "{% if restict_ssh_root_access | bool %}true{% else %}false{% endif %}"

- name: Add admin group
become: yes

+ 4
- 2
templates/authorized_keys.j2 View File

@@ -3,8 +3,10 @@
{% for user_name in remote_users|sort %}
# {{ user_name }}
{% for keyfile in lookup('fileglob', '{}/{}*_*.pub'.format(ssh_public_key_store, user_name), wantlist=True) %}
{% if restict_ssh_root_access %}no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo '{{ ssh_root_login_warning }}';echo;sleep 10" {%
endif %}{{ lookup('file', keyfile) }}
{% if restict_ssh_user_access -%}
no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo '{{ ssh_root_login_warning }}';echo;sleep 10"
{%- endif -%}
{{ lookup('file', keyfile) }}
{% endfor %}
{% endfor %}


+ 3
- 2
vars/main.yml View File

@@ -1,3 +1,4 @@
---
playbook_version_number: 8420 # should be over ninethousand
playbook_version_path: '/etc/ansible-version/users-and-ssh-keys_chaos-bodensee_github.com.version'
playbook_version_number: 8423 # should be over ninethousand
playbook_version_path: '/etc/ansible-version/users-and-ssh-keys_chaos-bodensee_github.com.version'
restict_ssh_user_access: false

Loading…
Cancel
Save