This commit is contained in:
CLEMENT Iwan
2018-11-15 16:17:17 +01:00
2 changed files with 39 additions and 5 deletions

View File

@@ -1,7 +1,24 @@
{% if grains['kernel'] == 'Linux' %} {% if grains['kernel'] == 'Linux' %}
{% if grains['os'] == 'RedHat' %}
SELinux for Redhat:
cmd.run:
- name: subscription-manager repos --enable=rhel-7-server-extras-rpms
Pipons le python:
pkg.installed:
{% if grains['osmajorrelease'] == 6 %}
- name: python27-pip
{% else %}
- pkgs:
- python2-pip
- scl-utils
{% endif %}
{% endif %}
{% if grains['os'] == 'Debian' %} {% if grains['os'] == 'Debian' %}
{% set LURL="deb [arch=amd64] https://download.docker.com/linux/debian " + grains['oscodename']+ " stable" %} {% set LURL="deb [arch=amd64] https://download.docker.com/linux/debian " + grains['oscodename']+ " stable" %}
{% elif grains['os'] == 'CentOS'%} {% elif grains['os_family'] == 'RedHat' %}
{% set LURL='https://download.docker.com/linux/centos/' + grains['osmajorrelease']|string + '/$basearch/stable' %} {% set LURL='https://download.docker.com/linux/centos/' + grains['osmajorrelease']|string + '/$basearch/stable' %}
{% endif %} {% endif %}
RemovePreviousDocker: RemovePreviousDocker:
@@ -30,7 +47,7 @@ DockerPrerequisitePackages:
- ca-certificates - ca-certificates
- gnupg2 - gnupg2
- software-properties-common - software-properties-common
{% elif grains['os'] == 'CentOS' %} {% elif grains['os_family'] == 'RedHat' %}
- yum-utils - yum-utils
- device-mapper-persistent-data - device-mapper-persistent-data
- lvm2 - lvm2
@@ -50,7 +67,7 @@ DockerCE Repository:
- file: /etc/apt/sources.list.d/docker-ce.list - file: /etc/apt/sources.list.d/docker-ce.list
- keyid: 0EBFCD88 - keyid: 0EBFCD88
- keyserver: keyserver.ubuntu.com - keyserver: keyserver.ubuntu.com
{% elif grains['os'] == 'CentOS'%} {% elif grains['os_family'] == 'RedHat' %}
- baseurl: {{ LURL }} - baseurl: {{ LURL }}
- humanname: docker-ce-stable - humanname: docker-ce-stable
- name: docker-ce - name: docker-ce
@@ -78,7 +95,7 @@ IwanDocker:
- docker - docker
{% if grains['os'] == 'Debian' %} {% if grains['os'] == 'Debian' %}
- sudo - sudo
{% elif grains['os'] == 'CentOS' %} {% elif grains['os_family'] == 'RedHat' %}
- wheel - wheel
{% endif %} {% endif %}
@@ -90,6 +107,23 @@ Lets start docker:
cmd.run: cmd.run:
- name: systemctl start docker - name: systemctl start docker
{% if grains['os'] == 'RedHat' %}
Upgrade pip:
cmd.run:
{% if grains['osmajorrelease'] == 7 %}
- name: "pip install --upgrade pip -i {{PIP_REPO_URL}} --trusted-host {{PIP_REPO_SERVER}}"
- env:
- LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64:$LD_LIBRARY_PATH
- PATH=/opt/rh/python27/root/usr/bin:$PATH
- PKG_CONFIG_PATH=/opt/rh/python27/root/usr/lib64/pkgconfig
- XDG_DATA_DIRS=/opt/rh/python27/root/usr/share:$XDG_DATA_DIRS
- X_SCLS='python27 '
{% else %}
- name: "pip2.7 install --upgrade pip -i {{PIP_REPO_URL}} --trusted-host {{PIP_REPO_SERVER}}"
{% endif %}
- shell: /bin/bash
{% endif %}
Lets install docker with pip: Lets install docker with pip:
pip.installed: pip.installed:
- name: docker - name: docker

View File

@@ -1,6 +1,6 @@
{% if grains['kernel'] == 'Linux' %} {% if grains['kernel'] == 'Linux' %}
include: include:
- linux.docker-ce - softwares.docker-ce
Disable Swap: Disable Swap:
mount.unmounted: mount.unmounted: