From f99a5a85af45a5f31cf6d7033035b91bffc70b6b Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Wed, 28 Feb 2024 16:37:10 +0100 Subject: [PATCH] Define repository and packages variables in role defaults Having these variables defined in vars makes impossible to override them with inventory group_vars or host_vars, since role vars have precedence over group_vars on the contrary to role defaults [1] [1] https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#understanding-variable-precedence Change-Id: I2f5f0aae5ec028c36f5f93b331ba8c46028a388b --- defaults/main.yml | 4 ++++ vars/debian.yml | 6 +++--- vars/redhat.yml | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 0b55962..75b345e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -33,3 +33,7 @@ frr_bgpd_config: [] frr_bgpd_enable: "{{ (frr_bgpd_config | length > 0) }}" frr_daemons: bgpd: "{{ frr_bgpd_enable }}" + +frr_repos_keys: "{{ _frr_repos_keys | default([]) }}" +frr_repos: "{{ _frr_repos | default([]) }}" +frr_distro_packages: "{{ _frr_distro_packages | default([]) }}" diff --git a/vars/debian.yml b/vars/debian.yml index 989919a..fa3f877 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -frr_repos_keys: +_frr_repos_keys: - id: 4A56C7738BB3F81595A805D2A832769908F13ED1 url: "https://deb.frrouting.org/frr/keys.asc" state: present @@ -24,11 +24,11 @@ frr_repos_keys: url: "https://deb.frrouting.org/frr/keys.asc" state: present -frr_repos: +_frr_repos: - repo: "deb {{ apt_repo_url | default('https://deb.frrouting.org/frr ' ~ ansible_facts['distribution_release'] ~ ' frr-stable') }}" state: present filename: "frr" -frr_distro_packages: +_frr_distro_packages: - frr - frr-pythontools diff --git a/vars/redhat.yml b/vars/redhat.yml index 0231fa6..e4f06d4 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -frr_repos_keys: +_frr_repos_keys: - key: /etc/pki/rpm-gpg/RPM-GPG-KEY-FRR -frr_repos: +_frr_repos: - name: frr filename: frr-stable description: "FRRouting Packages for Enterprise Linux $releasever - $basearch" @@ -28,6 +28,6 @@ frr_repos: baseurl: https://rpm.frrouting.org/repo/el$releasever/extras gpgkey: "file://{{ frr_repos_keys | map(attribute='key') | join('file://') }}" -frr_distro_packages: +_frr_distro_packages: - frr - frr-pythontools