Issue
I have a CentOS7 box that I need to change from DHCP to Static IP. I am using the ansible code below and I keep getting message. I have installed the required packages for this to work, so I dont think that is the issue.
"FAILED! => {"changed": false, "msg": "Error: Failed to modify connection 'System ens192': No such method 'Update2'\n", "name": "System ens192", "rc": 1}"
I know the ifname is "ens192" not sure about the conn_name. I did a "nmcli connection show" and a "nmcli device show" but none of them seem to work.
I have tried for the conn_name "ens192, System ens192, my-en192" and I get the same error message just with the different conn_names.
I would ultimately like to have these values set by the gathering facts procedure, but not sure how to do this?
- name: Add an Ethernet connection with static IP configuration
nmcli:
conn_name: ens192
ifname: ens192
type: ethernet
ip4: 192.0.2.100/24
gw4: 192.0.2.1
state: present
Solution
"nmcli connection show" and a "nmcli device show" but none of them seem to work
It should work.
Did you install dependancies for this module? If not you can install them with ansible this way:
- name: install needed network manager libs
package:
name:
- NetworkManager-glib
- nm-connection-editor
- libsemanage-python
- policycoreutils-python
state: present
Or just yum install them.
Answered By - rolf82 Answer Checked By - Terry (WPSolving Volunteer)