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_install: true
|
||||||
manage_netplan_apply: false
|
manage_netplan_apply: false
|
||||||
manage_netplan_configuration: {}
|
manage_netplan_configuration: {}
|
||||||
# network:
|
# network:
|
||||||
# version: 2
|
# version: 2
|
||||||
# ethernets:
|
# ethernets:
|
||||||
# enp0s3:
|
# enp0s3:
|
||||||
# dhcp4: true
|
# dhcp4: true
|
||||||
# enp0s8:
|
# enp0s8:
|
||||||
# addresses:
|
# addresses:
|
||||||
# - 192.168.250.10/24
|
# - 192.168.250.10/24
|
||||||
# - 192.168.250.11/24
|
# - 192.168.250.11/24
|
||||||
# nameservers:
|
# nameservers:
|
||||||
# addresses:
|
# addresses:
|
||||||
# - 10.0.2.3
|
# - 10.0.2.3
|
||||||
# - 8.8.8.8
|
# - 8.8.8.8
|
||||||
# - 8.8.4.4
|
# - 8.8.4.4
|
||||||
# search:
|
# search:
|
||||||
# # Custom variable
|
# # Custom variable
|
||||||
# - "{{ manage_netplan_search_domain }}"
|
# - "{{ manage_netplan_search_domain }}"
|
||||||
# gateway4: 192.168.250.1
|
# gateway4: 192.168.250.1
|
||||||
# optional: true
|
# optional: true
|
||||||
# routes:
|
# routes:
|
||||||
# - to: 0.0.0.0/0
|
# - to: 0.0.0.0/0
|
||||||
# via: 9.9.9.9
|
# via: 9.9.9.9
|
||||||
# on-link: true
|
# on-link: true
|
||||||
# - to: 192.168.5.0/24
|
# - to: 192.168.5.0/24
|
||||||
# via: 192.168.5.1
|
# via: 192.168.5.1
|
||||||
# table: 102
|
# table: 102
|
||||||
# routing-policy:
|
# routing-policy:
|
||||||
# - from: 192.168.5.0/24
|
# - from: 192.168.5.0/24
|
||||||
# table: 102
|
# table: 102
|
||||||
# lo:
|
# lo:
|
||||||
# match:
|
# match:
|
||||||
# name: lo
|
# name: lo
|
||||||
# addresses: [7.7.7.7/32]
|
# addresses: [7.7.7.7/32]
|
||||||
# wifis:
|
# wifis:
|
||||||
# wlp2s0b1:
|
# wlp2s0b1:
|
||||||
# dhcp4: no
|
# dhcp4: no
|
||||||
# dhcp6: no
|
# dhcp6: no
|
||||||
# addresses: [192.168.0.21/24]
|
# addresses: [192.168.0.21/24]
|
||||||
# gateway4: 192.168.0.1
|
# gateway4: 192.168.0.1
|
||||||
# access-points:
|
# access-points:
|
||||||
# "network_ssid_name":
|
# "network_ssid_name":
|
||||||
# password: "**********"
|
# password: "**********"
|
||||||
# bonds:
|
# bonds:
|
||||||
# bond0:
|
# bond0:
|
||||||
# dhcp4: yes
|
# dhcp4: yes
|
||||||
# interfaces:
|
# interfaces:
|
||||||
# - enp0s3
|
# - enp0s3
|
||||||
# - enp4s0
|
# - enp4s0
|
||||||
# parameters:
|
# parameters:
|
||||||
# # modes can be one of balance-rr, active-backup, balance-xor, broadcast,
|
# # modes can be one of balance-rr, active-backup, balance-xor, broadcast,
|
||||||
# # 802.3ad, balance-tlb, and balance-alb.
|
# # 802.3ad, balance-tlb, and balance-alb.
|
||||||
# mode: active-backup
|
# mode: active-backup
|
||||||
# primary: enp0s3
|
# primary: enp0s3
|
||||||
# bridges:
|
# bridges:
|
||||||
# br0:
|
# br0:
|
||||||
# dhcp4: yes
|
# dhcp4: yes
|
||||||
# interfaces:
|
# interfaces:
|
||||||
# - enp0s3
|
# - enp0s3
|
||||||
# br0:
|
# br0:
|
||||||
# addresses: [10.3.99.25/24]
|
# addresses: [10.3.99.25/24]
|
||||||
# interfaces: [vlan15]
|
# interfaces: [vlan15]
|
||||||
# vlans:
|
# vlans:
|
||||||
# vlan15:
|
# vlan15:
|
||||||
# accept-ra: no
|
# accept-ra: no
|
||||||
# id: 15
|
# id: 15
|
||||||
# link: enp0s25
|
# link: enp0s25
|
||||||
|
@ -16,3 +16,12 @@ def test_netplan_storage(host):
|
|||||||
assert etc_netplan.user == "root"
|
assert etc_netplan.user == "root"
|
||||||
assert etc_netplan.group =="root"
|
assert etc_netplan.group =="root"
|
||||||
assert etc_netplan.mode == 0o755
|
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.user == "root"
|
||||||
assert etc_netplan.group =="root"
|
assert etc_netplan.group =="root"
|
||||||
assert etc_netplan.mode == 0o755
|
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
|
# task/configure file for manage_netplan
|
||||||
- name: "Configuring Netplan"
|
- name: "Copy netplan configuration template into {{ manage_netplan_config_file }}"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: etc_netplan.yaml.j2
|
src: etc_netplan.yaml.j2
|
||||||
dest: "{{ manage_netplan_config_file }}"
|
dest: "{{ manage_netplan_config_file }}"
|
||||||
|
@ -12,3 +12,11 @@
|
|||||||
vars:
|
vars:
|
||||||
manage_apt_packages_list: "{{ manage_netplan_networkmanager_pkg }}"
|
manage_apt_packages_list: "{{ manage_netplan_networkmanager_pkg }}"
|
||||||
when: manage_netplan_renderer == 'NetworkManager'
|
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