fix ansible-lint errors

This commit is contained in:
Sergey Malyuk
2025-12-18 17:20:17 +03:00
parent 72c812214a
commit 6a77bc6d56
16 changed files with 262 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
---
- name: Converge
hosts: all
roles:
- role: genlab.common.docker_ubuntu
- role: genlab.common.nginx_docker
site_config: "nginx/test.conf"
nginx_docker_custom_volumes:
- {from: /mnt, to: /mnt, mode: ro}

View File

@@ -0,0 +1,27 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: ubuntu
image: geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest
pre_build_image: true
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
provisioner:
name: ansible
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint .

View File

@@ -0,0 +1,19 @@
server {
listen 80;
# listen [::]:80;
server_name localhost;
access_log /var/log/nginx/host.access.log main;
location /health/startup {
add_header Content-Type text/plain;
return 200 'healthy';
}
## Redirect server error pages to the static page /50x.html
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root /usr/share/nginx/html;
# }
}

View File

@@ -0,0 +1 @@
this is a test

View File

@@ -0,0 +1,23 @@
---
- name: Verify
hosts: all
gather_facts: false
any_errors_fatal: true
pre_tasks:
- name: "Copy test file"
ansible.builtin.copy:
src: ./test.txt
dest: /mnt/test.txt
owner: root
group: root
mode: "0660"
tasks:
- name: "Verify custom directory was mounted inside container successfully"
register: nginx_docker_this
failed_when: nginx_docker_this.stdout != 'this is a test'
changed_when: false
community.docker.docker_container_exec:
container: nginx
command: cat /mnt/test.txt

View File

@@ -0,0 +1,8 @@
---
- name: Converge
hosts: all
roles:
- role: genlab.common.docker_ubuntu
- role: genlab.common.nginx_docker
site_config: "nginx/test.conf"

View File

@@ -0,0 +1,27 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: ubuntu
image: geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest
pre_build_image: true
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
provisioner:
name: ansible
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint .

View File

@@ -0,0 +1,19 @@
server {
listen 80;
# listen [::]:80;
server_name localhost;
access_log /var/log/nginx/host.access.log main;
location /health/startup {
add_header Content-Type text/plain;
return 200 'healthy';
}
## Redirect server error pages to the static page /50x.html
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root /usr/share/nginx/html;
# }
}

View File

@@ -0,0 +1,14 @@
---
- name: Verify
hosts: all
gather_facts: false
any_errors_fatal: true
tasks:
- name: "Make an HTTP query"
register: nginx_docker_this
failed_when: nginx_docker_this is failed or 'healthy' not in nginx_docker_this.content
ansible.builtin.uri:
url: "http://localhost:80/health/startup"
method: "GET"
return_content: true