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
This commit is contained in:
Dmitriy Rabotyagov 2024-02-28 16:37:10 +01:00 committed by Dmitriy Rabotyagov
parent 41f2fc7432
commit f99a5a85af
3 changed files with 10 additions and 6 deletions

View File

@ -33,3 +33,7 @@ frr_bgpd_config: []
frr_bgpd_enable: "{{ (frr_bgpd_config | length > 0) }}" frr_bgpd_enable: "{{ (frr_bgpd_config | length > 0) }}"
frr_daemons: frr_daemons:
bgpd: "{{ frr_bgpd_enable }}" bgpd: "{{ frr_bgpd_enable }}"
frr_repos_keys: "{{ _frr_repos_keys | default([]) }}"
frr_repos: "{{ _frr_repos | default([]) }}"
frr_distro_packages: "{{ _frr_distro_packages | default([]) }}"

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
frr_repos_keys: _frr_repos_keys:
- id: 4A56C7738BB3F81595A805D2A832769908F13ED1 - id: 4A56C7738BB3F81595A805D2A832769908F13ED1
url: "https://deb.frrouting.org/frr/keys.asc" url: "https://deb.frrouting.org/frr/keys.asc"
state: present state: present
@ -24,11 +24,11 @@ frr_repos_keys:
url: "https://deb.frrouting.org/frr/keys.asc" url: "https://deb.frrouting.org/frr/keys.asc"
state: present state: present
frr_repos: _frr_repos:
- repo: "deb {{ apt_repo_url | default('https://deb.frrouting.org/frr ' ~ ansible_facts['distribution_release'] ~ ' frr-stable') }}" - repo: "deb {{ apt_repo_url | default('https://deb.frrouting.org/frr ' ~ ansible_facts['distribution_release'] ~ ' frr-stable') }}"
state: present state: present
filename: "frr" filename: "frr"
frr_distro_packages: _frr_distro_packages:
- frr - frr
- frr-pythontools - frr-pythontools

View File

@ -13,10 +13,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
frr_repos_keys: _frr_repos_keys:
- key: /etc/pki/rpm-gpg/RPM-GPG-KEY-FRR - key: /etc/pki/rpm-gpg/RPM-GPG-KEY-FRR
frr_repos: _frr_repos:
- name: frr - name: frr
filename: frr-stable filename: frr-stable
description: "FRRouting Packages for Enterprise Linux $releasever - $basearch" description: "FRRouting Packages for Enterprise Linux $releasever - $basearch"
@ -28,6 +28,6 @@ frr_repos:
baseurl: https://rpm.frrouting.org/repo/el$releasever/extras baseurl: https://rpm.frrouting.org/repo/el$releasever/extras
gpgkey: "file://{{ frr_repos_keys | map(attribute='key') | join('file://') }}" gpgkey: "file://{{ frr_repos_keys | map(attribute='key') | join('file://') }}"
frr_distro_packages: _frr_distro_packages:
- frr - frr
- frr-pythontools - frr-pythontools