Normalize package installs and networking for AIO
The bootstrap-host role has a ton of skipped tasks that cause delays in the gate jobs. This patch allows us to do a dynamic include and only run the tasks that are needed for each distribution. Change-Id: I783cdcd2223d8eca574f8f1d30e18d76e5710dac
This commit is contained in:
parent
8d9ae12568
commit
c056d18167
@ -13,100 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Ubuntu
|
||||
- block:
|
||||
- name: Ensure that apt supports HTTPS package sources
|
||||
apt:
|
||||
name: apt-transport-https
|
||||
state: present
|
||||
tags:
|
||||
- apt-install-prerequisites
|
||||
|
||||
- name: Determine the existing Ubuntu repo configuration
|
||||
command: 'grep -oP "^deb \K(\[?.*\]?.*ubuntu\S*\/?)(?= {{ ansible_distribution_release }} main)" /etc/apt/sources.list'
|
||||
register: ubuntu_repo
|
||||
when:
|
||||
- bootstrap_host_ubuntu_repo is not defined
|
||||
changed_when: false
|
||||
tags:
|
||||
- find-apt-repo
|
||||
|
||||
- name: Determine the existing Ubuntu Security repo configuration
|
||||
command: 'grep -oP "^deb \K(\[?.*\]?.*ubuntu\S*\/?)(?= {{ ansible_distribution_release }}-security main)" /etc/apt/sources.list'
|
||||
register: ubuntu_security_repo
|
||||
when:
|
||||
- bootstrap_host_ubuntu_security_repo is not defined
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
tags:
|
||||
- find-apt-security-repo
|
||||
|
||||
- name: Set apt repo facts based on discovered information
|
||||
set_fact:
|
||||
bootstrap_host_ubuntu_repo: "{{ ubuntu_repo.stdout_lines[0] }}"
|
||||
when:
|
||||
- bootstrap_host_ubuntu_repo is not defined
|
||||
- ubuntu_repo is defined
|
||||
|
||||
- name: Set apt security repo facts based on discovered information
|
||||
set_fact:
|
||||
bootstrap_host_ubuntu_security_repo: "{{ ubuntu_security_repo.stdout_lines[0] }}"
|
||||
when:
|
||||
- bootstrap_host_ubuntu_security_repo is not defined
|
||||
- ubuntu_security_repo is defined
|
||||
- ubuntu_security_repo.stdout_lines | length > 0
|
||||
|
||||
- name: Configure apt's sources.list (Ubuntu only)
|
||||
template:
|
||||
src: apt-sources.list.j2
|
||||
dest: /etc/apt/sources.list
|
||||
backup: yes
|
||||
when:
|
||||
- ansible_distribution == 'Ubuntu'
|
||||
- bootstrap_host_ubuntu_repo is defined
|
||||
register: apt_sources_configure
|
||||
|
||||
- name: Update apt-cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
when:
|
||||
- apt_sources_configure is defined
|
||||
- apt_sources_configure | changed
|
||||
register: _update
|
||||
retries: 5
|
||||
delay: 2
|
||||
until: _update | succeeded
|
||||
tags:
|
||||
- apt-cache-update
|
||||
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
|
||||
# CentOS
|
||||
- name: Install RDO package
|
||||
package:
|
||||
name: "{{ rdo_package }}"
|
||||
state: "present"
|
||||
register: install_cloud_rdo_package
|
||||
until: install_cloud_rdo_package | success
|
||||
retries: 5
|
||||
delay: 2
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
|
||||
# openSUSE
|
||||
- name: Add zypper cloud repositories
|
||||
zypper_repository:
|
||||
auto_import_keys: yes
|
||||
autorefresh: yes
|
||||
name: "{{ item.name }}"
|
||||
repo: "{{ item.uri }}"
|
||||
runrefresh: yes
|
||||
with_items: "{{ opensuse_openstack_repos }}"
|
||||
retries: 5
|
||||
delay: 2
|
||||
when:
|
||||
- ansible_pkg_mgr == 'zypper'
|
||||
- include: "install_packages_{{ ansible_os_family | lower }}.yml"
|
||||
|
||||
- name: Remove known problem packages
|
||||
package:
|
||||
|
77
tests/roles/bootstrap-host/tasks/install_packages_debian.yml
Normal file
77
tests/roles/bootstrap-host/tasks/install_packages_debian.yml
Normal file
@ -0,0 +1,77 @@
|
||||
---
|
||||
# Copyright 2015, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Ensure that apt supports HTTPS package sources
|
||||
apt:
|
||||
name: apt-transport-https
|
||||
state: present
|
||||
tags:
|
||||
- apt-install-prerequisites
|
||||
|
||||
- name: Determine the existing Ubuntu repo configuration
|
||||
command: 'grep -oP "^deb \K(\[?.*\]?.*ubuntu\S*\/?)(?= {{ ansible_distribution_release }} main)" /etc/apt/sources.list'
|
||||
register: ubuntu_repo
|
||||
when:
|
||||
- bootstrap_host_ubuntu_repo is not defined
|
||||
changed_when: false
|
||||
tags:
|
||||
- find-apt-repo
|
||||
|
||||
- name: Determine the existing Ubuntu Security repo configuration
|
||||
command: 'grep -oP "^deb \K(\[?.*\]?.*ubuntu\S*\/?)(?= {{ ansible_distribution_release }}-security main)" /etc/apt/sources.list'
|
||||
register: ubuntu_security_repo
|
||||
when:
|
||||
- bootstrap_host_ubuntu_security_repo is not defined
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
tags:
|
||||
- find-apt-security-repo
|
||||
|
||||
- name: Set apt repo facts based on discovered information
|
||||
set_fact:
|
||||
bootstrap_host_ubuntu_repo: "{{ ubuntu_repo.stdout_lines[0] }}"
|
||||
when:
|
||||
- bootstrap_host_ubuntu_repo is not defined
|
||||
- ubuntu_repo is defined
|
||||
|
||||
- name: Set apt security repo facts based on discovered information
|
||||
set_fact:
|
||||
bootstrap_host_ubuntu_security_repo: "{{ ubuntu_security_repo.stdout_lines[0] }}"
|
||||
when:
|
||||
- bootstrap_host_ubuntu_security_repo is not defined
|
||||
- ubuntu_security_repo is defined
|
||||
- ubuntu_security_repo.stdout_lines | length > 0
|
||||
|
||||
- name: Configure apt's sources.list
|
||||
template:
|
||||
src: apt-sources.list.j2
|
||||
dest: /etc/apt/sources.list
|
||||
backup: yes
|
||||
when:
|
||||
- bootstrap_host_ubuntu_repo is defined
|
||||
register: apt_sources_configure
|
||||
|
||||
- name: Update apt-cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
when:
|
||||
- apt_sources_configure is defined
|
||||
- apt_sources_configure | changed
|
||||
register: _update
|
||||
retries: 5
|
||||
delay: 2
|
||||
until: _update | succeeded
|
||||
tags:
|
||||
- apt-cache-update
|
23
tests/roles/bootstrap-host/tasks/install_packages_redhat.yml
Normal file
23
tests/roles/bootstrap-host/tasks/install_packages_redhat.yml
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
# Copyright 2015, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Install RDO package
|
||||
package:
|
||||
name: "{{ rdo_package }}"
|
||||
state: "present"
|
||||
register: install_cloud_rdo_package
|
||||
until: install_cloud_rdo_package | success
|
||||
retries: 5
|
||||
delay: 2
|
25
tests/roles/bootstrap-host/tasks/install_packages_suse.yml
Normal file
25
tests/roles/bootstrap-host/tasks/install_packages_suse.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
# Copyright 2015, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Add zypper cloud repositories
|
||||
zypper_repository:
|
||||
auto_import_keys: yes
|
||||
autorefresh: yes
|
||||
name: "{{ item.name }}"
|
||||
repo: "{{ item.uri }}"
|
||||
runrefresh: yes
|
||||
with_items: "{{ opensuse_openstack_repos }}"
|
||||
retries: 5
|
||||
delay: 2
|
@ -13,135 +13,12 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Ensure that /etc/network/interfaces.d/ exists (Debian)
|
||||
file:
|
||||
path: /etc/network/interfaces.d/
|
||||
state: directory
|
||||
tags:
|
||||
- networking-dir-create
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
|
||||
- name: Copy AIO network configuration (Debian)
|
||||
template:
|
||||
src: osa_interfaces.cfg.j2
|
||||
dest: /etc/network/interfaces.d/osa_interfaces.cfg
|
||||
register: osa_interfaces
|
||||
when:
|
||||
- bootstrap_host_aio_config | bool
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
tags:
|
||||
- networking-interfaces-file
|
||||
|
||||
- name: Copy network configuration (RedHat)
|
||||
template:
|
||||
src: "redhat_interface_{{ item.type | default('default') }}.cfg.j2"
|
||||
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.name | default('br-mgmt') }}"
|
||||
with_items: "{{ bridges }}"
|
||||
register: network_interfaces_rhel
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
|
||||
- name: Create alias file when required (RedHat)
|
||||
template:
|
||||
src: "redhat_interface_alias.cfg.j2"
|
||||
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.name | default('br-mgmt')}}:0"
|
||||
with_items: "{{ bridges }}"
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- item.alias is defined
|
||||
|
||||
- name: Put down post-up script for veth-peer interfaces (RedHat)
|
||||
template:
|
||||
src: "rpm_interface_{{ item[0] }}.cfg.j2"
|
||||
dest: "/etc/sysconfig/network-scripts/{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}"
|
||||
mode: "0755"
|
||||
with_nested:
|
||||
- [ "ifup-post", "ifdown-post" ]
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
|
||||
- name: Ensure the postup/postdown scripts are loaded (RedHat)
|
||||
lineinfile:
|
||||
dest: "/etc/sysconfig/network-scripts/{{ item[0] }}"
|
||||
line: ". /etc/sysconfig/network-scripts/{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}"
|
||||
insertbefore: "^exit 0"
|
||||
with_nested:
|
||||
- [ "ifup-post", "ifdown-post" ]
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
|
||||
- name: Copy network configuration (SUSE)
|
||||
template:
|
||||
src: "suse_interface_default.cfg.j2"
|
||||
dest: "/etc/sysconfig/network/ifcfg-{{ item.name | default('br-mgmt') }}"
|
||||
with_items: "{{ bridges }}"
|
||||
register: network_interfaces_suse
|
||||
when:
|
||||
- ansible_pkg_mgr == 'zypper'
|
||||
|
||||
- name: Put down post-up script for veth-peer interfaces (SUSE)
|
||||
template:
|
||||
src: "rpm_interface_{{ item[0] }}.cfg.j2"
|
||||
dest: "/etc/sysconfig/network/scripts/{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}"
|
||||
mode: "0755"
|
||||
with_nested:
|
||||
- [ "ifup-post", "ifdown-post" ]
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
||||
- ansible_pkg_mgr == 'zypper'
|
||||
|
||||
- name: Ensure the postup scripts are loaded (SUSE)
|
||||
lineinfile:
|
||||
dest: "/etc/sysconfig/network/ifcfg-{{ item[1].name | default('br-mgmt') }}"
|
||||
line: "POST_UP_SCRIPT=\"compat:suse:{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}\""
|
||||
with_nested:
|
||||
- [ "ifup-post" ]
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
||||
- ansible_pkg_mgr == 'zypper'
|
||||
|
||||
- name: Ensure the postdown scripts are loaded (SUSE)
|
||||
lineinfile:
|
||||
dest: "/etc/sysconfig/network/ifcfg-{{ item[1].name | default('br-mgmt') }}"
|
||||
line: "POST_DOWN_SCRIPT=\"compat:suse:{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}\""
|
||||
with_nested:
|
||||
- [ "ifdown-post" ]
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
||||
- ansible_pkg_mgr == 'zypper'
|
||||
|
||||
- name: Copy multinode network configuration (Debian)
|
||||
template:
|
||||
src: osa_interfaces_multinode.cfg.j2
|
||||
dest: /etc/network/interfaces.d/osa_interfaces.cfg
|
||||
register: osa_multinode_interfaces
|
||||
when:
|
||||
- not bootstrap_host_aio_config | bool
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
tags:
|
||||
- networking-interfaces-file
|
||||
|
||||
- name: Ensure our interfaces.d configuration files are loaded automatically (Debian)
|
||||
lineinfile:
|
||||
dest: /etc/network/interfaces
|
||||
line: "source /etc/network/interfaces.d/*.cfg"
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
tags:
|
||||
- networking-interfaces-load
|
||||
- include: "prepare_networking_{{ ansible_os_family | lower }}.yml"
|
||||
|
||||
- name: Shut down the network interfaces
|
||||
command: "ifdown {{ item.name }}"
|
||||
when:
|
||||
- osa_interfaces | changed or osa_multinode_interfaces | changed or network_interfaces_rhel | changed
|
||||
- network_interfaces | changed or (network_interfaces_multinode is defined and network_interfaces_multinode | changed)
|
||||
- item.enabled | default(True)
|
||||
with_items:
|
||||
- { name: br-mgmt }
|
||||
@ -156,7 +33,7 @@
|
||||
- name: Shut down the encapsulation network interfaces
|
||||
command: "ifdown {{ item.key }}"
|
||||
when:
|
||||
- osa_multinode_interfaces | changed
|
||||
- network_interfaces_multinode is defined and network_interfaces_multinode | changed
|
||||
- bootstrap_host_encapsulation_enabled | bool
|
||||
with_dict: "{{ bootstrap_host_encapsulation_interfaces }}"
|
||||
tags:
|
||||
@ -165,7 +42,7 @@
|
||||
- name: Start the encapsulation network interfaces
|
||||
command: "ifup {{ item.key }}"
|
||||
when:
|
||||
- osa_multinode_interfaces | changed
|
||||
- network_interfaces_multinode is defined and network_interfaces_multinode | changed
|
||||
- bootstrap_host_encapsulation_enabled | bool
|
||||
with_dict: "{{ bootstrap_host_encapsulation_interfaces }}"
|
||||
tags:
|
||||
@ -174,7 +51,7 @@
|
||||
- name: Start the network interfaces
|
||||
command: "ifup {{ item.name }}"
|
||||
when:
|
||||
- osa_interfaces | changed or network_interfaces_rhel | changed or network_interfaces_suse | changed
|
||||
- network_interfaces | changed
|
||||
- item.enabled | default(True)
|
||||
with_items:
|
||||
- { name: br-mgmt }
|
||||
|
@ -0,0 +1,48 @@
|
||||
---
|
||||
# Copyright 2015, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Ensure that /etc/network/interfaces.d/ exists
|
||||
file:
|
||||
path: /etc/network/interfaces.d/
|
||||
state: directory
|
||||
tags:
|
||||
- networking-dir-create
|
||||
|
||||
- name: Copy AIO network configuration
|
||||
template:
|
||||
src: osa_interfaces.cfg.j2
|
||||
dest: /etc/network/interfaces.d/osa_interfaces.cfg
|
||||
register: network_interfaces
|
||||
when:
|
||||
- bootstrap_host_aio_config | bool
|
||||
tags:
|
||||
- networking-interfaces-file
|
||||
|
||||
- name: Copy multinode network configuration
|
||||
template:
|
||||
src: osa_interfaces_multinode.cfg.j2
|
||||
dest: /etc/network/interfaces.d/osa_interfaces.cfg
|
||||
register: network_interfaces_multinode
|
||||
when:
|
||||
- not bootstrap_host_aio_config | bool
|
||||
tags:
|
||||
- networking-interfaces-file
|
||||
|
||||
- name: Ensure our interfaces.d configuration files are loaded automatically
|
||||
lineinfile:
|
||||
dest: /etc/network/interfaces
|
||||
line: "source /etc/network/interfaces.d/*.cfg"
|
||||
tags:
|
||||
- networking-interfaces-load
|
@ -0,0 +1,52 @@
|
||||
---
|
||||
# Copyright 2015, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Copy network configuration
|
||||
template:
|
||||
src: "redhat_interface_{{ item.type | default('default') }}.cfg.j2"
|
||||
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.name | default('br-mgmt') }}"
|
||||
with_items: "{{ bridges }}"
|
||||
register: network_interfaces
|
||||
|
||||
- name: Create alias file when required
|
||||
template:
|
||||
src: "redhat_interface_alias.cfg.j2"
|
||||
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.name | default('br-mgmt')}}:0"
|
||||
with_items: "{{ bridges }}"
|
||||
when:
|
||||
- item.alias is defined
|
||||
|
||||
- name: Put down post-up script for veth-peer interfaces
|
||||
template:
|
||||
src: "rpm_interface_{{ item[0] }}.cfg.j2"
|
||||
dest: "/etc/sysconfig/network-scripts/{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}"
|
||||
mode: "0755"
|
||||
with_nested:
|
||||
- [ "ifup-post", "ifdown-post" ]
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
||||
|
||||
|
||||
- name: Ensure the postup/postdown scripts are loaded
|
||||
lineinfile:
|
||||
dest: "/etc/sysconfig/network-scripts/{{ item[0] }}"
|
||||
line: ". /etc/sysconfig/network-scripts/{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}"
|
||||
insertbefore: "^exit 0"
|
||||
with_nested:
|
||||
- [ "ifup-post", "ifdown-post" ]
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
52
tests/roles/bootstrap-host/tasks/prepare_networking_suse.yml
Normal file
52
tests/roles/bootstrap-host/tasks/prepare_networking_suse.yml
Normal file
@ -0,0 +1,52 @@
|
||||
---
|
||||
# Copyright 2015, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Copy network configuration
|
||||
template:
|
||||
src: "suse_interface_default.cfg.j2"
|
||||
dest: "/etc/sysconfig/network/ifcfg-{{ item.name | default('br-mgmt') }}"
|
||||
with_items: "{{ bridges }}"
|
||||
register: network_interfaces
|
||||
|
||||
- name: Put down post-up script for veth-peer interfaces
|
||||
template:
|
||||
src: "rpm_interface_{{ item[0] }}.cfg.j2"
|
||||
dest: "/etc/sysconfig/network/scripts/{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}"
|
||||
mode: "0755"
|
||||
with_nested:
|
||||
- [ "ifup-post", "ifdown-post" ]
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
||||
|
||||
- name: Ensure the postup scripts are loaded
|
||||
lineinfile:
|
||||
dest: "/etc/sysconfig/network/ifcfg-{{ item[1].name | default('br-mgmt') }}"
|
||||
line: "POST_UP_SCRIPT=\"compat:suse:{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}\""
|
||||
with_nested:
|
||||
- [ "ifup-post" ]
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
||||
|
||||
- name: Ensure the postdown scripts are loaded
|
||||
lineinfile:
|
||||
dest: "/etc/sysconfig/network/ifcfg-{{ item[1].name | default('br-mgmt') }}"
|
||||
line: "POST_DOWN_SCRIPT=\"compat:suse:{{ item[0] }}-veth-{{ item[1].name | default('br-mgmt') }}-2-{{ item[1].veth_peer | default('eth1') }}\""
|
||||
with_nested:
|
||||
- [ "ifdown-post" ]
|
||||
- "{{ bridges }}"
|
||||
when:
|
||||
- item[1].veth_peer is defined
|
Loading…
x
Reference in New Issue
Block a user