|
@@ -1,10 +1,31 @@
|
|
|
---
|
|
|
-- name: Install docker packages
|
|
|
+- name: Install docker packages (Fedora)
|
|
|
dnf:
|
|
|
name:
|
|
|
- moby-engine
|
|
|
- docker-compose
|
|
|
state: present
|
|
|
+ when:
|
|
|
+ - ansible_distribution == 'Fedora'
|
|
|
+
|
|
|
+
|
|
|
+- block:
|
|
|
+ - name: Enable docker-ce repo (CentOS)
|
|
|
+ yum_repository:
|
|
|
+ name: docker-ce
|
|
|
+ description: Docker Community Edition
|
|
|
+ baseurl: https://download.docker.com/linux/centos/$releasever/$basearch/stable
|
|
|
+
|
|
|
+ - name: Install docker packages
|
|
|
+ yum:
|
|
|
+ name:
|
|
|
+ - docker-ce
|
|
|
+ - docker-compose
|
|
|
+ - python-docker-py
|
|
|
+ state: present
|
|
|
+ when:
|
|
|
+ - ansible_distribution == 'CentOS'
|
|
|
+
|
|
|
|
|
|
- name: Start/enable docker service
|
|
|
systemd:
|
|
@@ -64,23 +85,20 @@
|
|
|
changed_when: false
|
|
|
|
|
|
- name: Create persistent container directories
|
|
|
- file:
|
|
|
- path: "{{ item }}"
|
|
|
- state: directory
|
|
|
- owner: "{{ container_user }}"
|
|
|
- group: "{{ container_group }}"
|
|
|
- mode: '0770'
|
|
|
+ include_tasks: create_dirs.yml # can't loop a block
|
|
|
with_items:
|
|
|
- "{{ persistent_container_dirs }}"
|
|
|
+ loop_control:
|
|
|
+ label: "{{ item }}"
|
|
|
|
|
|
-- name: Modify SELinux contexts for container directories
|
|
|
- sefcontext:
|
|
|
- target: '{{ item }}(/.*)?'
|
|
|
- setype: container_file_t
|
|
|
- state: present
|
|
|
- with_items:
|
|
|
- - "{{ persistent_container_dirs }}"
|
|
|
- notify: Apply SELinux contexts
|
|
|
+#- name: Modify SELinux contexts for container directories
|
|
|
+# sefcontext:
|
|
|
+# target: "{{ item | quote }}(/.*)?"
|
|
|
+# setype: container_file_t
|
|
|
+# state: present
|
|
|
+# with_items:
|
|
|
+# - "{{ persistent_container_dirs }}"
|
|
|
+# notify: Apply SELinux contexts
|
|
|
|
|
|
- name: Copy systemd service file
|
|
|
template:
|