From 1c7958c6d74ce45edc9dbf4ccc921ee092e9df7f Mon Sep 17 00:00:00 2001 From: ss75710541 <75710541@qq.com> Date: Wed, 20 Apr 2022 18:36:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9B=A0Rocky=20Linux?= =?UTF-8?q?=208.5=20=E9=85=8D=E7=BD=AE=E5=A4=96=E7=BD=91IP=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=AF=BC=E8=87=B4=E7=9A=84=E6=B7=BB=E5=8A=A0k8s=20nod?= =?UTF-8?q?e=20=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/host-init/handlers/main.yml | 2 +- roles/host-init/tasks/publicInterface.yml | 3 +-- roles/host-init/templates/ifcfg-pip.j2 | 8 -------- 3 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 roles/host-init/templates/ifcfg-pip.j2 diff --git a/roles/host-init/handlers/main.yml b/roles/host-init/handlers/main.yml index f3d1c56..531aa8c 100644 --- a/roles/host-init/handlers/main.yml +++ b/roles/host-init/handlers/main.yml @@ -17,7 +17,7 @@ become: yes - name: restart network - service: name=network state=restarted + service: name=NetworkManager state=restarted become: yes - name: restart resolved diff --git a/roles/host-init/tasks/publicInterface.yml b/roles/host-init/tasks/publicInterface.yml index 3dbd0dd..2e46665 100644 --- a/roles/host-init/tasks/publicInterface.yml +++ b/roles/host-init/tasks/publicInterface.yml @@ -1,4 +1,3 @@ - name: Configure the public network card - template: src=ifcfg-pip.j2 dest=/etc/sysconfig/network-scripts/ifcfg-pip0 owner=root group=root mode=644 - notify: restart network + shell: nmcli connection add type tun ifname pip0 con-name pip0 mode tap ip4 {{ advertise_address }}/24 tags: publicNetwork diff --git a/roles/host-init/templates/ifcfg-pip.j2 b/roles/host-init/templates/ifcfg-pip.j2 deleted file mode 100644 index 059fb0a..0000000 --- a/roles/host-init/templates/ifcfg-pip.j2 +++ /dev/null @@ -1,8 +0,0 @@ -DEVICE=pip0 -ONBOOT=yes -BOOTPROTO=static -IPADDR={{ advertise_address }} -NETMASK=255.255.255.255 -PERFIX=32 -USERCTL=no -TYPE=Tap