summaryrefslogtreecommitdiff
path: root/ansible/roles/proxmox_vm/tasks/set_network.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/proxmox_vm/tasks/set_network.yaml')
-rw-r--r--ansible/roles/proxmox_vm/tasks/set_network.yaml23
1 files changed, 11 insertions, 12 deletions
diff --git a/ansible/roles/proxmox_vm/tasks/set_network.yaml b/ansible/roles/proxmox_vm/tasks/set_network.yaml
index fb088ad..c75aa0f 100644
--- a/ansible/roles/proxmox_vm/tasks/set_network.yaml
+++ b/ansible/roles/proxmox_vm/tasks/set_network.yaml
@@ -1,5 +1,4 @@
----
-- name: "vmid {{ clone_result.vmid }}: set up static ip address on windows"
+- name: "{{ fqdn }} : set up static ip address on windows"
win_shell: |
Start-Transcript -Path C:\set_domain_network_log.txt -Append
Get-NetIpAddress -InterfaceAlias 'Ethernet' | Remove-NetIPAddress -Confirm:$false
@@ -19,36 +18,36 @@
ansible_winrm_transport: basic
ansible_winrm_server_cert_validation: ignore
-- name: "vmid {{ vmid }}: configure network for linux"
+- name: "{{ fqdn }} : configure network for linux"
block:
- - name: "vmid {{ vmid }}: get default interface"
+ - name: "{{ fqdn }} : get default interface"
ansible.builtin.shell: ip route get 8.8.8.8 | sed -n 's/.*dev \([^\ ]*\).*/\1/p'
register: interface_result
- - name: "vmid {{ vmid }}: set default interface variable"
+ - name: "{{ fqdn }} : set default interface variable"
ansible.builtin.set_fact:
linux_interface_name: "{{ interface_result.stdout }}"
netplan_ip_address: "{{ ip }}"
- - name: "vmid {{ vmid }}: find netplan configs in /etc/netplan"
+ - name: "{{ fqdn }} : find netplan configs in /etc/netplan"
ansible.builtin.find:
paths: /etc/netplan
recurse: yes
register: yaml_configs
- - name: "vmid {{ vmid }}: remove all netplan configs in /etc/netplan"
+ - name: "{{ fqdn }} : remove all netplan configs in /etc/netplan"
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop: "{{ yaml_configs.files }}"
- - name: "vmid {{ vmid }}: set netplan static ip address"
+ - name: "{{ fqdn }} : set netplan static ip address"
ansible.builtin.template:
src: static_ip_netplan.yaml.j2
dest: /etc/netplan/01-netcfg.yaml
mode: '0644'
- - name: "vmid {{ vmid }}: apply netplan configuration"
+ - name: "{{ fqdn }} : apply netplan configuration"
ansible.builtin.command: netplan apply
async: 15
poll: 0
@@ -61,10 +60,10 @@
ansible_port: "{{ linux_port }}"
ansible_host_key_checking: false
-- name: "vmid {{ clone_result.vmid }}: update ip to {{ ip }}"
+- name: "{{ fqdn }} : update ip to {{ ip }}"
set_fact:
ansible_host: "{{ ip }}"
-- name: "vmid {{ clone_result.vmid }}: pause execution for 1 minute to allow ip change and reconnect"
+- name: "{{ fqdn }} : pause execution for 3 minute to allow ip change and reconnect"
pause:
- minutes: 1
+ minutes: 3