Primi passaggi testati OK.
This commit is contained in:
parent
a8529d4f72
commit
a05c2d997d
4 changed files with 20 additions and 11 deletions
|
@ -4,5 +4,6 @@
|
|||
- deploy_vars.yml
|
||||
roles:
|
||||
- fqdn
|
||||
- domsearch
|
||||
become: true
|
||||
become_user: root
|
||||
|
|
2
hosts
2
hosts
|
@ -1,2 +1,2 @@
|
|||
#localhost ansible_connection=local
|
||||
zorin ansible_hostname=192.168.33.243 ansible_user=utente
|
||||
zorin ansible_host=192.168.33.243 ansible_user=utente ansible_connection=ssh
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
- name: Identifichiamo il profilo di connessione di NetworkManager
|
||||
ansible.builtin.shell: >-
|
||||
set -o pipefail;
|
||||
nmcli connection | awk -F" " "/{{ nic }}/ { print $1 }'
|
||||
nmcli connection | awk -F' ' '/{{ nic }}/ { print $1 }'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: nm_connection
|
||||
|
@ -37,13 +37,19 @@
|
|||
ansible.builtin.command: dig +short {{ dcname.stdout | trim }}.
|
||||
register: dcipaddr
|
||||
|
||||
- name: Determino lo shortname del domain controller
|
||||
ansible.builtin.shell: echo "{{ dcname.stdout| trim }}" | cut -d '.' -f1
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: dcshortname
|
||||
|
||||
- name: Impostiamo qualche fact
|
||||
ansible.builtin.set_fact:
|
||||
dc.name: "{{ dcname.stdout | trim }}"
|
||||
dc.shortname: "{{ dc.name.split('.')[0] }}"
|
||||
dc.ipaddr: "{{ dcipaddr | trim }}"
|
||||
dc_name: "{{ dcname.stdout | trim }}"
|
||||
dc_shortname: "{{ dcshortname.stdout | trim }}"
|
||||
dc_ipaddr: "{{ dcipaddr | trim }}"
|
||||
|
||||
- name: Verifichiamo che il PC effettivamente risolva gli shortname
|
||||
ansible.builtin.command: dig +short {{ dc.shortname }}
|
||||
register: check_shortnames
|
||||
failed_when: check_shortnames.stdout|trim != {{ dc.ipaddr }}
|
||||
ansible.builtin.command: ping -c3 {{ dc_shortname }}
|
||||
register: check_shortname
|
||||
failed_when: check_shortname.rc != 0
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
# Sistemiamo un po' di impostazioni legate al dominio
|
||||
|
||||
- name: Impostazione del dominio
|
||||
ansible.builtin.file:
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/domainname
|
||||
content: |
|
||||
state: present
|
||||
create: true
|
||||
line: |-
|
||||
{{ domain }}
|
||||
owner: root
|
||||
group: root
|
||||
|
@ -19,4 +21,4 @@
|
|||
- name: Verifichiamo che tutto sia in ordine
|
||||
ansible.builtin.command: hostname -f
|
||||
register: returned_fqdn
|
||||
failed_when: returned_fqdn.stdout != "{{ ansible_hostname }}.{{ domain }}"
|
||||
failed_when: returned_fqdn.stdout|trim != ansible_hostname + '.' + domain
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue