diff options
Diffstat (limited to 'ansible/roles/proxmox_vm/tasks/set_network.yaml')
-rw-r--r-- | ansible/roles/proxmox_vm/tasks/set_network.yaml | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/ansible/roles/proxmox_vm/tasks/set_network.yaml b/ansible/roles/proxmox_vm/tasks/set_network.yaml index c75aa0f..5420fc2 100644 --- a/ansible/roles/proxmox_vm/tasks/set_network.yaml +++ b/ansible/roles/proxmox_vm/tasks/set_network.yaml @@ -1,6 +1,7 @@ -- name: "{{ fqdn }} : set up static ip address on windows" +- name: "{{ fqdn }} : (windows) set up static ip address on" win_shell: | - Start-Transcript -Path C:\set_domain_network_log.txt -Append + New-Item -Path C:\Logs -ItemType Directory -Force + Start-Transcript -Path C:\Logs\set_domain_network_log.txt -Append Get-NetIpAddress -InterfaceAlias 'Ethernet' | Remove-NetIPAddress -Confirm:$false New-NetIPAddress -InterfaceAlias 'Ethernet' -IPAddress "{{ ip }}" -PrefixLength 24 -DefaultGateway "{{ gateway }}" Set-DnsClientServerAddress -InterfaceAlias 'Ethernet' -ServerAddresses "{{ dns }}" @@ -18,36 +19,36 @@ ansible_winrm_transport: basic ansible_winrm_server_cert_validation: ignore -- name: "{{ fqdn }} : configure network for linux" +- name: "{{ fqdn }} : (linux) configure network" block: - - name: "{{ fqdn }} : get default interface" + - name: "{{ fqdn }} : (linux) get default interface" ansible.builtin.shell: ip route get 8.8.8.8 | sed -n 's/.*dev \([^\ ]*\).*/\1/p' register: interface_result - - name: "{{ fqdn }} : set default interface variable" + - name: "{{ fqdn }} : (linux) set default interface variable" ansible.builtin.set_fact: linux_interface_name: "{{ interface_result.stdout }}" netplan_ip_address: "{{ ip }}" - - name: "{{ fqdn }} : find netplan configs in /etc/netplan" + - name: "{{ fqdn }} : (linux) find netplan configs in /etc/netplan" ansible.builtin.find: paths: /etc/netplan recurse: yes register: yaml_configs - - name: "{{ fqdn }} : remove all netplan configs in /etc/netplan" + - name: "{{ fqdn }} : (linux) remove all netplan configs in /etc/netplan" ansible.builtin.file: path: "{{ item.path }}" state: absent loop: "{{ yaml_configs.files }}" - - name: "{{ fqdn }} : set netplan static ip address" + - name: "{{ fqdn }} : (linux) set netplan static ip address" ansible.builtin.template: src: static_ip_netplan.yaml.j2 dest: /etc/netplan/01-netcfg.yaml mode: '0644' - - name: "{{ fqdn }} : apply netplan configuration" + - name: "{{ fqdn }} : (linux) apply netplan configuration" ansible.builtin.command: netplan apply async: 15 poll: 0 |