Use FQCN for module calls

Change-Id: I30f58bbe116873990d77368f5d19d7259e2f6e47
This commit is contained in:
Dmitriy Rabotyagov
2024-12-26 18:04:31 +01:00
parent 970fab180c
commit ea208782d0
9 changed files with 32 additions and 32 deletions

View File

@@ -14,14 +14,14 @@
# limitations under the License. # limitations under the License.
- name: Restart frr - name: Restart frr
service: ansible.builtin.service:
name: frr name: frr
state: restarted state: restarted
enabled: true enabled: true
register: frr_restart register: frr_restart
- name: Reload frr - name: Reload frr
service: ansible.builtin.service:
name: frr name: frr
state: reloaded state: reloaded
enabled: true enabled: true

View File

@@ -11,7 +11,7 @@
debian: iputils-ping debian: iputils-ping
tasks: tasks:
- name: Install required packages - name: Install required packages
package: ansible.builtin.package:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
update_cache: true update_cache: true
@@ -22,4 +22,4 @@
- sudo - sudo
- name: Clear gathered facts - name: Clear gathered facts
meta: clear_facts ansible.builtin.meta: clear_facts

View File

@@ -17,11 +17,11 @@
hosts: all hosts: all
tasks: tasks:
- name: Wait after service restart - name: Wait after service restart
pause: ansible.builtin.pause:
seconds: 10 seconds: 10
- name: Ping vlans ip address - name: Ping vlans ip address
shell: | ansible.builtin.shell: |
set -e set -e
ping -c2 "{{ hostvars[inventory_hostname]['ansible_facts']['eth1']['ipv4']['address'] }}" ping -c2 "{{ hostvars[inventory_hostname]['ansible_facts']['eth1']['ipv4']['address'] }}"
changed_when: false changed_when: false
@@ -32,25 +32,25 @@
when: inventory_hostname == 'primary' when: inventory_hostname == 'primary'
- name: Check service state - name: Check service state
service_facts: ansible.builtin.service_facts:
- name: Fail if frr is down - name: Fail if frr is down
fail: ansible.builtin.fail:
msg: frr is not up msg: frr is not up
when: ansible_facts.services['frr.service'].state != 'running' when: ansible_facts.services['frr.service'].state != 'running'
- name: Get summary - name: Get summary
command: "vtysh -c 'show bgp summary'" ansible.builtin.command: "vtysh -c 'show bgp summary'"
register: _frr_get_summary register: _frr_get_summary
changed_when: false changed_when: false
- name: Get routes - name: Get routes
command: "vtysh -c 'show ip route'" ansible.builtin.command: "vtysh -c 'show ip route'"
register: _frr_get_routes register: _frr_get_routes
changed_when: false changed_when: false
- name: Fail if we're missing static routes - name: Fail if we're missing static routes
fail: ansible.builtin.fail:
msg: "We can't find route {{ item }}" msg: "We can't find route {{ item }}"
with_items: "{{ frr_staticd_routes }}" with_items: "{{ frr_staticd_routes }}"
when: when:
@@ -58,7 +58,7 @@
- item.split(' ')[-1] not in _frr_get_routes.stdout - item.split(' ')[-1] not in _frr_get_routes.stdout
- name: Fail if we're missing bgp routes - name: Fail if we're missing bgp routes
fail: ansible.builtin.fail:
msg: "We can't find route 192.168.1.0/24" msg: "We can't find route 192.168.1.0/24"
when: when:
- inventory_hostname == 'secondary' - inventory_hostname == 'secondary'

View File

@@ -14,10 +14,10 @@
# limitations under the License. # limitations under the License.
- name: Apply package management distro specific configuration - name: Apply package management distro specific configuration
include_tasks: "frr_install_{{ ansible_facts['pkg_mgr'] | lower }}.yml" ansible.builtin.include_tasks: "frr_install_{{ ansible_facts['pkg_mgr'] | lower }}.yml"
- name: Install required distro packages - name: Install required distro packages
package: ansible.builtin.package:
name: "{{ frr_distro_packages }}" name: "{{ frr_distro_packages }}"
state: present state: present
register: install_packages register: install_packages

View File

@@ -22,13 +22,13 @@
# NOTE(jrosser) remove this task for the 2025.2 release # NOTE(jrosser) remove this task for the 2025.2 release
- name: Clean up legacy repository config not in deb822 format - name: Clean up legacy repository config not in deb822 format
file: ansible.builtin.file:
path: "/etc/apt/sources.list.d/frr.list" path: "/etc/apt/sources.list.d/frr.list"
state: absent state: absent
register: _cleanup_apt_repositories register: _cleanup_apt_repositories
- name: Ensure python3-debian package is available - name: Ensure python3-debian package is available
apt: ansible.builtin.apt:
name: python3-debian name: python3-debian
- name: Manage apt repositories - name: Manage apt repositories
@@ -59,7 +59,7 @@
register: _manage_apt_repositories register: _manage_apt_repositories
- name: Update Apt cache # noqa: no-handler - name: Update Apt cache # noqa: no-handler
apt: ansible.builtin.apt:
update_cache: true update_cache: true
when: when:
- (_manage_apt_repositories is changed) or (_cleanup_apt_repositories is changed) - (_manage_apt_repositories is changed) or (_cleanup_apt_repositories is changed)

