base: Add ansible_server fact
This commit is contained in:
parent
20f1af0ee4
commit
0530194ac0
1 changed files with 14 additions and 0 deletions
|
@ -5,6 +5,20 @@
|
|||
changed_when: false
|
||||
when: inventory_hostname | split('.') | length == 4
|
||||
|
||||
- name: Get ansible server name
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- hostname
|
||||
- -f
|
||||
changed_when: false
|
||||
delegate_to: localhost
|
||||
register: result
|
||||
|
||||
- name: Store ansible server name
|
||||
ansible.builtin.set_fact:
|
||||
ansible_server: "{{ result.stdout }}"
|
||||
cacheable: false
|
||||
|
||||
- name: Setup ansible custom facts
|
||||
ansible.builtin.file:
|
||||
dest: "{{ item }}"
|
||||
|
|
Loading…
Add table
Reference in a new issue