summaryrefslogtreecommitdiff
path: root/playbooks/lxc.yml
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/lxc.yml')
-rw-r--r--playbooks/lxc.yml22
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"