diff options
| author | jerome <jerome@xlinfo.fr> | 2025-05-21 07:19:34 +0200 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2025-05-21 07:19:34 +0200 |
| commit | 833d1215a3cf3a430dc290f0ab585ca765e0092a (patch) | |
| tree | add4192589151d3af4f733d9b55f5fa16aaf65e4 | |
| parent | 6f7b35e304b2ded53dc0ca7e38b35d0630b94e6b (diff) | |
| download | terraform-ansible-833d1215a3cf3a430dc290f0ab585ca765e0092a.tar.gz terraform-ansible-833d1215a3cf3a430dc290f0ab585ca765e0092a.zip | |
script_local
| -rw-r--r-- | playbooks/lxc.yml | 18 | ||||
| -rwxr-xr-x | script_local | 4 | ||||
| -rw-r--r-- | terraform.tfvars | 2 |
3 files changed, 11 insertions, 13 deletions
diff --git a/playbooks/lxc.yml b/playbooks/lxc.yml index 3fb1b18..666cfb3 100644 --- a/playbooks/lxc.yml +++ b/playbooks/lxc.yml @@ -55,18 +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 + - name: inventaire remote_user: "jerome" become: no - local_action: shell ssh-keyscan -H {{ip_rocky.stdout}} >> ~/.ssh/known_hosts + copy: + content: "[containers]\n{{ip_rocky.stdout}}\n{{ip_debian.stdout}}" + dest: "hosts" + delegate_to: localhost - - name: inventaire + - name: ssh-keyscan remote_user: "jerome" become: no - local_action: copy content="[containers]\n{{ip_rocky.stdout}}\n{{ip_debian.stdout}}" dest="hosts" + shell: + cmd: ssh-keyscan -H -f hosts >> ~/.ssh/known_hosts + delegate_to: localhost diff --git a/script_local b/script_local index 7988c78..1d2b1fa 100755 --- a/script_local +++ b/script_local @@ -1,12 +1,10 @@ #!/bin/bash ssh-keygen -f ~/.ssh/known_hosts -R $1 ssh-keyscan -H $1 >> ~/.ssh/known_hosts -# nécessite droits sudo sans mot de passe à l'utilisateur local +# ip route nécessite droits sudo sans mot de passe à l'utilisateur local sudo ip route del 10.0.3.0/24 sudo ip route add 10.0.3.0/24 via $1 ansible-playbook -u ansible --become -i "$1," playbooks/lxc.yml -# remplacé par les local_actions dans le playbook lxc.yml -#ssh-keyscan -H -f playbooks/hosts >> ~/.ssh/known_hosts ansible-playbook -u root -i playbooks/hosts playbooks/lamp.yml diff --git a/terraform.tfvars b/terraform.tfvars index 950a326..1e0dc76 100644 --- a/terraform.tfvars +++ b/terraform.tfvars @@ -8,7 +8,7 @@ ########## machine debian ########## nom = "debian" -image = "/home/jerome/Téléchargements/isos/debian-12-generic-amd64.qcow2" +image = "/home/jerome/Téléchargements/isos/debian-11-generic-amd64.qcow2" #image = "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2" package = "apt update && apt install -y qemu-guest-agent && systemctl start qemu-guest-agent" |
