added ci pipeline
This commit is contained in:
parent
95467d081d
commit
950a646cc5
82
.gitlab-ci.yml
Normal file
82
.gitlab-ci.yml
Normal file
@ -0,0 +1,82 @@
|
||||
---
|
||||
stages:
|
||||
- verify
|
||||
- test-default
|
||||
- test-with-custom-config
|
||||
|
||||
image:
|
||||
name: registry.ednz.fr/forge/ansible-runner
|
||||
|
||||
variables:
|
||||
ANSIBLE_HOST_KEY_CHECKING: 'false'
|
||||
ANSIBLE_FORCE_COLOR: 'true'
|
||||
ANSIBLE_PYTHON_INTERPRETER: /usr/bin/python3
|
||||
DOCKER_AUTH_CONFIG: $CI_DOCKER_AUTH_CONFIG
|
||||
|
||||
.stage-test-default:
|
||||
stage: test-default
|
||||
|
||||
.stage-test-with-custom-config:
|
||||
stage: test-with-custom-config
|
||||
|
||||
.variables-ubuntu-2004:
|
||||
variables:
|
||||
MOLECULE_TEST_OS: "ubuntu2004"
|
||||
|
||||
.variables-ubuntu-2204:
|
||||
variables:
|
||||
MOLECULE_TEST_OS: "ubuntu2204"
|
||||
|
||||
.variables-debian-11:
|
||||
variables:
|
||||
MOLECULE_TEST_OS: "debian11"
|
||||
|
||||
.script-molecule-test-default:
|
||||
script:
|
||||
- molecule test
|
||||
|
||||
.script-molecule-test-with-custom-config:
|
||||
script:
|
||||
- molecule test -s with_custom_config
|
||||
|
||||
ansible-verify:
|
||||
stage: verify
|
||||
script:
|
||||
- yamllint . -c .yamllint
|
||||
- ansible-lint
|
||||
|
||||
ansible-test-ubuntu-2004-default:
|
||||
extends:
|
||||
- .stage-test-default
|
||||
- .variables-ubuntu-2004
|
||||
- .script-molecule-test-default
|
||||
|
||||
ansible-test-ubuntu-2204-default:
|
||||
extends:
|
||||
- .stage-test-default
|
||||
- .variables-ubuntu-2204
|
||||
- .script-molecule-test-default
|
||||
|
||||
ansible-test-debian-11-default:
|
||||
extends:
|
||||
- .stage-test-default
|
||||
- .variables-debian-11
|
||||
- .script-molecule-test-default
|
||||
|
||||
ansible-test-ubuntu-2004-with-custom-config:
|
||||
extends:
|
||||
- .stage-test-with-custom-config
|
||||
- .variables-ubuntu-2004
|
||||
- .script-molecule-test-with-custom-config
|
||||
|
||||
ansible-test-ubuntu-2204-with-custom-config:
|
||||
extends:
|
||||
- .stage-test-with-custom-config
|
||||
- .variables-ubuntu-2204
|
||||
- .script-molecule-test-with-custom-config
|
||||
|
||||
ansible-test-debian-11-with-custom-config:
|
||||
extends:
|
||||
- .stage-test-with-custom-config
|
||||
- .variables-debian-11
|
||||
- .script-molecule-test-with-custom-config
|
@ -7,69 +7,69 @@ manage_netplan_search_domain: example.org
|
||||
manage_netplan_install: true
|
||||
manage_netplan_apply: false
|
||||
manage_netplan_configuration: {}
|
||||
# network:
|
||||
# version: 2
|
||||
# ethernets:
|
||||
# enp0s3:
|
||||
# dhcp4: true
|
||||
# enp0s8:
|
||||
# addresses:
|
||||
# - 192.168.250.10/24
|
||||
# - 192.168.250.11/24
|
||||
# nameservers:
|
||||
# addresses:
|
||||
# - 10.0.2.3
|
||||
# - 8.8.8.8
|
||||
# - 8.8.4.4
|
||||
# search:
|
||||
# # Custom variable
|
||||
# - "{{ manage_netplan_search_domain }}"
|
||||
# gateway4: 192.168.250.1
|
||||
# optional: true
|
||||
# routes:
|
||||
# - to: 0.0.0.0/0
|
||||
# via: 9.9.9.9
|
||||
# on-link: true
|
||||
# - to: 192.168.5.0/24
|
||||
# via: 192.168.5.1
|
||||
# table: 102
|
||||
# routing-policy:
|
||||
# - from: 192.168.5.0/24
|
||||
# table: 102
|
||||
# lo:
|
||||
# match:
|
||||
# name: lo
|
||||
# addresses: [7.7.7.7/32]
|
||||
# wifis:
|
||||
# wlp2s0b1:
|
||||
# dhcp4: no
|
||||
# dhcp6: no
|
||||
# addresses: [192.168.0.21/24]
|
||||
# gateway4: 192.168.0.1
|
||||
# access-points:
|
||||
# "network_ssid_name":
|
||||
# password: "**********"
|
||||
# bonds:
|
||||
# bond0:
|
||||
# dhcp4: yes
|
||||
# interfaces:
|
||||
# - enp0s3
|
||||
# - enp4s0
|
||||
# parameters:
|
||||
# # modes can be one of balance-rr, active-backup, balance-xor, broadcast,
|
||||
# # 802.3ad, balance-tlb, and balance-alb.
|
||||
# mode: active-backup
|
||||
# primary: enp0s3
|
||||
# bridges:
|
||||
# br0:
|
||||
# dhcp4: yes
|
||||
# interfaces:
|
||||
# - enp0s3
|
||||
# br0:
|
||||
# addresses: [10.3.99.25/24]
|
||||
# interfaces: [vlan15]
|
||||
# vlans:
|
||||
# vlan15:
|
||||
# accept-ra: no
|
||||
# id: 15
|
||||
# link: enp0s25
|
||||
# network:
|
||||
# version: 2
|
||||
# ethernets:
|
||||
# enp0s3:
|
||||
# dhcp4: true
|
||||
# enp0s8:
|
||||
# addresses:
|
||||
# - 192.168.250.10/24
|
||||
# - 192.168.250.11/24
|
||||
# nameservers:
|
||||
# addresses:
|
||||
# - 10.0.2.3
|
||||
# - 8.8.8.8
|
||||
# - 8.8.4.4
|
||||
# search:
|
||||
# # Custom variable
|
||||
# - "{{ manage_netplan_search_domain }}"
|
||||
# gateway4: 192.168.250.1
|
||||
# optional: true
|
||||
# routes:
|
||||
# - to: 0.0.0.0/0
|
||||
# via: 9.9.9.9
|
||||
# on-link: true
|
||||
# - to: 192.168.5.0/24
|
||||
# via: 192.168.5.1
|
||||
# table: 102
|
||||
# routing-policy:
|
||||
# - from: 192.168.5.0/24
|
||||
# table: 102
|
||||
# lo:
|
||||
# match:
|
||||
# name: lo
|
||||
# addresses: [7.7.7.7/32]
|
||||
# wifis:
|
||||
# wlp2s0b1:
|
||||
# dhcp4: no
|
||||
# dhcp6: no
|
||||
# addresses: [192.168.0.21/24]
|
||||
# gateway4: 192.168.0.1
|
||||
# access-points:
|
||||
# "network_ssid_name":
|
||||
# password: "**********"
|
||||
# bonds:
|
||||
# bond0:
|
||||
# dhcp4: yes
|
||||
# interfaces:
|
||||
# - enp0s3
|
||||
# - enp4s0
|
||||
# parameters:
|
||||
# # modes can be one of balance-rr, active-backup, balance-xor, broadcast,
|
||||
# # 802.3ad, balance-tlb, and balance-alb.
|
||||
# mode: active-backup
|
||||
# primary: enp0s3
|
||||
# bridges:
|
||||
# br0:
|
||||
# dhcp4: yes
|
||||
# interfaces:
|
||||
# - enp0s3
|
||||
# br0:
|
||||
# addresses: [10.3.99.25/24]
|
||||
# interfaces: [vlan15]
|
||||
# vlans:
|
||||
# vlan15:
|
||||
# accept-ra: no
|
||||
# id: 15
|
||||
# link: enp0s25
|
||||
|
@ -16,3 +16,12 @@ def test_netplan_storage(host):
|
||||
assert etc_netplan.user == "root"
|
||||
assert etc_netplan.group =="root"
|
||||
assert etc_netplan.mode == 0o755
|
||||
|
||||
def test_netplan_config_file(host):
|
||||
"""Validate netplan config file."""
|
||||
etc_netplan_config = host.file("/etc/netplan/ansible-config.yaml")
|
||||
assert etc_netplan_config.exists
|
||||
assert etc_netplan_config.user == "root"
|
||||
assert etc_netplan_config.group == "root"
|
||||
assert etc_netplan_config.mode == 0o644
|
||||
assert etc_netplan_config.content_string != ""
|
||||
|
@ -16,3 +16,12 @@ def test_netplan_storage(host):
|
||||
assert etc_netplan.user == "root"
|
||||
assert etc_netplan.group =="root"
|
||||
assert etc_netplan.mode == 0o755
|
||||
|
||||
def test_netplan_config_file(host):
|
||||
"""Validate netplan config file."""
|
||||
etc_netplan_config = host.file("/tmp/ansible-config.yaml")
|
||||
assert etc_netplan_config.exists
|
||||
assert etc_netplan_config.user == "root"
|
||||
assert etc_netplan_config.group == "root"
|
||||
assert etc_netplan_config.mode == 0o644
|
||||
assert etc_netplan_config.content_string != ""
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
# task/configure file for manage_netplan
|
||||
- name: "Configuring Netplan"
|
||||
- name: "Copy netplan configuration template into {{ manage_netplan_config_file }}"
|
||||
ansible.builtin.template:
|
||||
src: etc_netplan.yaml.j2
|
||||
dest: "{{ manage_netplan_config_file }}"
|
||||
|
@ -12,3 +12,11 @@
|
||||
vars:
|
||||
manage_apt_packages_list: "{{ manage_netplan_networkmanager_pkg }}"
|
||||
when: manage_netplan_renderer == 'NetworkManager'
|
||||
|
||||
- name: "Create directory /etc/netplan"
|
||||
ansible.builtin.file:
|
||||
path: "/etc/netplan"
|
||||
state: directory
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: '0755'
|
||||
|
Loading…
Reference in New Issue
Block a user