Update to ansible 2.15 (#10481)
* ansible: upgrade to version >= 2.15.5 Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr> * tests: update requirements Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr> * contrib/openstack: fix wrong gitignore pattern Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr> * tests: add missing tzdata requirement Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr> * 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 <arthur@cri.epita.fr> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr>pull/10625/head
parent
cbd3a83a06
commit
7ba85710ad
|
@ -1,5 +1,5 @@
|
||||||
.terraform
|
.terraform
|
||||||
*.tfvars
|
*.tfvars
|
||||||
!sample-inventory\/cluster.tfvars
|
!sample-inventory/cluster.tfvars
|
||||||
*.tfstate
|
*.tfstate
|
||||||
*.tfstate.backup
|
*.tfstate.backup
|
||||||
|
|
|
@ -32,7 +32,7 @@ Based on the table below and the available python version for your ansible host
|
||||||
|
|
||||||
| Ansible Version | Python Version |
|
| Ansible Version | Python Version |
|
||||||
|-----------------|----------------|
|
|-----------------|----------------|
|
||||||
| 2.14 | 3.9-3.11 |
|
| >= 2.15.5 | 3.9-3.11 |
|
||||||
|
|
||||||
## Inventory
|
## Inventory
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
---
|
---
|
||||||
requires_ansible: '>=2.14.0'
|
requires_ansible: '>=2.15.5'
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
become: no
|
become: no
|
||||||
vars:
|
vars:
|
||||||
minimal_ansible_version: 2.14.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.15.0
|
maximal_ansible_version: 2.17.0
|
||||||
ansible_connection: local
|
ansible_connection: local
|
||||||
tags: always
|
tags: always
|
||||||
tasks:
|
tasks:
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
ansible==7.6.0
|
ansible==8.5.0
|
||||||
cryptography==41.0.1
|
cryptography==41.0.4
|
||||||
jinja2==3.1.2
|
jinja2==3.1.2
|
||||||
jmespath==1.0.1
|
jmespath==1.0.1
|
||||||
MarkupSafe==2.1.3
|
MarkupSafe==2.1.3
|
||||||
netaddr==0.8.0
|
netaddr==0.9.0
|
||||||
pbr==5.11.1
|
pbr==5.11.1
|
||||||
ruamel.yaml==0.17.31
|
ruamel.yaml==0.17.35
|
||||||
ruamel.yaml.clib==0.2.7
|
ruamel.yaml.clib==0.2.8
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -1,11 +1,12 @@
|
||||||
-r ../requirements.txt
|
-r ../requirements.txt
|
||||||
ansible-lint==6.16.2
|
ansible-lint==6.20.3
|
||||||
apache-libcloud==3.7.0
|
apache-libcloud==3.8.0
|
||||||
ara[server]==1.6.1
|
ara[server]==1.7.0
|
||||||
dopy==0.3.7
|
dopy==0.3.7
|
||||||
molecule==5.0.1
|
molecule==6.0.2
|
||||||
molecule-plugins[vagrant]==23.4.1
|
molecule-plugins[vagrant]==23.5.0
|
||||||
python-vagrant==1.0.0
|
python-vagrant==1.0.0
|
||||||
pytest-testinfra==8.1.0
|
pytest-testinfra==9.0.0
|
||||||
tox==4.5.2
|
tox==4.11.3
|
||||||
yamllint==1.32.0
|
yamllint==1.32.0
|
||||||
|
tzdata==2023.3
|
||||||
|
|
Loading…
Reference in New Issue