role installs its own dependencies

This commit is contained in:
Bertrand Lanson 2023-04-08 00:24:04 +02:00
parent a505619860
commit 01c49b73c9
8 changed files with 59 additions and 22 deletions

View File

@ -1,5 +0,0 @@
---
# meta file for install_docker
roles:
- name: ednxzu.manage_repositories
- name: ednxzu.manage_apt_packages

View File

@ -1,3 +1 @@
roles: roles: []
- name: ednxzu.manage_repositories
- name: ednxzu.manage_apt_packages

View File

@ -1,2 +1,21 @@
--- ---
# task/configure file for install_docker # 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 }}"

View File

@ -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 }}"

View File

@ -1,14 +1,18 @@
--- ---
# task/main file for install_docker # 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" - name: "Import install_compose.yml"
ansible.builtin.include_tasks: install_compose.yml ansible.builtin.include_tasks: install_compose.yml
when: install_docker_compose when: install_docker_compose
# - name: "Import prerequisites.yml" - name: "Import install_docker_pip.yml"
# ansible.builtin.include_tasks: prerequisites.yml ansible.builtin.include_tasks: install_docker_pip.yml
# when: install_docker_python_packages
# - name: "Import install.yml"
# ansible.builtin.include_tasks: install.yml - name: "Import configure.yml"
# ansible.builtin.include_tasks: configure.yml
# - name: "Import configure.yml"
# ansible.builtin.include_tasks: configure.yml

View File

@ -1,2 +1,9 @@
--- ---
# task/prerequisites file for install_docker # 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

View File

@ -1,8 +1,14 @@
--- ---
# vars file for install_docker # 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_path: "/usr/local/bin/docker-compose"
install_docker_compose_github_api: https://api.github.com/repos/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_compose_github_url: https://github.com/docker/compose
install_docker_group: docker
install_docker_daemon_dir: /etc/docker
install_docker_packages: install_docker_packages:
- name: "docker-{{ install_docker_edition }}" - name: "docker-{{ install_docker_edition }}"
version: latest version: latest
@ -16,10 +22,10 @@ install_docker_packages:
- name: "containerd.io" - name: "containerd.io"
version: latest version: latest
state: present state: present
install_docker_compose_packages: install_docker_pip_packages:
- name: - name: docker
version: version_constraint: latest
state: "{{ 'present' if install_docker_compose else 'absent' }}" state: present
install_docker_repository: install_docker_repository:
- uri: "https://download.docker.com/linux/{{ ansible_distribution|lower }}" - uri: "https://download.docker.com/linux/{{ ansible_distribution|lower }}"
gpg_key: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg" gpg_key: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg"