Initial commit
Change-Id: I3faf848d4bd096827b81560a16fcfef2441365cb
This commit is contained in:
parent
c96799e084
commit
72aa27b649
13
.zuul.yaml
Normal file
13
.zuul.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
- job:
|
||||||
|
name: ffrouting-deploy
|
||||||
|
parent: base
|
||||||
|
run: tests/test.yml
|
||||||
|
nodeset: debian-buster
|
||||||
|
|
||||||
|
- project:
|
||||||
|
check:
|
||||||
|
jobs:
|
||||||
|
- ffrouting-deploy
|
||||||
|
gate:
|
||||||
|
jobs:
|
||||||
|
- ffrouting-deploy
|
14
defaults/main.yml
Normal file
14
defaults/main.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2020, VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
22
handlers/main.yml
Normal file
22
handlers/main.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2020, VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Restart frr
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
service:
|
||||||
|
name: frr
|
||||||
|
state: restarted
|
||||||
|
enabled: yes
|
31
tasks/frr_install.yml
Normal file
31
tasks/frr_install.yml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2020, VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Install frr
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
block:
|
||||||
|
- name: Apply package management distro specific configuration
|
||||||
|
include_tasks: "frr_install_{{ ansible_pkg_mgr | lower }}.yml"
|
||||||
|
|
||||||
|
- name: Install required distro packages
|
||||||
|
package:
|
||||||
|
name: "{{ frr_distro_packages }}"
|
||||||
|
state: present
|
||||||
|
register: install_packages
|
||||||
|
until: install_packages is success
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
||||||
|
notify: Restart frr
|
60
tasks/frr_install_apt.yml
Normal file
60
tasks/frr_install_apt.yml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2020, VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Install gpg tooling for key management
|
||||||
|
apt:
|
||||||
|
name: gnupg
|
||||||
|
state: present
|
||||||
|
register: _install_gpg
|
||||||
|
until: _install_gpg is success
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
||||||
|
|
||||||
|
- name: Add/Remove repositories gpg keys
|
||||||
|
apt_key:
|
||||||
|
id: "{{ key.id | default(omit) }}"
|
||||||
|
data: "{{ key.data | default(omit) }}"
|
||||||
|
keyserver: "{{ key.keyserver | default(omit) }}"
|
||||||
|
url: "{{ key.url | default(omit) }}"
|
||||||
|
state: "{{ key.state | default('present') }}"
|
||||||
|
with_items: "{{ frr_repos_keys }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: key
|
||||||
|
register: _add_apt_keys
|
||||||
|
until: _add_apt_keys is success
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
||||||
|
|
||||||
|
- name: Add/remove defined APT repositories
|
||||||
|
apt_repository:
|
||||||
|
repo: "{{ repo.repo }}"
|
||||||
|
state: "{{ repo.state | default('present') }}"
|
||||||
|
filename: "{{ repo.filename | default(omit) }}"
|
||||||
|
update_cache: no
|
||||||
|
with_items: "{{ frr_repos }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: repo
|
||||||
|
register: _adding_apt_repo
|
||||||
|
|
||||||
|
- name: Update Apt cache
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
when:
|
||||||
|
- _adding_apt_repo is changed
|
||||||
|
register: _update_apt_cache
|
||||||
|
until: _update_apt_cache is success
|
||||||
|
changed_when: false
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
20
tasks/main.yml
Normal file
20
tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2020, VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Gather variables for each operating system
|
||||||
|
include_vars: "{{ ansible_os_family | lower }}.yml"
|
||||||
|
|
||||||
|
- name: Install frr
|
||||||
|
include_tasks: frr_install.yml
|
32
tests/test.yml
Normal file
32
tests/test.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2020, VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Installing frr
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- frrouting
|
||||||
|
|
||||||
|
post_tasks:
|
||||||
|
- name: wait after service restart
|
||||||
|
pause:
|
||||||
|
seconds: 30
|
||||||
|
|
||||||
|
- name: Check service state
|
||||||
|
service_facts:
|
||||||
|
|
||||||
|
- name: Fail if frr is down
|
||||||
|
fail:
|
||||||
|
msg: frr is not up
|
||||||
|
when: ansible_facts.services['frr'].state != 'running'
|
34
vars/debian.yml
Normal file
34
vars/debian.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2020, VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
frr_repos_keys:
|
||||||
|
- id: 4A56C7738BB3F81595A805D2A832769908F13ED1
|
||||||
|
url: "https://deb.frrouting.org/frr/keys.asc"
|
||||||
|
state: present
|
||||||
|
- id: 3D9968AC9AE7BE1169288DDB1FD5839895F57FDA
|
||||||
|
url: "https://deb.frrouting.org/frr/keys.asc"
|
||||||
|
state: present
|
||||||
|
- id: A90FC36D9429409798E9C2D874DEED43AB194DBF
|
||||||
|
url: "https://deb.frrouting.org/frr/keys.asc"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
frr_repos:
|
||||||
|
- repo: "deb {{ apt_repo_url | default('https://deb.frrouting.org/frr ' ~ ansible_distribution_release ~ ' frr-stable') }}"
|
||||||
|
state: present
|
||||||
|
filename: "frr"
|
||||||
|
|
||||||
|
frr_distro_packages:
|
||||||
|
- frr
|
||||||
|
- frr-pythontools
|
Loading…
Reference in New Issue
Block a user