From 1cb76ab4ca45ace749926897fd2c424807c66cfd Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Mon, 14 May 2018 15:26:00 -0500 Subject: [PATCH] Make the networkd role distro agnostic To make this role distro agnostic all of the variable configs have been moved into defaults which will source private variables when available using distro specific configs. This change will make it possible to run this role on any distro, even if there's no distro specific variable files. Change-Id: I547edd2052c7e136b79d99e1b8e75e3aee68689d Signed-off-by: Kevin Carter --- defaults/main.yml | 21 +++++++++++++++++++++ vars/main.yml | 3 --- vars/redhat-7.yml | 6 +++--- vars/suse-42.yml | 4 ++-- vars/ubuntu.yml | 4 ++-- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index f433645..838c4f8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -119,3 +119,24 @@ systemd_networks: [] # Cache: yes systemd_resolved: {} + +# Enable or Disable the availability of systemd-resolved. This option is a +# Boolean variable. + +systemd_resolved_available: "{{ _systemd_resolved_available | default(true) }}" + +# Specify the command used to update the initramfs. By default this will run +# "/bin/true" which is done because the command required to run should never +# be assumed. Distro specific config is available in vars otherwise deployers +# can set this as needed. + +systemd_networkd_update_initramfs: "{{ _systemd_networkd_update_initramfs | default('true') }}" + +# Provide a list of packages that are to be installed before this role is +# executed. + +# _systemd_networkd_distro_packages: +# - systemd-networkd +# - systemd-resolved + +systemd_networkd_distro_packages: "{{ _systemd_networkd_distro_packages | default([]) }}" diff --git a/vars/main.yml b/vars/main.yml index b8f0239..f78a119 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -15,6 +15,3 @@ ## APT Cache options cache_timeout: 600 - -# Supporting package required to make systemd-networkd function -systemd_networkd_distro_packages: [] diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index 8aa24c6..99fa449 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -systemd_networkd_distro_packages: +_systemd_networkd_distro_packages: - systemd-networkd - systemd-resolved -systemd_resolved_available: true +_systemd_resolved_available: true -systemd_networkd_update_initramfs: "dracut -f" +_systemd_networkd_update_initramfs: "dracut -f" diff --git a/vars/suse-42.yml b/vars/suse-42.yml index c449654..279be76 100644 --- a/vars/suse-42.yml +++ b/vars/suse-42.yml @@ -13,6 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -systemd_resolved_available: false +_systemd_resolved_available: false -systemd_networkd_update_initramfs: "dracut -f" +_systemd_networkd_update_initramfs: "dracut -f" diff --git a/vars/ubuntu.yml b/vars/ubuntu.yml index 653cb4e..3df92b0 100644 --- a/vars/ubuntu.yml +++ b/vars/ubuntu.yml @@ -13,6 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -systemd_resolved_available: true +_systemd_resolved_available: true -systemd_networkd_update_initramfs: "/usr/sbin/update-initramfs -u" +_systemd_networkd_update_initramfs: "/usr/sbin/update-initramfs -u"