Merge pull request #5 from claranet/feat/newest-distrib-support

feat: newest distrib support
This commit is contained in:
Delibes Bechir BKWEDOU-NGAMENI 2023-08-07 13:28:54 +02:00 committed by GitHub
commit 9cf80214ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 72 additions and 72 deletions

View File

@ -9,60 +9,58 @@ parseable: true
use_default_rules: true use_default_rules: true
enable_list: enable_list:
command-shell: # Specific to use of command and shell modules # Specific to use of command and shell modules
- command-instead-of-module - command-instead-of-module
- command-instead-of-shell - command-instead-of-shell
- deprecated-command-syntax - deprecated-command-syntax
- inline-env-var - inline-env-var
- no-changed-when - no-changed-when
- risky-shell-pipe - risky-shell-pipe
core: # Related to internal implementation of the linter # Related to internal implementation of the linter
- internal-error - internal-error
- load-failure - load-failure
- parser-error - parser-error
- syntax-check - syntax-check
deprecations: # Indicate use of features that are removed from Ansible # Indicate use of features that are removed from Ansible
- deprecated-bare-vars - deprecated-bare-vars
- deprecated-command-syntax - deprecated-command-syntax
- deprecated-local-action - deprecated-local-action
- deprecated-module - deprecated-module
- no-jinja-when - no-jinja-when
- role-name - role-name
formatting: # Related to code-style # Related to code-style
- no-jinja-nesting - no-jinja-nesting
- no-tabs - no-tabs
- playbook-extension - playbook-extension
- risky-octal - risky-octal
- var-spacing - var-spacing
- yaml - yaml
idempotency: # Possible indication that consequent runs would produce different results # Possible indication that consequent runs would produce different results
- git-latest - git-latest
- hg-latest - hg-latest
- no-changed-when - no-changed-when
- package-latest - package-latest
idiom: # Anti-pattern detected, likely to cause undesired behavior # Anti-pattern detected, likely to cause undesired behavior
- command-instead-of-module - command-instead-of-module
- command-instead-of-shell - command-instead-of-shell
- empty-string-compare - empty-string-compare
- inline-env-var - inline-env-var
- literal-compare - literal-compare
- no-handler - no-handler
- no-loop-var-prefix - no-loop-var-prefix
- no-relative-paths - no-relative-paths
- unnamed-task - unnamed-task
- var-naming - var-naming
metadata: # Invalid metadata, likely related to galaxy, collections or roles # Invalid metadata, likely related to galaxy, collections or roles
- meta-incorrect - meta-incorrect
- meta-no-tags - meta-no-tags
- meta-video-links - meta-video-links
- role-name - role-name
unpredictability: - ignore-errors
- ignore-errors - partial-become
- partial-become - syntax-check
unskippable: # External linter which will also produce its own rule codes.
- syntax-check - yaml
yaml: # External linter which will also produce its own rule codes.
- yaml
warn_list: warn_list:
- experimental # all rules tagged as experimental - experimental # all rules tagged as experimental
@ -71,5 +69,6 @@ warn_list:
skip_list: skip_list:
- role-name # BUG - role-name # BUG
- name[casing]
verbosity: 1 verbosity: 1

View File

@ -38,11 +38,10 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
path: "${{ github.repository }}" path: "${{ github.repository }}"
- name: molecule - name: Run ansible lint
uses: robertdebock/molecule-action@4.0.9 uses: ansible/ansible-lint-action@main
with: with:
command: lint path: "."
scenario: ${{ fromJson(needs.setup.outputs.scenarios)[0] }}
test: test:
name: Scenario "${{ matrix.scenario }}" on ${{ matrix.config.image }}:${{ matrix.config.tag }} name: Scenario "${{ matrix.scenario }}" on ${{ matrix.config.image }}:${{ matrix.config.tag }}
@ -60,23 +59,26 @@ jobs:
- name: "redhat" - name: "redhat"
image: "registry.access.redhat.com/ubi8/ubi" image: "registry.access.redhat.com/ubi8/ubi"
tag: "latest" tag: "latest"
- image: "debian"
tag: "12"
- image: "debian" - image: "debian"
tag: "11" tag: "11"
- image: "debian" - image: "debian"
tag: "10" tag: "10"
- image: "ubuntu" - image: "ubuntu"
tag: "22.04" tag: "22.04"
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
path: "${{ github.repository }}" path: "${{ github.repository }}"
- name: molecule - name: molecule
uses: robertdebock/molecule-action@4.0.9 uses: gofrolist/molecule-action@v2
with: with:
# molecule_options: --debug
molecule_command: test
molecule_args: --scenario-name ${{ matrix.scenario }} -d docker
molecule_working_dir: "${{ github.repository }}"
env:
image: ${{ matrix.config.image }} image: ${{ matrix.config.image }}
tag: ${{ matrix.config.tag }} tag: ${{ matrix.config.tag }}
scenario: ${{ matrix.scenario }}
env:
name: ${{ matrix.config.name }}

