diff --git a/meta/main.yml b/meta/main.yml index 57edcfa..90d02e1 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -23,4 +23,4 @@ galaxy_info: - 'compose' - 'containerd' -dependencies: [] \ No newline at end of file +dependencies: [] diff --git a/meta/requirements.yml b/meta/requirements.yml deleted file mode 100644 index 0ad83a8..0000000 --- a/meta/requirements.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -# meta file for install_docker -roles: - - name: ednxzu.manage_repositories - - name: ednxzu.manage_apt_packages diff --git a/molecule/default/requirements.yml b/molecule/default/requirements.yml index 91e6923..1684f2f 100644 --- a/molecule/default/requirements.yml +++ b/molecule/default/requirements.yml @@ -1,3 +1 @@ -roles: - - name: ednxzu.manage_repositories - - name: ednxzu.manage_apt_packages +roles: [] diff --git a/tasks/configure.yml b/tasks/configure.yml index 4f82737..e278693 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -1,2 +1,21 @@ --- -# task/configure file for install_docker \ No newline at end of file +# task/configure file for install_docker +- name: "Create group {{ install_docker_group }}" + ansible.builtin.group: + name: "{{ install_docker_group }}" + state: present + +- name: "Create directory {{ install_docker_daemon_dir }}" + ansible.builtin.file: + path: "{{ install_docker_daemon_dir }}" + state: directory + owner: root + group: root + mode: '0755' + +- name: "Add specified users to group {{ install_docker_group }}" + ansible.builtin.user: + name: "{{ item }}" + groups: "{{ install_docker_group }}" + append: true + loop: "{{ install_docker_users }}" diff --git a/tasks/install_docker_pip.yml b/tasks/install_docker_pip.yml new file mode 100644 index 0000000..fcb4cd4 --- /dev/null +++ b/tasks/install_docker_pip.yml @@ -0,0 +1,8 @@ +--- +# task/install_docker_pip file for install_docker +- name: "Install docker python packages" + ansible.builtin.include_role: + name: ednxzu.manage_pip_packages + vars: + manage_pip_packages_install_prereqs: false + manage_pip_packages_list: "{{ install_docker_pip_packages }}" diff --git a/tasks/main.yml b/tasks/main.yml index 170d8e3..58f0efc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,14 +1,18 @@ --- # task/main file for install_docker +- name: "Import prerequisites.yml" + ansible.builtin.include_tasks: prerequisites.yml + +- name: "Import install.yml" + ansible.builtin.include_tasks: install.yml + - name: "Import install_compose.yml" ansible.builtin.include_tasks: install_compose.yml when: install_docker_compose -# - name: "Import prerequisites.yml" -# ansible.builtin.include_tasks: prerequisites.yml -# -# - name: "Import install.yml" -# ansible.builtin.include_tasks: install.yml -# -# - name: "Import configure.yml" -# ansible.builtin.include_tasks: configure.yml \ No newline at end of file +- name: "Import install_docker_pip.yml" + ansible.builtin.include_tasks: install_docker_pip.yml + when: install_docker_python_packages + +- name: "Import configure.yml" + ansible.builtin.include_tasks: configure.yml diff --git a/tasks/prerequisites.yml b/tasks/prerequisites.yml index 4a525cb..75c24af 100644 --- a/tasks/prerequisites.yml +++ b/tasks/prerequisites.yml @@ -1,2 +1,9 @@ --- # task/prerequisites file for install_docker +- name: "Install required roles" + ansible.builtin.command: + cmd: "ansible-galaxy install {{ item }}" + loop: "{{ install_docker_prerequisites_roles }}" + changed_when: false + delegate_to: localhost + run_once: true diff --git a/vars/main.yml b/vars/main.yml index b54ea54..f75f792 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,8 +1,14 @@ --- # vars file for install_docker +install_docker_prerequisites_roles: + - ednxzu.manage_repositories + - ednxzu.manage_apt_packages + - ednxzu.manage_pip_packages install_docker_compose_path: "/usr/local/bin/docker-compose" install_docker_compose_github_api: https://api.github.com/repos/docker/compose install_docker_compose_github_url: https://github.com/docker/compose +install_docker_group: docker +install_docker_daemon_dir: /etc/docker install_docker_packages: - name: "docker-{{ install_docker_edition }}" version: latest @@ -16,10 +22,10 @@ install_docker_packages: - name: "containerd.io" version: latest state: present -install_docker_compose_packages: - - name: - version: - state: "{{ 'present' if install_docker_compose else 'absent' }}" +install_docker_pip_packages: + - name: docker + version_constraint: latest + state: present install_docker_repository: - uri: "https://download.docker.com/linux/{{ ansible_distribution|lower }}" gpg_key: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg"