From 0ac3dc09c4225bb0275c163aafa49fca72ea0958 Mon Sep 17 00:00:00 2001 From: Benedikt Penner Date: Sun, 15 Mar 2026 00:58:57 +0100 Subject: [PATCH] add ssh key --- glusterfs/ansible/files/ansible_key | 7 +++++++ glusterfs/ansible/files/ansible_key.pub | 1 + glusterfs/ansible/setup_galery.yml | 11 ++++++++++- glusterfs/terraform/templates/inventory.yml.tftpl | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 glusterfs/ansible/files/ansible_key create mode 100644 glusterfs/ansible/files/ansible_key.pub diff --git a/glusterfs/ansible/files/ansible_key b/glusterfs/ansible/files/ansible_key new file mode 100644 index 0000000..8ef2ac6 --- /dev/null +++ b/glusterfs/ansible/files/ansible_key @@ -0,0 +1,7 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACCn14U5lXczU3gyBa7x7m1RRgVOHHphBwDQTxvFiZrd9AAAAJikswD/pLMA +/wAAAAtzc2gtZWQyNTUxOQAAACCn14U5lXczU3gyBa7x7m1RRgVOHHphBwDQTxvFiZrd9A +AAAECqUlHZcmQAUp9+iZH509A3euZ6fL0MME4CC3U91H2EK6fXhTmVdzNTeDIFrvHubVFG +BU4cemEHANBPG8WJmt30AAAAEWR1bW15QGV4YW1wbGUuY29tAQIDBA== +-----END OPENSSH PRIVATE KEY----- diff --git a/glusterfs/ansible/files/ansible_key.pub b/glusterfs/ansible/files/ansible_key.pub new file mode 100644 index 0000000..6c1e017 --- /dev/null +++ b/glusterfs/ansible/files/ansible_key.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfXhTmVdzNTeDIFrvHubVFGBU4cemEHANBPG8WJmt30 dummy@example.com diff --git a/glusterfs/ansible/setup_galery.yml b/glusterfs/ansible/setup_galery.yml index 22d4f28..6606c48 100644 --- a/glusterfs/ansible/setup_galery.yml +++ b/glusterfs/ansible/setup_galery.yml @@ -1,6 +1,15 @@ --- +- name: deploy key + hosts: bastion + gather_facts: false + tasks: + - name: Set authorized key taken from file + ansible.posix.authorized_key: + user: clusteruser + state: present + key: "{{ lookup('file', './files/ansible_key.pub') }}" -- hosts: bastion +- hosts: test_server gather_facts: true become: false diff --git a/glusterfs/terraform/templates/inventory.yml.tftpl b/glusterfs/terraform/templates/inventory.yml.tftpl index e7177d9..dcf5284 100644 --- a/glusterfs/terraform/templates/inventory.yml.tftpl +++ b/glusterfs/terraform/templates/inventory.yml.tftpl @@ -16,4 +16,4 @@ ansible_user=clusteruser ansible_ssh_pass=password [test_server:vars] -ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q clusteruser@${bastion.default_ipv4_address}"' \ No newline at end of file +ansible_ssh_common_args='-o ProxyCommand="ssh -i ./ansible/files/ansible_key -W %h:%p -q clusteruser@${bastion.default_ipv4_address}"' \ No newline at end of file