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:
|
mongodb:
|
||||||
sqldb:
|
sqldb:
|
||||||
|
|
||||||
vultr:
|
|
||||||
hosts:
|
|
||||||
atl01.vultr.foo.sh:
|
|
||||||
|
|
||||||
fedora:
|
fedora:
|
||||||
children:
|
children:
|
||||||
gitearunner:
|
gitearunner:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
- name: Deploy KVM virtual machines
|
- name: Deploy KVM virtual machines
|
||||||
ansible.builtin.import_playbook: include/deploy-kvm-guest.yml
|
ansible.builtin.import_playbook: include/deploy-kvm-guest.yml
|
||||||
vars:
|
vars:
|
||||||
myhosts: ns:!vultr
|
myhosts: ns:!atl01.vultr.foo.sh
|
||||||
|
|
||||||
- name: Configure instance
|
- name: Configure instance
|
||||||
hosts: ns
|
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
|
- name: Setup ansible custom facts
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
dest: "{{ item }}"
|
dest: "{{ item }}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue