summaryrefslogtreecommitdiff
path: root/playbooks/lxc.yml
diff options
context:
space:
mode:
authorjerome <jerome@xlinfo.fr>2025-02-12 15:05:59 +0100
committerjerome <jerome@xlinfo.fr>2025-02-12 15:05:59 +0100
commit3605d4eec0065530f692cb3e779e9ab50a0ca3e3 (patch)
treee20e657391c18d44af5d03f864a4c3db05b81690 /playbooks/lxc.yml
parent9041e48cd9b37e2bb39328ec21088ab48658f0f7 (diff)
downloadkvm-3605d4eec0065530f692cb3e779e9ab50a0ca3e3.tar.gz
kvm-3605d4eec0065530f692cb3e779e9ab50a0ca3e3.zip
correction
Diffstat (limited to 'playbooks/lxc.yml')
-rw-r--r--playbooks/lxc.yml72
1 files changed, 0 insertions, 72 deletions
diff --git a/playbooks/lxc.yml b/playbooks/lxc.yml
deleted file mode 100644
index 3fb1b18..0000000
--- a/playbooks/lxc.yml
+++ /dev/null
@@ -1,72 +0,0 @@
----
-- hosts: all
- tasks:
- - name: install lxc
- package:
- name: '{{item}}'
- state: present
- update_cache: yes
- with_items:
- - lxc
- - python3-lxc
-
- - name: Configuration de lxc
- copy:
- src: default.conf
- dest: /etc/lxc/default.conf
-
- - name: Creation d'un container rocky
- community.general.lxc_container:
- name: rocky-lxc
- template: download
- template_options: --dist rockylinux --release 9 --arch amd64
- state: started
- container_command: |
- sleep 5
- dnf install -y openssh-server python3
- systemctl enable --now sshd
-
-
- - name: Creation d'un container debian
- community.general.lxc_container:
- name: debian-lxc
- template: download
- template_options: --dist debian --release bookworm --arch amd64
- state: started
- container_command: |
- sleep 5
- apt install -y openssh-server python3
- systemctl enable --now ssh
-
- - name: copie des clefs ssh
- copy:
- src: "~/.ssh/id_rsa.pub"
- dest: "{{item}}"
- mode: "0600"
- with_items:
- - /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"
- register: ip_rocky
-
- - name: recuperation ip debian
- 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="[containers]\n{{ip_rocky.stdout}}\n{{ip_debian.stdout}}" dest="hosts"
-