mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
Instead, of having the tasks call the "network_connections.py" library for each connection profile individually (using with_items), pass all profiles at once. The advantage is: - the module can validate the input arguments better as it has access to all profiles. For example, when a slave connection refers to another master profile from the same play. Previously, each invocation of the module only sees the current profile and cannot verify whether the reference is valid. - while configuring the network, the play might need to shortly disconnect the control connection. In the previous way, after tearing down the network the target host becomes unreachable for ansible and the following steps cannot be executed anymore. Now, all steps are done as a whole on the target host, via one connection. If the host becomes unreachable for a short time, that is not a problem as long as the connectivty is restored at the end. Ansible also supports to switch the host IP (or SSH port). With this new way, the ansible play can apply a bunch of profiles autonomously and the ansible play can potentially handle a changing IP configuration. |
||
|---|---|---|
| .. | ||
| roles | ||
| .gitignore | ||
| README.md | ||
| test-playbook-3.yml | ||
| test-playbook.yml | ||
TEST
git clone git://github.com/ansible/ansible.git --recursive
. ./ansible/hacking/env-setup
git clone git@github.com:NetworkManager/ansible-network-role.git
cd ./ansible-network-role/
cat <<EOF > ./TEST/inventory
[network-test]
v-rhel6 ansible_user=root network_iphost=196 network_mac=52:54:00:44:9f:ba
v-rhel7 ansible_user=root network_iphost=97 network_mac=52:54:00:05:f5:b3
EOF
../ansible/hacking/test-module -m ./library/network_connections.py -a 'provider=nm name=t-eth0 state=present type=ethernet' --check
ansible-playbook -i ./TEST/inventory -l '*rhel*' ./TEST/test-playbook-3.yml --verbose --check