-
Notifications
You must be signed in to change notification settings - Fork 0
/
hostnames.yml
41 lines (38 loc) · 1.27 KB
/
hostnames.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
- hosts: jupiter
become: true
tasks:
- shell: ip link set enp4s0f1 down
- shell: ip link set enp4s0f1 name eth1
- shell: ip link set eth1 up
- lineinfile: dest=/etc/sysconfig/network-scripts/ifcfg-enp4s0f1 line="NAME=enp4s0f1" state=absent
- lineinfile: dest=/etc/sysconfig/network-scripts/ifcfg-enp4s0f1 line="DEVICE=enp4s0f1" state=absent
- lineinfile: dest=/etc/sysconfig/network-scripts/ifcfg-enp4s0f1 line="NAME=eth1" state=present
- lineinfile: dest=/etc/sysconfig/network-scripts/ifcfg-enp4s0f1 line="DEVICE=eth1" state=present
- name: set enp4s0f1
stat: path=/etc/sysconfig/network-scripts/ifcfg-enp4s0f1
register: enp4s0f1
- name: rename to eth1
command: mv /etc/sysconfig/network-scripts/ifcfg-enp4s0f1 /etc/sysconfig/network-scripts/ifcfg-eth1
when: enp4s0f1.stat.exists
- name: restart network
service: name=network state=restarted
#- hosts: mania:eco:osa
# become: true
# tasks:
# - hostname: name={{ item }}
# with_items:
# - poseidon
# - zeus
# - jupiter
# - ceres
# - hera
# - dionysos
# - hermes
# - demeter
# - athena
# - maia
# - apollo
# - artemis
# - ares
# when: inventory_hostname == item