From c7299d8499c5c6f4044bb702eda9fe33c7cb9a1a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Sep 2024 16:58:52 +0200 Subject: [PATCH] refs #8025 Hosts reorganized, clearer names for roles --- hosts | 102 +++++++++--------- playbooks/debian.yaml | 8 +- playbooks/test.yaml | 2 +- playbooks/windows-ping.yml | 2 +- playbooks/windows-update.yaml | 3 +- .../tasks/main.yaml | 0 roles/debian-guest/tasks/main.yaml | 3 + .../files/80-hotplug-cpu-mem.rules | 0 .../files/hotplug.cfg | 0 .../tasks/main.yaml | 3 - roles/linux-guest/tasks/main.yaml | 5 - 11 files changed, 60 insertions(+), 68 deletions(-) rename roles/{linux-base => debian-base}/tasks/main.yaml (100%) create mode 100644 roles/debian-guest/tasks/main.yaml rename roles/{linux-qemu => debian-qemu}/files/80-hotplug-cpu-mem.rules (100%) rename roles/{linux-qemu => debian-qemu}/files/hotplug.cfg (100%) rename roles/{linux-qemu => debian-qemu}/tasks/main.yaml (77%) delete mode 100644 roles/linux-guest/tasks/main.yaml diff --git a/hosts b/hosts index a824dc6..f22db36 100644 --- a/hosts +++ b/hosts @@ -1,36 +1,56 @@ [ceph] - ceph1 ansible_host=ceph1.core.dc.verdnatura.es ceph2 ansible_host=ceph2.core.dc.verdnatura.es ceph3 ansible_host=ceph3.core.dc.verdnatura.es -[cephGw] - +[ceph_gw] ceph-gw1 ansible_host=ceph-gw1.core.dc.verdnatura.es ceph-gw2 ansible_host=ceph-gw2.core.dc.verdnatura.es [pve] - pve01 ansible_host=pve01.core.dc.verdnatura.es pve02 ansible_host=pve02.core.dc.verdnatura.es pve03 ansible_host=pve03.core.dc.verdnatura.es pve04 ansible_host=pve04.core.dc.verdnatura.es pve05 ansible_host=pve04.core.dc.verdnatura.es -[coreHelper] +[infra:children] +ceph +ceph_gw +pve +[kube_master] +kube-master1 ansible_host=kube-master1.servers.dc.verdnatura.es +kube-master2 ansible_host=kube-master2.servers.dc.verdnatura.es +kube-master3 ansible_host=kube-master3.servers.dc.verdnatura.es +kube-master4 ansible_host=kube-master4.servers.dc.verdnatura.es +kube-master5 ansible_host=kube-master5.servers.dc.verdnatura.es + +[kube_worker] +kube-worker1 ansible_host=kube-worker1.servers.dc.verdnatura.es +kube-worker2 ansible_host=kube-worker2.servers.dc.verdnatura.es +kube-worker3 ansible_host=kube-worker3.servers.dc.verdnatura.es +kube-worker4 ansible_host=kube-worker4.servers.dc.verdnatura.es +kube-worker5 ansible_host=kube-worker5.servers.dc.verdnatura.es + +[kube_proxy] +kube-proxy1 ansible_host=kube-proxy1.servers.dc.verdnatura.es +kube-proxy2 ansible_host=kube-proxy2.servers.dc.verdnatura.es + +[kube_helper] +kube-helm ansible_host=kube-helm.servers.dc.verdnatura.es + +[kube:children] +kube_master +kube_worker +kube_proxy +kube_helper + +[core_helper] core-agent ansible_host=core-agent.core.dc.verdnatura.es core-proxy ansible_host=core-proxy.core.dc.verdnatura.es -[core:children] - -ceph -cephGw -pve -coreHelper - [servers] - dhcp1 ansible_host=dhcp1.servers.dc.verdnatura.es dhcp2 ansible_host=dhcp2.servers.dc.verdnatura.es ns1 ansible_host=ns1.servers.dc.verdnatura.es @@ -77,56 +97,32 @@ freeradiustotp ansible_host=freeradiustotp.servers.dc.verdnatura.es iventoy ansible_host=iventoy.servers.dc.verdnatura.es [windows] - -a3 ansible_host=a3.outsource.dc.verdnatura.es rsat ansible_host=rsat.servers.dc.verdnatura.es -contaplus ansible_host=contaplus.outsource.dc.verdnatura.es -dipole ansible_host=dipole.outsource.dc.verdnatura.es printserver ansible_host=printserver.servers.dc.verdnatura.es -sage ansible_host=sage.outsource.dc.verdnatura.es mrw ansible_host=mrw.servers.dc.verdnatura.es ts1 ansible_host=ts1.rds.dc.verdnatura.es ts2 ansible_host=ts2.rds.dc.verdnatura.es rds-licenses ansible_host=rds-licenses.rds.dc.verdnatura.es integra2 ansible_host=integra2.servers.dc.verdnatura.es + +[outsource] +a3 ansible_host=a3.outsource.dc.verdnatura.es +contaplus ansible_host=contaplus.outsource.dc.verdnatura.es +dipole ansible_host=dipole.outsource.dc.verdnatura.es +sage ansible_host=sage.outsource.dc.verdnatura.es docuware ansible_host=docuware.outsource.dc.verdnatura.es [backup] - -vm-backup ansible_host=vm-backup.backup.dc.verdnatura.es -backup-nas ansible_host=backup-nas.backup.dc.verdnatura.es -bacularis ansible_host=bacularis.backup.dc.verdnatura.es bacula-dir ansible_host=bacula-dir.backup.dc.verdnatura.es bacula-db ansible_host=bacula-db.backup.dc.verdnatura.es +bacularis ansible_host=bacularis.backup.dc.verdnatura.es +backup-nas ansible_host=backup-nas.backup.dc.verdnatura.es +tftp ansible_host=tftp.backup.dc.verdnatura.es +kube-backup ansible_host=kube-backup.backup.dc.verdnatura.es -[kubeMaster] - -kube-master1 ansible_host=kube-master1.servers.dc.verdnatura.es -kube-master2 ansible_host=kube-master2.servers.dc.verdnatura.es -kube-master3 ansible_host=kube-master3.servers.dc.verdnatura.es -kube-master4 ansible_host=kube-master4.servers.dc.verdnatura.es -kube-master5 ansible_host=kube-master5.servers.dc.verdnatura.es - -[kubeWorker] - -kube-worker1 ansible_host=kube-worker1.servers.dc.verdnatura.es -kube-worker2 ansible_host=kube-worker2.servers.dc.verdnatura.es -kube-worker3 ansible_host=kube-worker3.servers.dc.verdnatura.es -kube-worker4 ansible_host=kube-worker4.servers.dc.verdnatura.es -kube-worker5 ansible_host=kube-worker5.servers.dc.verdnatura.es - -[kubeProxy] - -kube-proxy1 ansible_host=kube-proxy1.servers.dc.verdnatura.es -kube-proxy2 ansible_host=kube-proxy2.servers.dc.verdnatura.es - -[kubeBackup] - -kube-helm ansible_host=kube-helm.servers.dc.verdnatura.es - -[kube:children] - -kubeMaster -kubeWorker -kubeProxy -kubeBackup +[guest:children] +core_helper +servers +windows +outsource +backup diff --git a/playbooks/debian.yaml b/playbooks/debian.yaml index 85a6d8a..f131f8c 100644 --- a/playbooks/debian.yaml +++ b/playbooks/debian.yaml @@ -5,10 +5,12 @@ name: awx - name: Configure base system import_role: - name: linux-base + name: debian-base - name: Configure guest import_role: - name: linux-guest + name: debian-guest + when: ansible_virtualization_role == 'guest' - name: Configure virtual machine import_role: - name: linux-qemu + name: debian-qemu + when: ansible_virtualization_role == 'guest' and ansible_virtualization_type == 'kvm' diff --git a/playbooks/test.yaml b/playbooks/test.yaml index 99e65fd..8032bff 100644 --- a/playbooks/test.yaml +++ b/playbooks/test.yaml @@ -2,4 +2,4 @@ tasks: - name: Test role import_role: - name: linux-fail2ban + name: linux-base diff --git a/playbooks/windows-ping.yml b/playbooks/windows-ping.yml index 2a141f4..4fef2f5 100644 --- a/playbooks/windows-ping.yml +++ b/playbooks/windows-ping.yml @@ -1,5 +1,5 @@ - name: Ping Windows hosts - hosts: windows + hosts: all tasks: - name: Ping Windows hosts ansible.windows.win_ping: \ No newline at end of file diff --git a/playbooks/windows-update.yaml b/playbooks/windows-update.yaml index 301bf77..b3181a1 100644 --- a/playbooks/windows-update.yaml +++ b/playbooks/windows-update.yaml @@ -1,5 +1,4 @@ -- hosts: windows - ignore_unreachable: yes +- hosts: all serial: 1 tasks: - block: diff --git a/roles/linux-base/tasks/main.yaml b/roles/debian-base/tasks/main.yaml similarity index 100% rename from roles/linux-base/tasks/main.yaml rename to roles/debian-base/tasks/main.yaml diff --git a/roles/debian-guest/tasks/main.yaml b/roles/debian-guest/tasks/main.yaml new file mode 100644 index 0000000..e1125c9 --- /dev/null +++ b/roles/debian-guest/tasks/main.yaml @@ -0,0 +1,3 @@ +- include_role: + name: linux-auth + when: false diff --git a/roles/linux-qemu/files/80-hotplug-cpu-mem.rules b/roles/debian-qemu/files/80-hotplug-cpu-mem.rules similarity index 100% rename from roles/linux-qemu/files/80-hotplug-cpu-mem.rules rename to roles/debian-qemu/files/80-hotplug-cpu-mem.rules diff --git a/roles/linux-qemu/files/hotplug.cfg b/roles/debian-qemu/files/hotplug.cfg similarity index 100% rename from roles/linux-qemu/files/hotplug.cfg rename to roles/debian-qemu/files/hotplug.cfg diff --git a/roles/linux-qemu/tasks/main.yaml b/roles/debian-qemu/tasks/main.yaml similarity index 77% rename from roles/linux-qemu/tasks/main.yaml rename to roles/debian-qemu/tasks/main.yaml index 80e5fac..cab7e7f 100644 --- a/roles/linux-qemu/tasks/main.yaml +++ b/roles/debian-qemu/tasks/main.yaml @@ -1,6 +1,3 @@ -- name: Skip if not a QEMU guest - meta: end_host - when: not (ansible_virtualization_type == 'kvm' and ansible_virtualization_role == 'guest') - name: Install QEMU guest agent apt: name: qemu-guest-agent diff --git a/roles/linux-guest/tasks/main.yaml b/roles/linux-guest/tasks/main.yaml deleted file mode 100644 index 1a5dd2a..0000000 --- a/roles/linux-guest/tasks/main.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Skip if not a guest - meta: end_host - when: ansible_virtualization_role != 'guest' -- include_role: - name: linux-auth