From da5abb27f82e54936d702379bb5e5bd0b914fb87 Mon Sep 17 00:00:00 2001 From: Robert de Bock Date: Wed, 10 Oct 2018 08:02:44 +0200 Subject: [PATCH] Fix for Fedora (python3). --- molecule/centos-latest/molecule.yml | 2 -- tasks/main.yml | 11 +++++++++-- vars/main.yml | 5 +++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/molecule/centos-latest/molecule.yml b/molecule/centos-latest/molecule.yml index 0c7d368..6eb1340 100644 --- a/molecule/centos-latest/molecule.yml +++ b/molecule/centos-latest/molecule.yml @@ -12,8 +12,6 @@ platforms: image: centos:latest provisioner: name: ansible - extra_vars: - ansible_python_interpreter: /usr/bin/python3 lint: name: ansible-lint scenario: diff --git a/tasks/main.yml b/tasks/main.yml index 2e8aae1..c1040fe 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,11 @@ --- # tasks file for firewall +- name: use configured python version + set_fact: + ansible_python_interpreter: "{{ firewall_ansible_python_interpreter[ansible_distribution ~ '-' ~ ansible_distribution_major_version] + |default(firewall_ansible_python_interpreter[ansible_distribution] + |default(firewall_ansible_python_interpreter['default'])) }}" + - name: remove conflicting software package: name: "{{ firewall_packages['conflicting'][ansible_distribution] @@ -80,8 +86,9 @@ - name: configure iptables template: src: iptables.j2 - dest: "{{ firewall_iptables_rulefile[ansible_distribution] - | default(firewall_iptables_rulefile['default'] }}" + dest: "{{ firewall_iptables_rulefile[ansible_distribution ~ '-' ~ ansible_distribution_major_version] + | default(firewall_iptables_rulefile[ansible_distribution] + | default(firewall_iptables_rulefile['default'])) }}" validate: "iptables-restore --test %s" when: - ansible_virtualization_type != "docker" diff --git a/vars/main.yml b/vars/main.yml index 5f46520..837265e 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,5 +1,9 @@ --- # vars file for firewall +firewall_ansible_python_interpreter: + default: /usr/bin/python + Fedora: /usr/bin/python3 + firewall_packages: required: default: @@ -14,6 +18,7 @@ firewall_packages: - iptables-services Fedora: - firewalld + - python3-firewall openSUSE Leap: - firewalld openSUSE Tumbleweed: