From ad676bed26cb8f7c54a2ad0cffa198746fdadb32 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Thu, 11 Apr 2019 17:19:04 -0400 Subject: [PATCH] add configs --- handlers/main.yaml | 6 ++++++ tasks/install/centos.yaml | 1 + tasks/main.yaml | 45 +++++++++++++++++++++++++++------------ 3 files changed, 38 insertions(+), 14 deletions(-) create mode 100644 handlers/main.yaml diff --git a/handlers/main.yaml b/handlers/main.yaml new file mode 100644 index 0000000..be3de4b --- /dev/null +++ b/handlers/main.yaml @@ -0,0 +1,6 @@ +--- +- name: Reload Docker Distribution + become: true + service: + name: docker-distribution + state: reloaded \ No newline at end of file diff --git a/tasks/install/centos.yaml b/tasks/install/centos.yaml index aea30a6..00a073b 100644 --- a/tasks/install/centos.yaml +++ b/tasks/install/centos.yaml @@ -1,5 +1,6 @@ --- - name: Install packages (RedHat) + become: true yum: name: "{{ docker_distribution_packages }}" enablerepo: extras diff --git a/tasks/main.yaml b/tasks/main.yaml index fc60617..f3d0044 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -1,20 +1,37 @@ --- - name: Gather variables for each operating system - include_vars: "{{ item }}.yaml" + include_vars: "{{ item }}" with_first_found: - - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}" - - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}" - - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}" - - "{{ ansible_distribution | lower }}" - - "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}" - - "{{ ansible_os_family | lower }}" + - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yaml" + - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yaml" + - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yaml" + - "{{ ansible_distribution | lower }}.yaml" + - "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yaml" + - "{{ ansible_os_family | lower }}.yaml" - name: Install packages - include_tasks: "install/{{ item }}.yaml" + include_tasks: "{{ item }}" with_first_found: - - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}" - - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}" - - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}" - - "{{ ansible_distribution | lower }}" - - "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}" - - "{{ ansible_os_family | lower }}" \ No newline at end of file + - "install/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yaml" + - "install/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yaml" + - "install/{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yaml" + - "install/{{ ansible_distribution | lower }}.yaml" + - "install/{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yaml" + - "install/{{ ansible_os_family | lower }}.yaml" + +- name: Drop configuration file + become: true + template: + src: config.yml.j2 + dest: /etc/docker-distribution/registry/config.yml + notify: + - Reload Docker Distribution + +- meta: flush_handlers + +- name: Start & enable service + become: true + service: + name: docker-distribution + state: started + enabled: true \ No newline at end of file