From 5a1ab3aef594bf58528f0d35976599d687675540 Mon Sep 17 00:00:00 2001 From: Arthur Outhenin-Chalandre Date: Tue, 26 Sep 2023 17:08:03 +0200 Subject: [PATCH 1/5] ansible: upgrade to version >= 2.15.5 Signed-off-by: Arthur Outhenin-Chalandre --- docs/ansible.md | 2 +- meta/runtime.yml | 2 +- playbooks/ansible_version.yml | 4 ++-- requirements.txt | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/ansible.md b/docs/ansible.md index 9a3110b3a3f..63cc1d768c4 100644 --- a/docs/ansible.md +++ b/docs/ansible.md @@ -32,7 +32,7 @@ Based on the table below and the available python version for your ansible host | Ansible Version | Python Version | |-----------------|----------------| -| 2.14 | 3.9-3.11 | +| >= 2.15.5 | 3.9-3.11 | ## Inventory diff --git a/meta/runtime.yml b/meta/runtime.yml index be99ccf4b82..0b870b6984a 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,2 +1,2 @@ --- -requires_ansible: '>=2.14.0' +requires_ansible: '>=2.15.5' diff --git a/playbooks/ansible_version.yml b/playbooks/ansible_version.yml index 840749af5e2..f6cebdff73d 100644 --- a/playbooks/ansible_version.yml +++ b/playbooks/ansible_version.yml @@ -4,8 +4,8 @@ gather_facts: false become: no vars: - minimal_ansible_version: 2.14.0 - maximal_ansible_version: 2.15.0 + minimal_ansible_version: 2.15.5 # 2.15 versions before 2.15.5 are known to be buggy for kubespray + maximal_ansible_version: 2.17.0 ansible_connection: local tags: always tasks: diff --git a/requirements.txt b/requirements.txt index 2420014f8d3..47a76fcfe8d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ -ansible==7.6.0 -cryptography==41.0.1 +ansible==8.5.0 +cryptography==41.0.4 jinja2==3.1.2 jmespath==1.0.1 MarkupSafe==2.1.3 -netaddr==0.8.0 +netaddr==0.9.0 pbr==5.11.1 -ruamel.yaml==0.17.31 -ruamel.yaml.clib==0.2.7 +ruamel.yaml==0.17.35 +ruamel.yaml.clib==0.2.8 From 58a55cc0be5ed42fd2d27b95508fbed06026bd02 Mon Sep 17 00:00:00 2001 From: Arthur Outhenin-Chalandre Date: Tue, 26 Sep 2023 17:09:00 +0200 Subject: [PATCH 2/5] tests: update requirements Signed-off-by: Arthur Outhenin-Chalandre --- tests/requirements.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 19474ab0945..a05e6eaee59 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,11 +1,11 @@ -r ../requirements.txt -ansible-lint==6.16.2 -apache-libcloud==3.7.0 -ara[server]==1.6.1 +ansible-lint==6.20.3 +apache-libcloud==3.8.0 +ara[server]==1.7.0 dopy==0.3.7 -molecule==5.0.1 -molecule-plugins[vagrant]==23.4.1 +molecule==6.0.2 +molecule-plugins[vagrant]==23.5.0 python-vagrant==1.0.0 -pytest-testinfra==8.1.0 -tox==4.5.2 +pytest-testinfra==9.0.0 +tox==4.11.3 yamllint==1.32.0 From c852e343616f060595d89a16759547894e92420b Mon Sep 17 00:00:00 2001 From: Arthur Outhenin-Chalandre Date: Tue, 26 Sep 2023 17:24:11 +0200 Subject: [PATCH 3/5] contrib/openstack: fix wrong gitignore pattern Signed-off-by: Arthur Outhenin-Chalandre --- contrib/terraform/openstack/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/terraform/openstack/.gitignore b/contrib/terraform/openstack/.gitignore index 55d775bf016..7e4921aa2c5 100644 --- a/contrib/terraform/openstack/.gitignore +++ b/contrib/terraform/openstack/.gitignore @@ -1,5 +1,5 @@ .terraform *.tfvars -!sample-inventory\/cluster.tfvars +!sample-inventory/cluster.tfvars *.tfstate *.tfstate.backup From 41e319b32509c17f163cedc720dfd767f83536d7 Mon Sep 17 00:00:00 2001 From: Arthur Outhenin-Chalandre Date: Tue, 26 Sep 2023 17:37:44 +0200 Subject: [PATCH 4/5] tests: add missing tzdata requirement Signed-off-by: Arthur Outhenin-Chalandre --- tests/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/requirements.txt b/tests/requirements.txt index a05e6eaee59..51bc76efbf6 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -9,3 +9,4 @@ python-vagrant==1.0.0 pytest-testinfra==9.0.0 tox==4.11.3 yamllint==1.32.0 +tzdata==2023.3 From 06915e6f9945755cd795e0341390c31c16fd2acb Mon Sep 17 00:00:00 2001 From: Arthur Outhenin-Chalandre Date: Thu, 12 Oct 2023 14:27:42 +0200 Subject: [PATCH 5/5] tests: remove some molecules tests Those doesn't work in Ansible 2.15. Ansible can't load builtin now apparently and these tests are not worth it. Signed-off-by: Arthur Outhenin-Chalandre --- .../molecule/default/tests/test_default.py | 43 ------------------- .../molecule/default/tests/test_default.py | 40 ----------------- 2 files changed, 83 deletions(-) delete mode 100644 roles/adduser/molecule/default/tests/test_default.py delete mode 100644 roles/bastion-ssh-config/molecule/default/tests/test_default.py diff --git a/roles/adduser/molecule/default/tests/test_default.py b/roles/adduser/molecule/default/tests/test_default.py deleted file mode 100644 index 7e8649d141d..00000000000 --- a/roles/adduser/molecule/default/tests/test_default.py +++ /dev/null @@ -1,43 +0,0 @@ -import os -from pathlib import Path - -import testinfra.utils.ansible_runner -import yaml -from ansible.cli.playbook import PlaybookCLI -from ansible.playbook import Playbook - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ["MOLECULE_INVENTORY_FILE"] -).get_hosts("all") - - -def read_playbook(playbook): - cli_args = [os.path.realpath(playbook), testinfra_hosts] - cli = PlaybookCLI(cli_args) - cli.parse() - loader, inventory, variable_manager = cli._play_prereqs() - - pb = Playbook.load(cli.args[0], variable_manager, loader) - - for play in pb.get_plays(): - yield variable_manager.get_vars(play) - - -def get_playbook(): - playbooks_path = Path(__file__).parent.parent - with open(os.path.join(playbooks_path, "molecule.yml"), "r") as yamlfile: - data = yaml.load(yamlfile, Loader=yaml.FullLoader) - if "playbooks" in data["provisioner"].keys(): - if "converge" in data["provisioner"]["playbooks"].keys(): - return data["provisioner"]["playbooks"]["converge"] - else: - return os.path.join(playbooks_path, "converge.yml") - - -def test_user(host): - for vars in read_playbook(get_playbook()): - assert host.user(vars["user"]["name"]).exists - if "group" in vars["user"].keys(): - assert host.group(vars["user"]["group"]).exists - else: - assert host.group(vars["user"]["name"]).exists diff --git a/roles/bastion-ssh-config/molecule/default/tests/test_default.py b/roles/bastion-ssh-config/molecule/default/tests/test_default.py deleted file mode 100644 index cce719de192..00000000000 --- a/roles/bastion-ssh-config/molecule/default/tests/test_default.py +++ /dev/null @@ -1,40 +0,0 @@ -import os -from pathlib import Path - -import testinfra.utils.ansible_runner -import yaml -from ansible.cli.playbook import PlaybookCLI -from ansible.playbook import Playbook - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ["MOLECULE_INVENTORY_FILE"] -).get_hosts("all") - - -def read_playbook(playbook): - cli_args = [os.path.realpath(playbook), testinfra_hosts] - cli = PlaybookCLI(cli_args) - cli.parse() - loader, inventory, variable_manager = cli._play_prereqs() - - pb = Playbook.load(cli.args[0], variable_manager, loader) - - for play in pb.get_plays(): - yield variable_manager.get_vars(play) - - -def get_playbook(): - playbooks_path = Path(__file__).parent.parent - with open(os.path.join(playbooks_path, "molecule.yml"), "r") as yamlfile: - data = yaml.load(yamlfile, Loader=yaml.FullLoader) - if "playbooks" in data["provisioner"].keys(): - if "converge" in data["provisioner"]["playbooks"].keys(): - return data["provisioner"]["playbooks"]["converge"] - else: - return os.path.join(playbooks_path, "converge.yml") - - -def test_ssh_config(host): - for vars in read_playbook(get_playbook()): - assert host.file(vars["ssh_bastion_confing__name"]).exists - assert host.file(vars["ssh_bastion_confing__name"]).is_file