Refactor roles to support new variable schema

Add common-env and docker roles
This commit is contained in:
2020-03-17 22:51:10 -04:00
parent 1f3ca79d04
commit dc1395daf1
14 changed files with 144 additions and 112 deletions

View File

@@ -1,33 +1,31 @@
---
- import_tasks: packages.yml
- name: Delete networkd config directory
- name: Configure networking via systemd
become: true
file:
path: /etc/systemd/network
state: absent
when: omni_networking is defined
block:
- name: Delete networkd config directory
file:
path: /etc/systemd/network
state: absent
- name: Create the networkd config directory
become: true
file:
path: /etc/systemd/network
state: directory
- name: Create the networkd config directory
file:
path: /etc/systemd/network
state: directory
- name: Make network files
when: networking is defined
become: true
template:
src: network.j2
dest: "/etc/systemd/network/{{ item.key }}.network"
loop: "{{ networking | dict2items }}"
- name: Make network files
template:
src: network.j2
dest: "/etc/systemd/network/{{ item.key }}.network"
loop: "{{ omni_networking | dict2items }}"
- name: Make netdev files
when: networking is defined
become: true
template:
src: netdev.j2
dest: "/etc/systemd/network/{{ item.0.key + '.' + item.1 }}.netdev"
loop: "{{ networking | dict2items | subelements('value.vlans', true) }}"
- name: Make netdev files
template:
src: netdev.j2
dest: "/etc/systemd/network/{{ item.0.key + '.' + item.1 }}.netdev"
loop: "{{ omni_networking | dict2items | subelements('value.vlans', true) }}"
- import_tasks: services.yml

View File

@@ -21,14 +21,18 @@
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "8"
become: true
block:
- name: Install this super-legitimate and definitely vetted COPR repo
shell:
creates: /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:fschwarz:systemd-networkd.repo
cmd: dnf copr enable fschwarz/systemd-networkd
warn: false
# The systemd-networkd EPEL package is currently in the testing phase, so we have
# to enable the testing EPEL repo to install it. Note that this is also done in
# the packages role
# https://bugzilla.redhat.com/show_bug.cgi?id=1789146
- name: Enable EPEL-Testing repository on CentOS 8s
lineinfile:
path: /etc/yum.repos.d/epel-testing.repo
regexp: "enabled=(0|1)"
line: "enabled=1"
insertbefore: "^$"
firstmatch: true
- name: Install networkd
dnf:
state: latest
name:
# This now comes from aforementioned very good COPR repo
- systemd-networkd
name: systemd-networkd

View File

@@ -19,7 +19,7 @@
- systemd-networkd-wait-online
- name: Stop NetworkManager
when: restart_services | default(false) == true
when: omni_restart_services == true
become: true
systemd:
name: "{{ item }}"
@@ -29,6 +29,7 @@
- NetworkManager-wait-online
- name: Start systemd-networkd
when: omni_restart_services == true
become: true
systemd:
name: "{{ item }}"