Browse Source

SSH key: use ansible_ssh_private_key_file directly

instead of ansible_ssh_extra_args.
keep-around/3cac8680c01175fde44a2717a811f84269ee93f8
Pierre-Louis Bonicoli 7 months ago
parent
commit
3cac8680c0
No known key found for this signature in database GPG Key ID: 6914C4A5EDAA6DD
  1. 4
      copy-playbook.yml
  2. 2
      docs/community/contribute.rst
  3. 2
      enough/common/dotenough.py
  4. 2
      inventory/group_vars/all/private-key.yml

4
copy-playbook.yml

@ -9,11 +9,11 @@
authorized_key:
user: root
state: present
key: "{{ lookup('file', ssh_private_keyfile + '.pub') }}"
key: "{{ lookup('file', ansible_ssh_private_key_file + '.pub') }}"
- name: upload private key
copy:
src: "{{ ssh_private_keyfile }}"
src: "{{ ansible_ssh_private_key_file }}"
dest: "/root/.ssh/id_rsa"
mode: '0400'

2
docs/community/contribute.rst

@ -254,7 +254,6 @@ test environment is used:
$ tests/run-tests.sh .tox/icinga/bin/ansible bind-host \
-i .tox/icinga/.pytest_cache/d/dotenough/icinga.test/inventory \
-eansible_ssh_extra_args="'-i {{ ssh_private_keyfile }}'" \
-mraw cat /path/to/a/file
Check the value of an ansible variable:
@ -263,7 +262,6 @@ Check the value of an ansible variable:
$ tests/run-tests.sh .tox/icinga/bin/ansible bind-host \
-i .tox/icinga/.pytest_cache/d/dotenough/icinga.test/inventory \
-eansible_ssh_extra_args="'-i {{ ssh_private_keyfile }}'" \
-m debug -avar=ansible_host
Ansible repository layout

2
enough/common/dotenough.py

@ -96,7 +96,7 @@ class DotEnough(object):
if not os.path.exists(f'{d}/private-key.yml'):
open(f'{d}/private-key.yml', 'w').write(textwrap.dedent(f"""\
---
ssh_private_keyfile: {self.config_dir}/infrastructure_key
ansible_ssh_private_key_file: {self.config_dir}/infrastructure_key
"""))
if not os.path.exists(f'{d}/domain.yml'):

2
inventory/group_vars/all/private-key.yml

@ -1,2 +1,2 @@
---
ssh_private_keyfile: "{{ lookup('pipe', 'git rev-parse --show-toplevel') }}/infrastructure_key"
ansible_ssh_private_key_file: "{{ lookup('pipe', 'git rev-parse --show-toplevel') }}/infrastructure_key"
Loading…
Cancel
Save