diff options
| author | jerome <jerome@xlinfo.fr> | 2025-02-12 15:00:46 +0100 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2025-02-12 15:00:46 +0100 |
| commit | e5551e928e8e2f49dabc844ff3015a7f15960c2f (patch) | |
| tree | 7cf54c1bcb48652cbf7cdfb6ee4ecfd26ab31d86 /playbooks/lxc.yml | |
| parent | 68c5f21ecfe6805028d0a8a33190c6413a6786fd (diff) | |
| download | terraform-ansible-e5551e928e8e2f49dabc844ff3015a7f15960c2f.tar.gz terraform-ansible-e5551e928e8e2f49dabc844ff3015a7f15960c2f.zip | |
correction
Diffstat (limited to 'playbooks/lxc.yml')
| -rw-r--r-- | playbooks/lxc.yml | 22 |
1 files changed, 16 insertions, 6 deletions
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" |
