Add group based on domainname if found

This commit is contained in:
Timo Makinen 2025-01-15 20:04:17 +00:00
parent 0579a20768
commit ec4812a157
3 changed files with 7 additions and 5 deletions

View file

@ -137,10 +137,6 @@ sftpbackup:
mongodb:
sqldb:
vultr:
hosts:
atl01.vultr.foo.sh:
fedora:
children:
gitearunner:

View file

@ -2,7 +2,7 @@
- name: Deploy KVM virtual machines
ansible.builtin.import_playbook: include/deploy-kvm-guest.yml
vars:
myhosts: ns:!vultr
myhosts: ns:!atl01.vultr.foo.sh
- name: Configure instance
hosts: ns

View file

@ -1,4 +1,10 @@
---
- name: Group by domainname
ansible.builtin.group_by:
key: "{{ inventory_hostname.split('.')[1] }}"
changed_when: false
when: inventory_hostname | split('.') | length == 4
- name: Setup ansible custom facts
ansible.builtin.file:
dest: "{{ item }}"