Add group based on domainname if found
This commit is contained in:
parent
0579a20768
commit
ec4812a157
3 changed files with 7 additions and 5 deletions
|
@ -137,10 +137,6 @@ sftpbackup:
|
|||
mongodb:
|
||||
sqldb:
|
||||
|
||||
vultr:
|
||||
hosts:
|
||||
atl01.vultr.foo.sh:
|
||||
|
||||
fedora:
|
||||
children:
|
||||
gitearunner:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 }}"
|
||||
|
|
Loading…
Add table
Reference in a new issue