Allow NetworkManager to work (if present)

This patch adds tasks that check to see if NetworkManager is
installed and running. If it is, the tasks allow NetworkManager
to handle the `lxcbr0` interface.

In addition, the `NetworkManager-wait-online.service` will be
enabled to ensure that all services that depend on networking will
wait for network configuration to be completed.

Partial-Bug: 1738467
Change-Id: I415241daccf22f03826062eea18b3b36b2d9e53e
This commit is contained in:
Major Hayden 2018-01-08 09:22:51 -06:00
parent 6b529de031
commit a468089727
No known key found for this signature in database
GPG Key ID: 737051E0C1011FB1
3 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,10 @@
---
features:
- |
The ``lxcbr0`` bridge now allows NetworkManager to control it, which
allows for networks to start in the correct order when the system boots.
In addition, the ``NetworkManager-wait-online.service`` is enabled to
ensure that all services that require networking to function, such as
``keepalived``, will only start when network configuration is complete.
These changes are only applied if a deployer is actively using
NetworkManager in their environment.

View File

@ -13,6 +13,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE(mhayden): One of three exit codes should be returned.
# 0 = service is running
# 3 = service is installed, but not running
# 4 = service is not installed, and not running
- name: Check if NetworkManager is running
command: systemctl status NetworkManager
changed_when: false
failed_when: false
register: networkmanager_check
tags:
- skip_ansible_lint
- name: Ensure network services wait on networking (if using NetworkManager)
service:
name: NetworkManager-wait-online.service
status: enabled
when: networkmanager_check.rc == 0
- name: Drop lxc net bridge
template:
src: "{{ item.src }}"

View File

@ -9,6 +9,6 @@ GATEWAY={{ lxc_net_gateway }}
{% endif %}
ONBOOT=yes
BOOTPROTO=none
NM_CONTROLLED=no
NM_CONTROLLED={{ (networkmanager_check.rc == 0) | ternary('yes', 'no') }}
DELAY=0
STP=no