View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: If a keyfile is provided, copy the gpg keyfile to the key location - name: If a keyfile is provided, copy the gpg keyfile to the key location
copy: ansible.builtin.copy:
src: "gpg/{{ key.key | basename }}" src: "gpg/{{ key.key | basename }}"
dest: "{{ key.key }}" dest: "{{ key.key }}"
mode: '0644' mode: '0644'
@@ -27,7 +27,7 @@
delay: 2 delay: 2
- name: Configure repositories - name: Configure repositories
yum_repository: ansible.builtin.yum_repository:
name: "{{ repo.name }}" name: "{{ repo.name }}"
file: "{{ repo.filename }}" file: "{{ repo.filename }}"
description: "{{ repo.description }}" description: "{{ repo.description }}"

View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Enable integrated config - name: Enable integrated config
lineinfile: ansible.builtin.lineinfile:
create: true create: true
path: /etc/frr/vtysh.conf path: /etc/frr/vtysh.conf
regexp: '^(no)?\s?service integrated-vtysh-config$' regexp: '^(no)?\s?service integrated-vtysh-config$'
@@ -23,7 +23,7 @@
notify: Reload frr notify: Reload frr
- name: Write down integrated config - name: Write down integrated config
template: ansible.builtin.template:
src: frr.conf.j2 src: frr.conf.j2
dest: "{{ frr_integrated_config_path }}" dest: "{{ frr_integrated_config_path }}"
owner: frr owner: frr
@@ -33,7 +33,7 @@
notify: Reload frr notify: Reload frr
- name: Configure supported daemons - name: Configure supported daemons
lineinfile: ansible.builtin.lineinfile:
path: /etc/frr/daemons path: /etc/frr/daemons
line: "{{ item.key }}={{ item.value | bool | ternary('yes', 'no') }}" line: "{{ item.key }}={{ item.value | bool | ternary('yes', 'no') }}"
regexp: "^{{ item.key }}" regexp: "^{{ item.key }}"

View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Install vlan package - name: Install vlan package
package: ansible.builtin.package:
name: vlan name: vlan
state: present state: present
register: install_vlan register: install_vlan
@@ -23,13 +23,13 @@
delay: 2 delay: 2
- name: Load vlan modules # noqa: no-handler - name: Load vlan modules # noqa: no-handler
modprobe: ansible.builtin.modprobe:
name: 8021q name: 8021q
state: present state: present
when: install_vlan is changed when: install_vlan is changed
- name: Copy vlans config - name: Copy vlans config
template: ansible.builtin.template:
src: vlans.cfg.j2 src: vlans.cfg.j2
dest: "/etc/network/interfaces.d/vlan-{{ item.id }}.cfg" dest: "/etc/network/interfaces.d/vlan-{{ item.id }}.cfg"
mode: "0644" mode: "0644"
@@ -37,13 +37,13 @@
register: distribute_vlans register: distribute_vlans
- name: Stop interface # noqa: no-handler - name: Stop interface # noqa: no-handler
command: "ifdown {{ item.item['vlan-raw-device'] }}.{{ item.item.id }}" ansible.builtin.command: "ifdown {{ item.item['vlan-raw-device'] }}.{{ item.item.id }}"
with_items: "{{ distribute_vlans.results }}" with_items: "{{ distribute_vlans.results }}"
when: item is changed when: item is changed
changed_when: false changed_when: false
- name: Start interface # noqa: no-handler - name: Start interface # noqa: no-handler
command: "ifup {{ item.item['vlan-raw-device'] }}.{{ item.item.id }}" ansible.builtin.command: "ifup {{ item.item['vlan-raw-device'] }}.{{ item.item.id }}"
with_items: "{{ distribute_vlans.results }}" with_items: "{{ distribute_vlans.results }}"
when: item is changed when: item is changed
changed_when: false changed_when: false

View File

@@ -14,19 +14,19 @@
# limitations under the License. # limitations under the License.
- name: Gather variables for each operating system - name: Gather variables for each operating system
include_vars: "{{ ansible_facts['os_family'] | lower }}.yml" ansible.builtin.include_vars: "{{ ansible_facts['os_family'] | lower }}.yml"
- name: Create required vlan interfaces - name: Create required vlan interfaces
include_tasks: frr_vlans.yml ansible.builtin.include_tasks: frr_vlans.yml
when: frr_vlans | length > 0 when: frr_vlans | length > 0
- name: Gather network facts - name: Gather network facts
setup: ansible.builtin.setup:
gather_subset: gather_subset:
- network - network
- name: Install frr - name: Install frr
include_tasks: frr_install.yml ansible.builtin.include_tasks: frr_install.yml
- name: Service configuration - name: Service configuration
include_tasks: frr_post_install.yml ansible.builtin.include_tasks: frr_post_install.yml