Skip to content

Commit

Permalink
[WIP] Add switch scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
evrardjp committed Apr 10, 2021
1 parent bd907a3 commit b0810c0
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/molecule-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
ansible: ["2.9", "latest"]
scenario: ["ring", "star"]
scenario: ["ring", "star", "switch"]
steps:
- uses: actions/checkout@v2
- name: Install dependencies
Expand Down
15 changes: 15 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,18 @@
command: "ping -c 1 {{ item }}"
with_items: "{{ ansible_play_batch }}"
changed_when: false
register: _ping

- name: Show ping info
debug:
var: _ping

- name: Show vpn hosts data
command: "cat /etc/tinc/{{ tinc_netname }}/hosts/*"
changed_when: false
register: _hosts

- name: Debug hostfiles
debug:
var: _hosts

1 change: 1 addition & 0 deletions molecule/switch/Dockerfile.j2
1 change: 1 addition & 0 deletions molecule/switch/converge.yml
62 changes: 62 additions & 0 deletions molecule/switch/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
lint: |
set -e
yamllint .
ansible-lint -vv --exclude=.tox
scenario:
name: switch
dependency:
name: galaxy
driver:
name: docker
verifier:
name: ansible
provisioner:
name: ansible
log: True
options:
vvv: True
inventory:
group_vars:
tinc_nodes:
tinc_mode: switch
host_vars:
tinc-switch-1:
tinc_vpn_ip: 10.10.0.15
tinc-switch-2:
tinc_vpn_ip: 10.10.0.15
tinc-switch-3:
tinc_vpn_ip: 10.10.0.15
platforms:
- name: tinc-switch-1
image: ubuntu-20.04
privileged: true
command: /lib/systemd/systemd
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
etc_hosts: &etchosts
tinc-switch-1: 10.10.0.11
tinc-switch-2: 10.10.0.12
tinc-switch-3: 10.10.0.13
groups: &tincgroups
- tinc_nodes
- tinc_spine_nodes
- tinc_leaf_nodes

- name: tinc-switch-2
image: ubuntu-20.04
privileged: true
command: /lib/systemd/systemd
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
etc_hosts: *etchosts
groups: *tincgroups

- name: tinc-switch-3
image: ubuntu-20.04
privileged: true
command: /lib/systemd/systemd
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
etc_hosts: *etchosts
groups: *tincgroups
1 change: 1 addition & 0 deletions molecule/switch/verify.yml
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
lineinfile:
dest: "/etc/tinc/{{ tinc_netname }}/hosts/{{ inventory_hostname | replace('.','_') | replace('-','_') }}"
line: "-----END RSA PUBLIC KEY-----"
mode: "0600"
create: yes
check_mode: yes
register: contains_publickey_ending

Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
minversion = 1.8
envlist = ansible-{2.9,latest}-{ring,star,openwrt}
envlist = ansible-{2.9,latest}-{ring,star,openwrt,switch}
skipsdist = true

[testenv]
Expand All @@ -16,3 +16,4 @@ commands =
ring: molecule test []
star: molecule test -s star []
openwrt: molecule test -s openwrt []
switch: molecule test -s switch []

0 comments on commit b0810c0

Please sign in to comment.