Skip to content
Extraits de code Groupes Projets
Valider 778c03d7 rédigé par nono's avatar nono :computer:
Parcourir les fichiers

Add base for Molecule testing of the role via Podman

parent 0db5e22c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!4Draft: Resolve "Add continuous integration testing via Gitlab CI"
---
# Based on ansible-lint config
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
......@@ -2,7 +2,7 @@ galaxy_info:
author: nono
description: HedgeDoc
company: La Quadrature Du Net
role_name: hedgedocs_pad_lqdn # if absent directory name hosting role is used instead
role_name: ansible_role_hedgedocs # if absent directory name hosting role is used instead
namespace: lqdn # if absent, author is used instead
# If the issue tracker for your role is not on github, uncomment the
......@@ -18,7 +18,7 @@ galaxy_info:
# - CC-BY-4.0
license: GPL-3.0-only
min_ansible_version: 2.1
min_ansible_version: "2.1"
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
......@@ -32,7 +32,7 @@ galaxy_info:
platforms:
- name: Debian
versions:
- 11
- bookworm
# - name: SomePlatform
# versions:
# - all
......
FROM ubuntu
# ENV container docker
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends sudo systemd systemd-sysv \
build-essential wget libffi-dev libssl-dev \
python3-pip python3-dev python3-setuptools python3-wheel \
&& rm -rf /var/lib/apt/lists/* \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& rm -rf /lib/systemd/system/multi-user.target.wants/* \
&& rm -rf /etc/systemd/system/*.wants/* \
&& rm -rf /lib/systemd/system/local-fs.target.wants/* \
&& rm -rf /lib/systemd/system/sockets.target.wants/*udev* \
&& rm -rf /lib/systemd/system/sockets.target.wants/*initctl* \
&& rm -rf /lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup* \
&& rm -rf /lib/systemd/system/systemd-update-utmp* \
&& apt-get clean
# # Make sure systemd doesn't start gettys on tty
RUN rm -f /lib/systemd/system/multi-user.target.wants/getty.target
VOLUME ["/sys/fs/cgroup"]
CMD ["/lib/systemd/systemd"]
\ No newline at end of file
*******
Delegated driver installation guide
*******
Requirements
============
This driver is delegated to the developer. Up to the developer to implement
requirements.
Install
=======
This driver is delegated to the developer. Up to the developer to implement
requirements.
---
- name: Converge
hosts: all
vars:
service_hedgedocs_domain: "127.0.0.1"
hedgedoc_db_user: "hedgedocs"
hedgedoc_sql_password: "hedgedocs-sql-password"
hedgedoc_db_name: "hedgedocs"
hedgedoc_session_secret: "hedgedocs-secret"
hedgedoc_version: "1.9.7"
roles:
- ansible-role-hedgedocs
tasks:
- name: "Include hedgedocs-pad-lqdn"
- name: "Include ansible-role-hedgedocs"
include_role:
name: "hedgedocs-pad-lqdn"
name: "ansible-role-hedgedocs"
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ molecule_no_log }}"
tasks:
# TODO: Developer must implement and populate 'server' variable
- when: server.changed | default(false) | bool
block:
- name: Populate instance config dict
set_fact:
instance_conf_dict: {
'instance': "{{ }}",
'address': "{{ }}",
'user': "{{ }}",
'port': "{{ }}",
'identity_file': "{{ }}", }
with_items: "{{ server.results }}"
register: instance_config_dict
- name: Convert instance config dict to a list
set_fact:
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
- name: Dump instance config
copy:
content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}"
---
- name: Destroy
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ molecule_no_log }}"
tasks:
# Developer must implement.
# Mandatory configuration for Molecule to function.
- name: Populate instance config
set_fact:
instance_conf: {}
- name: Dump instance config
copy:
content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}"
when: server.changed | default(false) | bool
......@@ -2,15 +2,28 @@
dependency:
name: galaxy
driver:
name: vagrant
provider:
name: virtualbox
name: podman
platforms:
- name: instance
box: debian/bullseye64
memory: 512
cpus: 1
image: docker.io/geerlingguy/docker-debian10-ansible
tmpfs:
- /run
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
capabilities:
- SYS_ADMIN
command: "/lib/systemd/systemd"
pre_build_image: true
exposed_ports:
- 80/udp
- 80/tcp
# published_ports:
# - 0.0.0.0:8888:80/udp
# - 0.0.0.0:8888:80/tcp
provisioner:
name: ansible
verifier:
name: ansible
lint: |
yamllint .
\ No newline at end of file
---
- name: Prepare
hosts: all
vars:
service_url: "hedgedocs"
nginx_extra_http_options: |
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
nginx_vhosts:
- listen: "80"
server_name: "{{ service_url }}"
access_log: "/var/log/nginx/{{ service_url }}_access.log"
error_log: "/var/log/nginx/{{ service_url }}_error.log"
state: "present"
template: "{{ nginx_vhost_template }}"
filename: "{{ service_url }}.http.conf"
extra_parameters: |
location / {
proxy_pass http://127.0.0.1:3003;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /socket.io/ {
proxy_pass http://127.0.0.1:3003;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
roles:
- geerlingguy.nginx
- geerlingguy.nodejs
- geerlingguy.postgresql
# Install the requirements for the test ( Nginx, NodeJS, pSQL )
- src: geerlingguy.nginx
- src: geerlingguy.nodejs
- src: geerlingguy.postgresql
\ No newline at end of file
......@@ -6,5 +6,5 @@
gather_facts: false
tasks:
- name: Example assertion
assert:
ansible.builtin.assert:
that: true
localhost
---
- hosts: localhost
remote_user: root
roles:
- hedgedocs-pad-lqdn_
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter