Skip to content

Commit 78272b9

Browse files
Refactor Molecule to support v24 (#14)
* add product codes for new agent versions * remove product codes for eol windows versions <23 * add Get-MSIProperties script to aid in gathering product codes * upgrade molecule to version 24.6 and refactor scenarios * remove deprecated molecule config from roles * refactor workflows for molecule 24.6 * set role-path to be optional * disable linting to test if refactor works * tweak pip install * set ansible version * fix variable * tweak ansible install * specifically install vagrant dependencies of molecule plugins * uninstall molecule-vagrant * force uninstall * revert install method for ansible * disable linting to validate refactor didn't break things * update action versions * comment molecule lint * increase win_async_startup_timeout * fix ansible-lint errors * test ansible-lint github action * manually configure ansible-lint * fixup yamllint to comply with ansible-lint * fix yamllint violations * fix lint errors * ansible-lit --fix * lint files * standardize role files on ansible-lint v24 rules * cleanup truthy and quotes in molecule scenarios * cleanup workspacefile * add runtime file * ansible-lint
1 parent 0eded10 commit 78272b9

File tree

175 files changed

+1777
-4357
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+1777
-4357
lines changed

.ansible-lint

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
# .ansible-lint
3+
4+
profile: production
5+
6+
# exclude_paths included in this file are parsed relative to this file's location
7+
# and not relative to the CWD of execution. CLI arguments passed to the --exclude
8+
# option are parsed relative to the CWD of execution.
9+
exclude_paths:
10+
- .cache/ # implicit unless exclude_paths is defined in config
11+
- .github
12+
13+
# Mock modules or roles in order to pass ansible-playbook --syntax-check
14+
# mock_modules:
15+
# - zuul_return
16+
# # note the foo.bar is invalid as being neither a module or a collection
17+
# - fake_namespace.fake_collection.fake_module
18+
# - fake_namespace.fake_collection.fake_module.fake_submodule
19+
mock_roles:
20+
- s1_agent_common
21+
22+
# Ansible-lint is able to recognize and load skip rules stored inside
23+
# `.ansible-lint-ignore` (or `.config/ansible-lint-ignore.txt`) files.
24+
# To skip a rule just enter filename and tag, like "playbook.yml package-latest"
25+
# on a new line.
26+
# Optionally you can add comments after the tag, prefixed by "#". We discourage
27+
# the use of skip_list below because that will hide violations from the output.
28+
# When putting ignores inside the ignore file, they are marked as ignored, but
29+
# still visible, making it easier to address later.
30+
skip_list:
31+
- var-naming[no-role-prefix]
32+
33+
# Ansible-lint does not fail on warnings from the rules or tags listed below
34+
warn_list:
35+
- galaxy[version-incorrect]
36+
37+
# Also recognize these versions of Ansible as supported:
38+
supported_ansible_also:
39+
- "2.16"

.github/actions/ci-setup/action.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ description: Sets up Python and Ansible for jobs during CI workflow
33

44
inputs:
55
ansible-version:
6-
description: 'Ansible Version'
6+
description: "Ansible Version"
77
required: true
88
python-version:
9-
description: 'Python Version'
9+
description: "Python Version"
1010
required: true
1111

1212
runs:
1313
using: composite
1414
steps:
1515
- name: Set up Python
16-
uses: actions/setup-python@v4
16+
uses: actions/setup-python@v5
1717
with:
1818
python-version: ${{ inputs.python-version }}
1919

@@ -25,5 +25,6 @@ runs:
2525
- name: Install requirements for molecule tests
2626
shell: bash
2727
run: |
28-
pip install molecule-vagrant yamllint ansible-lint flake8 pywinrm --disable-pip-version-check
28+
pip uninstall molecule-vagrant --yes
29+
pip install ansible-dev-tools pywinrm molecule molecule-plugins ansible-lint flake8 --disable-pip-version-check
2930
if [ -f requirements.txt ]; then pip install -r requirements.txt --disable-pip-version-check; fi

.github/workflows/ci-lint.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ on:
33
workflow_call:
44
inputs:
55
role-path:
6-
description: 'Relative path to the role to be linted'
6+
description: "Relative path to the role to be linted"
77
type: string
88
required: true
99

1010
jobs:
1111
molecule-lint:
12-
name: 'ansible-${{ matrix.versions.ansible }} (Python: ${{ matrix.versions.python }})'
12+
name: "ansible-${{ matrix.versions.ansible }} (Python: ${{ matrix.versions.python }})"
1313
runs-on: [self-hosted, Linux, X64, ansible-collection]
1414
env:
1515
ANSIBLE_FORCE_COLOR: 1 # allows ansible colors to be passed to GitHub Actions
@@ -20,15 +20,17 @@ jobs:
2020
versions:
2121
# ansible-core upstream development supports 3 releases at a time
2222
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html
23-
- ansible: stable-2.12 # EOL 2023-05-23
24-
python: '3.10'
25-
- ansible: stable-2.13 # EOL 2023-11-06
26-
python: '3.10'
27-
- ansible: stable-2.14 # EOL 2024-05-20
28-
python: '3.10'
23+
# - ansible: stable-2.12 # EOL 2023-05-23
24+
# python: '3.10'
25+
# - ansible: stable-2.13 # EOL 2023-11-06
26+
# python: '3.10'
27+
# - ansible: stable-2.14 # EOL 2024-05-20
28+
# python: '3.10'
29+
- ansible: stable-2.16
30+
python: "3.12"
2931
steps:
3032
- name: Check out code
31-
uses: actions/checkout@v3
33+
uses: actions/checkout@v4
3234

3335
- name: Set up environment
3436
uses: ./.github/actions/ci-setup
@@ -42,5 +44,5 @@ jobs:
4244
echo ${PWD} &&
4345
molecule --version &&
4446
ansible --version &&
45-
molecule lint
47+
ansible-lint --profile production
4648
working-directory: ${{ inputs.role-path }}

.github/workflows/ci-release.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
push:
66
tags:
7-
- '*.*.*'
7+
- "*.*.*"
88

99
permissions:
1010
contents: write
@@ -19,13 +19,12 @@ jobs:
1919
versions:
2020
# ansible-core upstream development supports 3 releases at a time
2121
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html
22-
- ansible: stable-2.14 # EOL 2024-05-20
23-
python: '3.10'
22+
- ansible: stable-2.16
23+
python: "3.12"
2424

2525
steps:
2626
- name: Check out code
27-
uses: actions/checkout@v3
28-
27+
uses: actions/checkout@v4
2928
- name: Set up environment
3029
uses: ./.github/actions/ci-setup
3130
with:

.github/workflows/ci-test.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ on:
33
workflow_call:
44
inputs:
55
box-distribution:
6-
description: 'Vagrant Box Operating System'
6+
description: "Vagrant Box Operating System"
77
type: string
88
required: true
99
box-repository:
10-
description: 'Vagrant Box repository'
10+
description: "Vagrant Box repository"
1111
type: string
1212
required: true
1313
ansible-connection:
14-
description: 'Ansible connection type for connecting to the Box'
14+
description: "Ansible connection type for connecting to the Box"
1515
type: string
1616
required: false
1717
default: ssh
@@ -21,35 +21,38 @@ on:
2121
required: false
2222
default: Linux
2323
display-name:
24-
description: 'OS Name to display in workflow steps'
24+
description: "OS Name to display in workflow steps"
2525
type: string
2626
required: true
2727
scenario-name:
28-
description: 'Name of the molecule scenario to execute'
28+
description: "Name of the molecule scenario to execute"
2929
type: string
30-
required: false
31-
default: default
30+
required: true
31+
# default: default
3232
role-path:
33-
description: 'Relative path to the role to be linted'
33+
description: "Relative path to the role to be linted"
3434
type: string
35-
required: true
35+
required: false
36+
default: extensions
3637

3738
jobs:
3839
molecule-test:
39-
name: 'ansible-${{ matrix.versions.ansible }} (Python: ${{ matrix.versions.python }})'
40+
name: "ansible-${{ matrix.versions.ansible }} (Python: ${{ matrix.versions.python }})"
4041
runs-on: [self-hosted, Linux, X64, ansible-collection]
4142
strategy:
4243
fail-fast: false
4344
matrix:
4445
versions:
4546
# ansible-core upstream development supports 3 releases at a time
4647
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html
47-
- ansible: stable-2.12 # EOL 2023-05-23
48-
python: '3.10'
49-
- ansible: stable-2.13 # EOL 2023-11-06
50-
python: '3.10'
51-
- ansible: stable-2.14 # EOL 2024-05-20
52-
python: '3.10'
48+
# - ansible: stable-2.12 # EOL 2023-05-23
49+
# python: '3.10'
50+
# - ansible: stable-2.13 # EOL 2023-11-06
51+
# python: '3.10'
52+
# - ansible: stable-2.14 # EOL 2024-05-20
53+
# python: '3.10'
54+
- ansible: stable-2.16 # EOL 2025-05 - last version to support Python <3.7
55+
python: "3.12"
5356
env:
5457
ANSIBLE_FORCE_COLOR: 1 # allows ansible colors to be passed to GitHub Actions
5558
PY_COLORS: 1 # allows molecule colors to be passed to GitHub Actions
@@ -62,7 +65,7 @@ jobs:
6265

6366
steps:
6467
- name: Check out code
65-
uses: actions/checkout@v3
68+
uses: actions/checkout@v4
6669

6770
- name: Set up environment
6871
uses: ./.github/actions/ci-setup

.github/workflows/s1_agent_common.yml

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,35 @@ name: S1 Agent Common
22
on:
33
push:
44
branches:
5-
- 'release/**'
5+
- "release/**"
66
paths:
7-
- 'roles/s1_agent_common/**'
8-
- '!roles/s1_agent_common/README.md'
9-
- '!roles/s1_agent_common/makefile'
10-
- '.github/workflows/s1_agent_common.yml'
11-
- '.github/workflows/ci-*.yml'
12-
- '!.github/workflows/ci-release.yml'
13-
- '!.github/workflows/ci-release.yml'
14-
- '.github/actions/ci-setup/action.yml'
15-
- 'requirements.yml'
7+
- "roles/s1_agent_common/**"
8+
- "!roles/s1_agent_common/README.md"
9+
- "!roles/s1_agent_common/makefile"
10+
- "extensions/molecule/common"
11+
- ".github/workflows/s1_agent_common.yml"
12+
- ".github/workflows/ci-*.yml"
13+
- "!.github/workflows/ci-release.yml"
14+
- "!.github/workflows/ci-release.yml"
15+
- ".github/actions/ci-setup/action.yml"
16+
- "requirements.yml"
1617
pull_request:
1718
branches:
18-
- 'main'
19+
- "main"
1920
types:
2021
- opened
2122
- synchronize
2223
- ready_for_review
2324
paths:
24-
- 'roles/s1_agent_common/**'
25-
- '!roles/s1_agent_common/README.md'
26-
- '!roles/s1_agent_common/makefile'
27-
- '.github/workflows/s1_agent_common.yml'
28-
- '.github/workflows/ci-*.yml'
29-
- '!.github/workflows/ci-release.yml'
30-
- '.github/actions/ci-setup/actions.yml'
31-
- 'requirements.yml'
25+
- "roles/s1_agent_common/**"
26+
- "!roles/s1_agent_common/README.md"
27+
- "!roles/s1_agent_common/makefile"
28+
- "extensions/molecule/common"
29+
- ".github/workflows/s1_agent_common.yml"
30+
- ".github/workflows/ci-*.yml"
31+
- "!.github/workflows/ci-release.yml"
32+
- ".github/actions/ci-setup/actions.yml"
33+
- "requirements.yml"
3234
workflow_dispatch:
3335
concurrency:
3436
group: ${{ github.workflow }}-${{ github.ref }}
@@ -41,7 +43,7 @@ jobs:
4143
role-path: ./roles/s1_agent_common
4244

4345
call-ci-test:
44-
name: 'Test: ${{ matrix.boxes.display_name }} (${{ matrix.scenario-name }})'
46+
name: "Test: ${{ matrix.boxes.display_name }} (${{ matrix.scenario-name }})"
4547
needs: call-ci-lint
4648
uses: ./.github/workflows/ci-test.yml
4749
strategy:
@@ -61,28 +63,27 @@ jobs:
6163
display_name: Server 2022
6264
connection: ssh
6365
group: Windows
64-
- distribution: WindowsServer2012R2
65-
repository: jborean93
66-
display_name: Server 2012r2
67-
connection: winrm
66+
# - distribution: WindowsServer2012R2
67+
# repository: jborean93
68+
# display_name: Server 2012r2
69+
# connection: winrm
6870
scenario-name:
69-
- default
70-
- winrm_default
71-
exclude:
72-
# OpenSSH is not supported on Windows Server 2012r2. We need to use
73-
# custom scenarios configured for winrm connections. Exclude normal
74-
# scenarios for winrm connections and winrm_* scenarios for ssh
75-
# connections.
76-
- { boxes: { connection: winrm }, scenario-name: default }
77-
- { boxes: { connection: ssh }, scenario-name: winrm_default }
71+
- common
72+
# exclude:
73+
# # OpenSSH is not supported on Windows Server 2012r2. We need to use
74+
# # custom scenarios configured for winrm connections. Exclude normal
75+
# # scenarios for winrm connections and winrm_* scenarios for ssh
76+
# # connections.
77+
# - { boxes: { connection: winrm }, scenario-name: default }
78+
# - { boxes: { connection: ssh }, scenario-name: winrm_default }
7879
with:
7980
box-distribution: ${{ matrix.boxes.distribution }}
8081
box-repository: ${{ matrix.boxes.repository }}
8182
ansible-connection: ${{ matrix.boxes.connection }}
8283
ansible-group: ${{ matrix.boxes.group }}
8384
display-name: ${{ matrix.boxes.display_name }}
8485
scenario-name: ${{ matrix.scenario-name }}
85-
role-path: ./roles/s1_agent_common
86+
# role-path: ./roles/s1_agent_common
8687
secrets: inherit
8788

8889
call-ci-assert:

0 commit comments

Comments
 (0)