Unverified Commit 99397f14 authored by walter's avatar walter

Add CentOS 8 support

parent 0becf826
Pipeline #8694 failed with stage
......@@ -6,6 +6,7 @@ galaxy_info:
min_ansible_version: 2.4
platforms:
- name: CentOS
versions:
- 7
- name: CentOS
versions:
- 7
- 8
- name: Ensure the config-manager is enabled
dnf:
name: "dnf-command(config-manager)"
state: latest
become: yes
- name: Manually add the repo for docker-ce, since config-manager isn't handled by any dnf Ansible module yet
command: 'dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo'
register: dnf_cmd
failed_when: dnf_cmd.rc != 0
become: yes
- name: Grab currently installed docker-ce version
shell: |
echo $(dnf info docker-ce --installed | grep '^Version' | awk -F':' '{print $2}')
register: docker_ce_version_cmd
failed_when: false
become: yes
- name: Install docker-ce (with the --nobest option, so once again, skip using the dnf module)
command: 'dnf -y install docker-ce --nobest'
register: dnf_cmd
changed_when: false
failed_when: dnf_cmd.rc != 0
when: docker_version == 'latest'
become: yes
- name: Install docker-ce version
command: 'dnf -y install docker-ce-{{ docker_version }} --nobest'
register: dnf_cmd
changed_when: false
failed_when: dnf_cmd.rc != 0
when: docker_version != 'latest'
become: yes
- name: Get installed version
shell: |
echo $(dnf info docker-ce --installed | grep '^Version' | awk -F':' '{print $2}')
register: docker_ce_new_version_cmd
changed_when: (docker_ce_new_version_cmd.stdout != docker_ce_version_cmd.stdout)
become: yes
......@@ -4,9 +4,7 @@
recurse: no
file_type: any
register: docker_files
when: >
(mountpoint is defined) and
(block_device is defined)
when: mountpoint and block_device
become: yes
- name: Test for docker mountpoint
......@@ -21,8 +19,7 @@
fail:
msg: "Mountpoint {{ mountpoint }} already has files populated. You may need to manually migrate your Docker files onto your new device and mount it at the appropriate mountpoint."
when: >
(mountpoint is defined) and
(block_device is defined) and
mountpoint and block_device and
(mountpoint_test.rc != 0) and
(docker_files.examined > 0)
......@@ -31,7 +28,7 @@
fstype: "{{ block_device_fs }}"
dev: "{{ block_device }}"
when: >
(block_device is defined) and
block_device and
(docker_files.matched == 0)
become: yes
......@@ -41,8 +38,5 @@
src: "{{ block_device }}"
fstype: "{{ block_device_fs }}"
state: mounted
when: >
(block_device is defined) and
(mountpoint is defined)
when: block_device and mountpoint
become: yes
$pre_provisioner = <<-SCRIPT
dnf -y install python3
sudo alternatives --set python /usr/bin/python3
SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "centos/8"
config.vm.define "docker-ce"
config.vm.network "private_network", type: "dhcp"
config.vm.provider "libvirt" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.provision "shell", inline: $pre_provisioner
config.vm.provision "ansible" do |ansible|
ENV['ANSIBLE_ROLES_PATH'] = "../../"
ansible.playbook = "test-playbook.yml"
# ansible.galaxy_role_file = "../requirements.yml"
ansible.raw_arguments = [
"--extra-vars=@test-values.yml",
"-vvv"
]
end
end
- hosts: all
tasks:
- name: Include role
include_role:
name: docker-ce
docker_version: latest
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment