Browse Source

Merge branch 'hotfix/rhel' of fxinnovation-public/ansible-role-docker into master

tags/0.0.2
Julien Cabillot Gitea 1 year ago
parent
commit
37c9b2a0af
9 changed files with 58 additions and 39 deletions
  1. +0
    -1
      .gitignore
  2. +10
    -0
      .pre-commit-config.yaml
  3. +5
    -0
      CHANGELOG.md
  4. +2
    -2
      README.md
  5. +3
    -1
      kitchen.yml
  6. +1
    -1
      tasks/setup-Amazon.yml
  7. +1
    -1
      tasks/setup-Debian.yml
  8. +35
    -32
      tasks/setup-RedHat.yml
  9. +1
    -1
      vars/main.yml

+ 0
- 1
.gitignore View File

@@ -1,3 +1,2 @@
# ---> Ansible
*.retry


+ 10
- 0
.pre-commit-config.yaml View File

@@ -0,0 +1,10 @@
repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: check-merge-conflict
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: detect-private-key
- id: check-yaml

+ 5
- 0
CHANGELOG.md View File

@@ -0,0 +1,5 @@
# CHANGELOG

## 0.0.2

* Fix RHEL installation (extra repo)

+ 2
- 2
README.md View File

@@ -1,8 +1,8 @@
ansible-role-docker
===================

Install docker for CentOS / RHEL / Amazon Linux 2.
Based on : https://github.com/geerlingguy/ansible-role-docker/
Install docker for CentOS / RHEL / Amazon Linux 2.
Based on : https://github.com/geerlingguy/ansible-role-docker/
The geerlingguy role doesn't support RHEL and Amazon.

Requirements


+ 3
- 1
kitchen.yml View File

@@ -38,6 +38,9 @@ platforms:
- name: "rhel-7"
driver:
instance_type: "t3.small"
image_search:
name: "RHEL-7.*_HVM_GA*"
owner-id: "309956199498"
tags:
Name: "tk-ansible-role-docker"
kitchen: "true"
@@ -101,4 +104,3 @@ suites:
inspec_tests:
- name: local
path: test/integration/default/amazon.rb


+ 1
- 1
tasks/setup-Amazon.yml View File

@@ -3,4 +3,4 @@
package:
name: "docker"
state: "present"
notify: "restart docker"
notify: "restart docker"

+ 1
- 1
tasks/setup-Debian.yml View File

@@ -31,4 +31,4 @@
package:
name: "{{ docker_package }}"
state: "{{ docker_package_state }}"
notify: restart docker
notify: restart docker

+ 35
- 32
tasks/setup-RedHat.yml View File

@@ -1,60 +1,63 @@
---

- name: Copy Docker GPG key
- name: 'Copy Docker GPG key'
copy:
src: docker_centos_gpg
dest: /tmp/docker_centos_gpg
owner: root
group: root
src: 'docker_centos_gpg'
dest: '/tmp/docker_centos_gpg'
owner: 'root'
group: 'root'

- name: Add Docker GPG key.
- name: 'Add Docker GPG key'
rpm_key:
key: /tmp/docker_centos_gpg
state: present
key: '/tmp/docker_centos_gpg'
state: 'present'

- name: Add Docker repository.
- name: 'Add Docker repository'
get_url:
url: "{{ docker_yum_repo_url }}"
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
url: "{{ docker_yum_repo_url }}"
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
owner: root
group: root
mode: 0644
mode: 0644

- name: Configure Docker Edge repo.
- name: 'Configure Docker Edge repo'
ini_file:
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
section: 'docker-{{ docker_edition }}-edge'
option: enabled
value: '{{ docker_yum_repo_enable_edge }}'
option: 'enabled'
value: '{{ docker_yum_repo_enable_edge }}'

- name: Configure Docker Test repo.
- name: 'Configure Docker Test repo'
ini_file:
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo'
section: 'docker-{{ docker_edition }}-test'
option: enabled
value: '{{ docker_yum_repo_enable_test }}'
option: 'enabled'
value: '{{ docker_yum_repo_enable_test }}'

# To install docker-ce, we need container-selinux available from an extras repo.
# The repository name depends of the environment (AWS RHEL AMI has a specific naming).
- name: "Find extra repos"
shell: "set -o pipefail; yum repolist all | egrep -e '^rhui-REGION-rhel-server-extras' -e '^rhel-7-server-extras-rpms' | cut -d'/' -f1"
- name: 'Find extra repos'
shell:
cmd: |
set -o pipefail;
yum repolist all | egrep -e '^[!*]?rhui-REGION-rhel-server-extras' -e '^[!*]?rhel-7-server-extras-rpms' | sed -r 's#^[!*]?([^/]*)/.*#\1#'
args:
warn: no
register: "redhat_extrarepo"
warn: 'no'
register: 'redhat_extrarepo'
changed_when: False
when: ansible_distribution == "RedHat"

- name: Install Docker.
- name: 'Install Docker'
package:
name: "{{ docker_package }}"
name: "{{ docker_package }}"
state: "{{ docker_package_state }}"
notify: restart docker
notify: 'restart docker'
when: ansible_distribution != "RedHat"

- name: Install Docker.
- name: 'Install Docker'
yum:
name: "{{ docker_package }}"
state: "{{ docker_package_state }}"
name: "{{ docker_package }}"
state: "{{ docker_package_state }}"
enablerepo: "{{ redhat_extrarepo.stdout }}"
notify: restart docker
when: ansible_distribution == "RedHat"
notify: 'restart docker'
when: ansible_distribution == "RedHat"

+ 1
- 1
vars/main.yml View File

@@ -1,2 +1,2 @@
---
# vars file for ansible-role-docker
# vars file for ansible-role-docker

Loading…
Cancel
Save