summaryrefslogtreecommitdiff
path: root/playbooks
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/lamp.yml2
-rw-r--r--playbooks/lamp/tasks/main.yml5
-rw-r--r--playbooks/lxc.yml22
3 files changed, 21 insertions, 8 deletions
diff --git a/playbooks/lamp.yml b/playbooks/lamp.yml
index bbfb572..59449ef 100644
--- a/playbooks/lamp.yml
+++ b/playbooks/lamp.yml
@@ -1,3 +1,3 @@
-- hosts: all
+- hosts: containers
roles:
- lamp
diff --git a/playbooks/lamp/tasks/main.yml b/playbooks/lamp/tasks/main.yml
index 17cf4d8..11e0600 100644
--- a/playbooks/lamp/tasks/main.yml
+++ b/playbooks/lamp/tasks/main.yml
@@ -38,9 +38,12 @@
mode: 0644
- name: installation de phpmyadmin
- include_tasks: '{{ansible_os_family}}-phpmyadmin.yml'
vars:
- apache: '{{apache}}'
+ include_tasks:
+ file: '{{ansible_os_family}}-phpmyadmin.yml'
+ apply:
+ tags: phpmyadmin
tags: phpmyadmin
- name: test user
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"