View File

@ -2,7 +2,7 @@
[![Maintainer](https://img.shields.io/badge/maintained%20by-claranet-e00000?style=flat-square)](https://www.claranet.fr/) [![Maintainer](https://img.shields.io/badge/maintained%20by-claranet-e00000?style=flat-square)](https://www.claranet.fr/)
[![License](https://img.shields.io/github/license/claranet/ansible-role-motd?style=flat-square)](LICENSE) [![License](https://img.shields.io/github/license/claranet/ansible-role-motd?style=flat-square)](LICENSE)
[![Release](https://img.shields.io/github/v/release/claranet/ansible-role-motd?style=flat-square)](https://github.com/claranet/ansible-role-motd/releases) [![Release](https://img.shields.io/github/v/release/claranet/ansible-role-motd?style=flat-square)](https://github.com/claranet/ansible-role-motd/releases)
[![Status](https://img.shields.io/github/workflow/status/claranet/ansible-role-motd/Ansible%20Molecule?style=flat-square&label=tests)](https://github.com/claranet/ansible-role-motd/actions?query=workflow%3A%22Ansible+Molecule%22) [![Status](https://img.shields.io/github/actions/workflow/status/claranet/ansible-role-motd/molecule.yml?style=flat-square&label=tests&branch=main)](https://github.com/claranet/ansible-role-motd/actions?query=workflow%3A%22Ansible+Molecule%22)
[![Ansible version](https://img.shields.io/badge/ansible-%3E%3D2.9-black.svg?style=flat-square&logo=ansible)](https://github.com/ansible/ansible) [![Ansible version](https://img.shields.io/badge/ansible-%3E%3D2.9-black.svg?style=flat-square&logo=ansible)](https://github.com/ansible/ansible)
[![Ansible Galaxy](https://img.shields.io/badge/ansible-galaxy-black.svg?style=flat-square&logo=ansible)](https://galaxy.ansible.com/claranet/motd) [![Ansible Galaxy](https://img.shields.io/badge/ansible-galaxy-black.svg?style=flat-square&logo=ansible)](https://galaxy.ansible.com/claranet/motd)

View File

@ -6,11 +6,11 @@
pre_tasks: pre_tasks:
- name: "Update APT cache" - name: "Update APT cache"
apt: ansible.builtin.apt:
update_cache: true update_cache: true
when: when:
- ansible_pkg_mgr == "apt" - ansible_pkg_mgr == "apt"
- name: Install sshd - name: Install sshd
package: ansible.builtin.package:
name: openssh-server name: openssh-server

View File

@ -1,13 +1,14 @@
--- ---
dependency: dependency:
name: galaxy name: shell
command: python3 -m pip install pytest-testinfra
driver: driver:
name: docker name: docker
platforms: platforms:
# On "${name:-${image:-debian}", the last brace does not miss, it works like that... # On "${name:-${image:-debian}", the last brace does not miss, it works like that...
# The env var "name" should be used when the image variable refers to a full registry path like registry.access.redhat.com/ubi8/ubi # The env var should be used when the image variable refers to a full registry path like registry.access.redhat.com/ubi8/ubi
- name: claranet_motd_${name:-${image:-debian}-${tag:-latest}-${scenario:-default} - name: claranet_motd_${name:-${image:-debian}-${tag:-latest}-${scenario:-default}
image: ${image:-debian}:${tag:-latest} image: ${image:-debian}:${tag:-latest}
privileged: true privileged: true
@ -31,8 +32,6 @@ provisioner:
verifier: verifier:
name: testinfra name: testinfra
lint:
name: flake8
options: options:
verbose: true verbose: true
s: true s: true

View File

@ -3,7 +3,7 @@
ansible.builtin.include_tasks: disable_default_motd.yml ansible.builtin.include_tasks: disable_default_motd.yml
when: motd_disable_default_motd|bool when: motd_disable_default_motd|bool
- name: configure_motd | Apply template {{ motd_template }} on {{ _motd_file_path }} - name: "Configure_motd | Apply template {{ motd_template + ' in ' + _motd_file_path }}"
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ motd_template_prepend + _motd_template_content + motd_template_append }}" content: "{{ motd_template_prepend + _motd_template_content + motd_template_append }}"
dest: "{{ _motd_file_path }}" dest: "{{ _motd_file_path }}"
@ -13,7 +13,7 @@
tags: tags:
- molecule-idempotence-notest - molecule-idempotence-notest
- name: configure_motd | Add pam_exec {{ _motd_file_path }} in pam - name: Configure_motd | Add in pam pam_exec {{ _motd_file_path }}
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: "{{ item }}" path: "{{ item }}"
line: session optional pam_exec.so type=open_session stdout {{ _motd_file_path }} line: session optional pam_exec.so type=open_session stdout {{ _motd_file_path }}