I’m new to ansible and a little googling hasn’t lead me quickly towards the right solution to my question.
What’s the ‘with the grain’ way to assign static network settings to a centos-7 host with ansible. I feel like this must be a pretty common need – and there must be a lot of people with questions about the right approach to take after all the changes to the network configuration system that comes with transitioning from rhel-6 to rhel-7 (namely: network-manager by default, consistent device naming from the kernel by default, systemd).
Prior to ansible I had been uninstalling network-manager and manually configuring hosts via /etc/init.d/network-scripts/ifcfg-* files – I think I could do the same thing – generating the correct ifcfg-* file using the ansible_default_ipv4[‘interface’] fact …?
"ansible_default_ipv4": {
"address": <snip>,
"alias": "enp3s0",
"gateway": <snip>,
"interface": "enp3s0",
"macaddress": <snip>,
"mtu": 1500,
"netmask": "255.255.255.128",
"network": <snip>,
"type": "ether"
}
Ansible far is so great and for this I want to make sure I’m not going unnecessarily against the ansible grain. I’m willing to not uninstall network-manager if there are good ways to manage the network-manager mediated interface configuration through ansible …