From e5551e928e8e2f49dabc844ff3015a7f15960c2f Mon Sep 17 00:00:00 2001 From: jerome Date: Wed, 12 Feb 2025 15:00:46 +0100 Subject: correction --- playbooks/lxc.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'playbooks/lxc.yml') diff --git a/playbooks/lxc.yml b/playbooks/lxc.yml index 4ed673d..3fb1b18 100644 --- a/playbooks/lxc.yml +++ b/playbooks/lxc.yml @@ -20,7 +20,7 @@ name: rocky-lxc template: download template_options: --dist rockylinux --release 9 --arch amd64 - state: restarted + state: started container_command: | sleep 5 dnf install -y openssh-server python3 @@ -32,7 +32,7 @@ name: debian-lxc template: download template_options: --dist debian --release bookworm --arch amd64 - state: restarted + state: started container_command: | sleep 5 apt install -y openssh-server python3 @@ -41,11 +41,11 @@ - name: copie des clefs ssh copy: src: "~/.ssh/id_rsa.pub" - dest: "/var/lib/lxc/{{item}}/rootfs/root/.ssh/authorized_keys" + dest: "{{item}}" mode: "0600" with_items: - - debian-lxc - - rocky-lxc + - /var/lib/lxc/debian-lxc/rootfs/root/.ssh/authorized_keys + - /var/lib/lxc/rocky-lxc/rootfs/root/.ssh/authorized_keys - name: recuperation ip rocky shell: "lxc-info -iH rocky-lxc" @@ -55,8 +55,18 @@ shell: "lxc-info -iH debian-lxc" register: ip_debian + - name: ssh-keyscan ip debian + remote_user: "jerome" + become: no + local_action: shell ssh-keyscan -H {{ip_debian.stdout}} >> ~/.ssh/known_hosts + + - name: ssh-keyscan ip rocky + remote_user: "jerome" + become: no + local_action: shell ssh-keyscan -H {{ip_rocky.stdout}} >> ~/.ssh/known_hosts + - name: inventaire remote_user: "jerome" become: no - local_action: copy content="{{ip_rocky.stdout}}\n{{ip_debian.stdout}}" dest="hosts" + local_action: copy content="[containers]\n{{ip_rocky.stdout}}\n{{ip_debian.stdout}}" dest="hosts" -- cgit v1.2.3