Use FQCN for module calls
Change-Id: I30f58bbe116873990d77368f5d19d7259e2f6e47
This commit is contained in:
parent
970fab180c
commit
ea208782d0
@ -14,14 +14,14 @@
|
||||
# limitations under the License.
|
||||
|
||||
- name: Restart frr
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: frr
|
||||
state: restarted
|
||||
enabled: true
|
||||
register: frr_restart
|
||||
|
||||
- name: Reload frr
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: frr
|
||||
state: reloaded
|
||||
enabled: true
|
||||
|
@ -11,7 +11,7 @@
|
||||
debian: iputils-ping
|
||||
tasks:
|
||||
- name: Install required packages
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
update_cache: true
|
||||
@ -22,4 +22,4 @@
|
||||
- sudo
|
||||
|
||||
- name: Clear gathered facts
|
||||
meta: clear_facts
|
||||
ansible.builtin.meta: clear_facts
|
||||
|
@ -17,11 +17,11 @@
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Wait after service restart
|
||||
pause:
|
||||
ansible.builtin.pause:
|
||||
seconds: 10
|
||||
|
||||
- name: Ping vlans ip address
|
||||
shell: |
|
||||
ansible.builtin.shell: |
|
||||
set -e
|
||||
ping -c2 "{{ hostvars[inventory_hostname]['ansible_facts']['eth1']['ipv4']['address'] }}"
|
||||
changed_when: false
|
||||
@ -32,25 +32,25 @@
|
||||
when: inventory_hostname == 'primary'
|
||||
|
||||
- name: Check service state
|
||||
service_facts:
|
||||
ansible.builtin.service_facts:
|
||||
|
||||
- name: Fail if frr is down
|
||||
fail:
|
||||
ansible.builtin.fail:
|
||||
msg: frr is not up
|
||||
when: ansible_facts.services['frr.service'].state != 'running'
|
||||
|
||||
- name: Get summary
|
||||
command: "vtysh -c 'show bgp summary'"
|
||||
ansible.builtin.command: "vtysh -c 'show bgp summary'"
|
||||
register: _frr_get_summary
|
||||
changed_when: false
|
||||
|
||||
- name: Get routes
|
||||
command: "vtysh -c 'show ip route'"
|
||||
ansible.builtin.command: "vtysh -c 'show ip route'"
|
||||
register: _frr_get_routes
|
||||
changed_when: false
|
||||
|
||||
- name: Fail if we're missing static routes
|
||||
fail:
|
||||
ansible.builtin.fail:
|
||||
msg: "We can't find route {{ item }}"
|
||||
with_items: "{{ frr_staticd_routes }}"
|
||||
when:
|
||||
@ -58,7 +58,7 @@
|
||||
- item.split(' ')[-1] not in _frr_get_routes.stdout
|
||||
|
||||
- name: Fail if we're missing bgp routes
|
||||
fail:
|
||||
ansible.builtin.fail:
|
||||
msg: "We can't find route 192.168.1.0/24"
|
||||
when:
|
||||
- inventory_hostname == 'secondary'
|
||||
|
@ -14,10 +14,10 @@
|
||||
# limitations under the License.
|
||||
|
||||
- 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
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ frr_distro_packages }}"
|
||||
state: present
|
||||
register: install_packages
|
||||
|
@ -22,13 +22,13 @@
|
||||
|
||||
# NOTE(jrosser) remove this task for the 2025.2 release
|
||||
- name: Clean up legacy repository config not in deb822 format
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "/etc/apt/sources.list.d/frr.list"
|
||||
state: absent
|
||||
register: _cleanup_apt_repositories
|
||||
|
||||
- name: Ensure python3-debian package is available
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: python3-debian
|
||||
|
||||
- name: Manage apt repositories
|
||||
@ -59,7 +59,7 @@
|
||||
register: _manage_apt_repositories
|
||||
|
||||
- name: Update Apt cache # noqa: no-handler
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
when:
|
||||
- (_manage_apt_repositories is changed) or (_cleanup_apt_repositories is changed)
|
||||
|
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
- name: If a keyfile is provided, copy the gpg keyfile to the key location
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: "gpg/{{ key.key | basename }}"
|
||||
dest: "{{ key.key }}"
|
||||
mode: '0644'
|
||||
@ -27,7 +27,7 @@
|
||||
delay: 2
|
||||
|
||||
- name: Configure repositories
|
||||
yum_repository:
|
||||
ansible.builtin.yum_repository:
|
||||
name: "{{ repo.name }}"
|
||||
file: "{{ repo.filename }}"
|
||||
description: "{{ repo.description }}"
|
||||
|
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
- name: Enable integrated config
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
create: true
|
||||
path: /etc/frr/vtysh.conf
|
||||
regexp: '^(no)?\s?service integrated-vtysh-config$'
|
||||
@ -23,7 +23,7 @@
|
||||
notify: Reload frr
|
||||
|
||||
- name: Write down integrated config
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: frr.conf.j2
|
||||
dest: "{{ frr_integrated_config_path }}"
|
||||
owner: frr
|
||||
@ -33,7 +33,7 @@
|
||||
notify: Reload frr
|
||||
|
||||
- name: Configure supported daemons
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/frr/daemons
|
||||
line: "{{ item.key }}={{ item.value | bool | ternary('yes', 'no') }}"
|
||||
regexp: "^{{ item.key }}"
|
||||
|
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
- name: Install vlan package
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: vlan
|
||||
state: present
|
||||
register: install_vlan
|
||||
@ -23,13 +23,13 @@
|
||||
delay: 2
|
||||
|
||||
- name: Load vlan modules # noqa: no-handler
|
||||
modprobe:
|
||||
ansible.builtin.modprobe:
|
||||
name: 8021q
|
||||
state: present
|
||||
when: install_vlan is changed
|
||||
|
||||
- name: Copy vlans config
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: vlans.cfg.j2
|
||||
dest: "/etc/network/interfaces.d/vlan-{{ item.id }}.cfg"
|
||||
mode: "0644"
|
||||
@ -37,13 +37,13 @@
|
||||
register: distribute_vlans
|
||||
|
||||
- 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 }}"
|
||||
when: item is changed
|
||||
changed_when: false
|
||||
|
||||
- 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 }}"
|
||||
when: item is changed
|
||||
changed_when: false
|
||||
|
@ -14,19 +14,19 @@
|
||||
# limitations under the License.
|
||||
|
||||
- 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
|
||||
include_tasks: frr_vlans.yml
|
||||
ansible.builtin.include_tasks: frr_vlans.yml
|
||||
when: frr_vlans | length > 0
|
||||
|
||||
- name: Gather network facts
|
||||
setup:
|
||||
ansible.builtin.setup:
|
||||
gather_subset:
|
||||
- network
|
||||
|
||||
- name: Install frr
|
||||
include_tasks: frr_install.yml
|
||||
ansible.builtin.include_tasks: frr_install.yml
|
||||
|
||||
- name: Service configuration
|
||||
include_tasks: frr_post_install.yml
|
||||
ansible.builtin.include_tasks: frr_post_install.yml
|
||||
|
Loading…
x
Reference in New Issue
Block a user