Add proxy support to CRI-O service (#4607)

* Add proxy support to CRI-O service

The crio.service requires proxy environment variables when it's
deployed behind a corporated network. This change creates a systemd
configuration file when the proxy variables are defined.

* Remove unnecesary crio's tasks
This commit is contained in:
Victor Morales
2020-04-21 04:12:55 -07:00
committed by GitHub
parent 03c8d0113c
commit 2bec26dba5
7 changed files with 26 additions and 13 deletions

View File

@@ -54,6 +54,7 @@
with_items:
- /etc/crio
- /etc/containers
- /etc/systemd/system/crio.service.d
file:
path: "{{ item }}"
state: directory
@@ -64,6 +65,7 @@
state: present
when: not is_ostree
with_items: "{{ crio_packages }}"
notify: restart crio
- name: Check if already installed
stat:
@@ -110,6 +112,7 @@
dest: /etc/containers/mounts.conf
when:
- ansible_os_family == 'RedHat'
notify: restart crio
- name: Create directory for oci hooks
file:
@@ -118,12 +121,9 @@
owner: root
mode: 0755
- name: Reload systemd daemon
systemd:
daemon_reload: yes
- name: Install cri-o service
service:
name: "{{ crio_service }}"
enabled: yes
state: restarted
- name: Write cri-o proxy drop-in
template:
src: http-proxy.conf.j2
dest: /etc/systemd/system/crio.service.d/http-proxy.conf
notify: restart crio
when: http_proxy is defined or https_proxy is defined