|
@@ -0,0 +1,27 @@
|
|
|
|
|
+- name: configure 2nd network interface
|
|
|
|
|
+ hosts: servers
|
|
|
|
|
+ become: true
|
|
|
|
|
+
|
|
|
|
|
+ vars:
|
|
|
|
|
+ target_mac: "52:54:00:01:fa:0a"
|
|
|
|
|
+
|
|
|
|
|
+ tasks:
|
|
|
|
|
+ - name: ensure nm is running
|
|
|
|
|
+ service:
|
|
|
|
|
+ name: NetworkManager
|
|
|
|
|
+ state: started
|
|
|
|
|
+ enabled: yes
|
|
|
|
|
+
|
|
|
|
|
+ - name: find interface
|
|
|
|
|
+ set_fact:
|
|
|
|
|
+ the_interface: "{{ item }}"
|
|
|
|
|
+ when:
|
|
|
|
|
+ - ansible_facts[item]['macaddress'] is defined
|
|
|
|
|
+ - ansible_facts[item]['macaddress'] == target_mac
|
|
|
|
|
+ loop: "{{ ansible_facts['interfaces'] }}"
|
|
|
|
|
+
|
|
|
|
|
+ - name:
|
|
|
|
|
+ debug:
|
|
|
|
|
+ var: the_interface
|
|
|
|
|
+
|
|
|
|
|
+
|