summaryrefslogtreecommitdiffstats
path: root/roles/docker/tasks
diff options
context:
space:
mode:
authorJason DeTiberus <jdetiber@redhat.com>2016-02-26 11:12:16 -0500
committerJason DeTiberus <jdetiber@redhat.com>2016-03-14 11:38:13 -0400
commit1565bc6e71bdda712d4cfdbf28754f00b38a4674 (patch)
tree8e5774e28e5ea233f09ffdcc446b6f692ab0cf2f /roles/docker/tasks
parenta0e7f19f9f7f423d8fe001a247ccf2c98d815d68 (diff)
downloadopenshift-1565bc6e71bdda712d4cfdbf28754f00b38a4674.tar.gz
openshift-1565bc6e71bdda712d4cfdbf28754f00b38a4674.tar.bz2
openshift-1565bc6e71bdda712d4cfdbf28754f00b38a4674.tar.xz
openshift-1565bc6e71bdda712d4cfdbf28754f00b38a4674.zip
Docker role refactor
- refactors the docker role to push generic config into docker role and wrap openshift specific variables into an openshift_docker role and it's dependent openshift_docker_facts role - adds support for setting --confirm-def-push flag (Resolves https://github.com/openshift/openshift-ansible/issues/1014) - moves docker related facts from common/node roles to a new docker role - renames cli_docker_* role varialbes to openshift_docker-* (maintaining backward compatibility) - update role dependencies to pull in openshift_docker conditionally based on is_containerized - remove playbooks/common/openshift-docker since the docker role is now conditionally included
Diffstat (limited to 'roles/docker/tasks')
-rw-r--r--roles/docker/tasks/main.yml36
1 files changed, 36 insertions, 0 deletions
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml
index 74c8b22ff..4164a9ec0 100644
--- a/roles/docker/tasks/main.yml
+++ b/roles/docker/tasks/main.yml
@@ -16,3 +16,39 @@
- include: udev_workaround.yml
when: docker_udev_workaround | default(False) | bool
+
+- stat: path=/etc/sysconfig/docker
+ register: docker_check
+
+- name: Set registry params
+ lineinfile:
+ dest: /etc/sysconfig/docker
+ regexp: '^{{ item.reg_conf_var }}=.*$'
+ line: "{{ item.reg_conf_var }}='{{ item.reg_fact_val | oo_prepend_strings_in_list(item.reg_flag ~ ' ') | join(' ') }}'"
+ when: item.reg_fact_val is defined and docker_check.stat.isreg
+ with_items:
+ - reg_conf_var: ADD_REGISTRY
+ reg_fact_val: "{{ docker_additional_registries }}"
+ reg_flag: --add-registry
+ - reg_conf_var: BLOCK_REGISTRY
+ reg_fact_val: "{{ docker_blocked_registries }}"
+ reg_flag: --block-registry
+ - reg_conf_var: INSECURE_REGISTRY
+ reg_fact_val: "{{ docker_insecure_registries }}"
+ reg_flag: --insecure-registry
+ notify:
+ - restart docker
+
+- name: Set various docker options
+ lineinfile:
+ dest: /etc/sysconfig/docker
+ regexp: '^OPTIONS=.*$'
+ line: "OPTIONS='\
+ {% if ansible_selinux and ansible_selinux.status == '''enabled''' %} --selinux-enabled{% endif %}\
+ {% if docker_log_driver is defined %} --log-driver {{ docker_log_driver }}{% endif %}\
+ {% if docker_log_options is defined %} {{ docker_log_options | oo_split() | oo_prepend_strings_in_list('--log-opt ') | join(' ')}}{% endif %}\
+ {% if docker_options is defined %} {{ docker_options }}{% endif %}\
+ {% if docker_disable_push_dockerhub is defined %} --confirm-def-push={{ docker_disable_push_dockerhub | bool }}{% endif %}'"
+ when: docker_check.stat.isreg
+ notify:
+ - restart docker