-
Notifications
You must be signed in to change notification settings - Fork 44
CP-13126 Update delphix-platform to install docker from official docker repo instead of docker.io #554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
CP-13126 Update delphix-platform to install docker from official docker repo instead of docker.io #554
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,9 +22,43 @@ | |||||||||||||||||||||||||||||||||
| name: "{{ item }}" | ||||||||||||||||||||||||||||||||||
| state: present | ||||||||||||||||||||||||||||||||||
| with_items: | ||||||||||||||||||||||||||||||||||
| - docker.io | ||||||||||||||||||||||||||||||||||
| - nftables | ||||||||||||||||||||||||||||||||||
| - docker-ce | ||||||||||||||||||||||||||||||||||
| - docker-ce-cli | ||||||||||||||||||||||||||||||||||
| - containerd.io | ||||||||||||||||||||||||||||||||||
| - docker-compose-plugin | ||||||||||||||||||||||||||||||||||
| - python3-docker | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Execute 'sudo systemctl start docker' command | ||||||||||||||||||||||||||||||||||
| ansible.builtin.command: sudo systemctl start docker | ||||||||||||||||||||||||||||||||||
| register: docker_status_output | ||||||||||||||||||||||||||||||||||
| changed_when: false # This command only retrieves info, doesn't change state | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| changed_when: false # This command only retrieves info, doesn't change state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment explaining why this is needed?
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using sudo within an Ansible command is redundant and potentially problematic. Ansible tasks already run with the privileges defined by become and become_user. Use the ansible.builtin.systemd module instead, which is the idiomatic way to manage systemd services: ansible.builtin.systemd: name=docker state=started enabled=yes.
| - name: Execute 'sudo systemctl start docker' command | |
| ansible.builtin.command: sudo systemctl start docker | |
| register: docker_status_output | |
| changed_when: false # This command only retrieves info, doesn't change state | |
| retries: 10 | |
| delay: 30 | |
| until: docker_status_output.rc == 0 | |
| - name: Ensure Docker service is started and enabled | |
| ansible.builtin.systemd: | |
| name: docker | |
| state: started | |
| enabled: yes | |
| register: docker_service_result | |
| retries: 10 | |
| delay: 30 | |
| until: not docker_service_result.failed |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ansible.builtin.service_facts module automatically populates ansible_facts.services, so the register directive is unnecessary. Access the service facts directly via ansible_facts.services in subsequent tasks.
| register: services_state | |
| - name: Verify Docker service is running | |
| ansible.builtin.debug: | |
| msg: "Docker service status is {{ services_state.ansible_facts.services['docker.service'].state }}" | |
| when: services_state.ansible_facts.services['docker.service'].state == 'running' | |
| - name: Verify Docker service is running | |
| ansible.builtin.debug: | |
| msg: "Docker service status is {{ ansible_facts.services['docker.service'].state }}" | |
| when: ansible_facts.services['docker.service'].state == 'running' |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The when condition makes this verification task only run when Docker is already running, which defeats the purpose of verification. If Docker is not running, the task silently skips. Consider using ansible.builtin.assert to fail the playbook if Docker is not running, or remove the when condition to always report the status.
| when: services_state.ansible_facts.services['docker.service'].state == 'running' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is all of this for?
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accessing stdout_lines[1] without bounds checking could cause an index error if the output format changes or is shorter than expected. Add validation to ensure the list has at least 2 elements before accessing index 1, or use a safer extraction method like regex to find the version line.
| msg: "Docker Client Version: {{ docker_version_output.stdout_lines[1] }}" | |
| msg: >- | |
| Docker Client Version: {{ | |
| (docker_version_output.stdout | |
| | regex_search('Version:\\s*([^\\n]+)', '\\1')) | |
| | default('unknown', true) | |
| }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of all of these dependencies?