Make role work correctly on CentOS 8 and simplify apt repos.

This commit is contained in:
Jeff Geerling 2020-07-22 11:40:16 -05:00
parent cc3093948d
commit 25a7bf99f4
6 changed files with 21 additions and 18 deletions

View File

@ -6,12 +6,12 @@ env:
global: global:
- ROLE_NAME: ansible - ROLE_NAME: ansible
matrix: matrix:
- MOLECULE_DISTRO: centos7 - MOLECULE_DISTRO: centos8
- MOLECULE_DISTRO: fedora29 - MOLECULE_DISTRO: fedora32
- MOLECULE_DISTRO: ubuntu1804 - MOLECULE_DISTRO: ubuntu2004
- MOLECULE_DISTRO: debian9 - MOLECULE_DISTRO: debian10
- MOLECULE_DISTRO: centos7 - MOLECULE_DISTRO: centos8
MOLECULE_PLAYBOOK: playbook-pip.yml MOLECULE_PLAYBOOK: playbook-pip.yml
install: install:

View File

@ -10,8 +10,7 @@ galaxy_info:
platforms: platforms:
- name: EL - name: EL
versions: versions:
- 6 - all
- 7
- name: Fedora - name: Fedora
versions: versions:
- all - all

View File

@ -9,18 +9,25 @@
when: when:
- ansible_os_family == 'RedHat' - ansible_os_family == 'RedHat'
- ansible_distribution != 'Fedora' - ansible_distribution != 'Fedora'
- ansible_install_method == 'package'
- name: Set up Ansible on Fedora. - name: Set up Ansible on Fedora.
include_tasks: setup-Fedora.yml include_tasks: setup-Fedora.yml
when: ansible_distribution == 'Fedora' when:
- ansible_distribution == 'Fedora'
- ansible_install_method == 'package'
- name: Set up Ansible on Ubuntu. - name: Set up Ansible on Ubuntu.
include_tasks: setup-Ubuntu.yml include_tasks: setup-Ubuntu.yml
when: ansible_distribution == 'Ubuntu' when:
- ansible_distribution == 'Ubuntu'
- ansible_install_method == 'package'
- name: Set up Ansible on Debian. - name: Set up Ansible on Debian.
include_tasks: setup-Debian.yml include_tasks: setup-Debian.yml
when: ansible_distribution == 'Debian' when:
- ansible_distribution == 'Debian'
- ansible_install_method == 'package'
- name: Set up Ansible using Pip. - name: Set up Ansible using Pip.
include_tasks: setup-pip.yml include_tasks: setup-pip.yml

View File

@ -6,11 +6,9 @@
{{ ansible_distribution_release }}-backports main' {{ ansible_distribution_release }}-backports main'
state: present state: present
filename: "{{ ansible_distribution_release }}_backports" filename: "{{ ansible_distribution_release }}_backports"
update_cache: true
when: ansible_distribution_version | int < 9 when: ansible_distribution_version | int < 9
- name: Update apt cache.
apt: update_cache=true cache_valid_time=86400
- name: Set the default_release option for older Debian versions. - name: Set the default_release option for older Debian versions.
set_fact: set_fact:
ansible_default_release: "{{ ansible_distribution_release }}-backports" ansible_default_release: "{{ ansible_distribution_release }}-backports"

View File

@ -1,6 +1,6 @@
--- ---
- name: Install Ansible. - name: Install Ansible.
yum: package:
name: ansible name: ansible
state: "{{ ansible_package_state }}" state: "{{ ansible_package_state }}"
enablerepo: epel enablerepo: epel

View File

@ -5,10 +5,9 @@
state: present state: present
- name: Add ansible repository. - name: Add ansible repository.
apt_repository: repo='ppa:ansible/ansible' apt_repository:
repo: 'ppa:ansible/ansible'
- name: Update apt cache. update_cache: true
apt: update_cache=true cache_valid_time=86400
- name: Install Ansible. - name: Install Ansible.
apt: apt: