Some checks failed
CI / lint-and-test (push) Successful in 1m16s
CI / ansible-validation (push) Successful in 5m49s
CI / secret-scanning (push) Successful in 1m33s
CI / dependency-scan (push) Successful in 2m48s
CI / sast-scan (push) Successful in 5m46s
CI / license-check (push) Successful in 1m11s
CI / vault-check (push) Failing after 5m25s
CI / playbook-test (push) Successful in 5m32s
CI / container-scan (push) Successful in 4m32s
CI / sonar-analysis (push) Successful in 6m53s
CI / workflow-summary (push) Successful in 1m6s
- Fix UFW firewall to allow outbound traffic (was blocking all outbound) - Add HOST parameter support to shell Makefile target - Fix all ansible-lint errors (trailing spaces, missing newlines, document starts) - Add changed_when: false to check commands - Fix variable naming (vault_devGPU -> vault_devgpu) - Update .ansible-lint config to exclude .gitea/ and allow strategy: free - Fix NodeSource repository GPG key handling in shell playbook - Add missing document starts to host_vars files - Clean up empty lines in datascience role files Reviewed-on: #2
105 lines
3.2 KiB
YAML
105 lines
3.2 KiB
YAML
---
|
|
- name: Remove NodeSource repository to prevent GPG errors
|
|
ansible.builtin.shell: |
|
|
# Remove NodeSource repository file to prevent GPG errors during apt cache update
|
|
rm -f /etc/apt/sources.list.d/nodesource.list
|
|
# Remove NodeSource key file
|
|
rm -f /etc/apt/keyrings/nodesource.gpg
|
|
become: true
|
|
ignore_errors: true
|
|
changed_when: false
|
|
|
|
- name: Debug distribution information
|
|
ansible.builtin.debug:
|
|
msg:
|
|
- "Distribution: {{ ansible_facts['distribution'] }}"
|
|
- "Distribution Release: {{ ansible_facts['distribution_release'] }}"
|
|
- "Distribution Version: {{ ansible_facts['distribution_version'] }}"
|
|
- "OS Family: {{ ansible_facts['os_family'] }}"
|
|
when: ansible_debug_output | default(false) | bool
|
|
|
|
- name: Check if Docker is already installed
|
|
ansible.builtin.command: docker --version
|
|
register: docker_check
|
|
ignore_errors: true
|
|
changed_when: false
|
|
failed_when: false
|
|
no_log: true
|
|
|
|
- name: Check if Docker packages are installed via apt
|
|
ansible.builtin.package_facts:
|
|
manager: apt
|
|
register: docker_apt_check
|
|
changed_when: false
|
|
|
|
- name: Set installation condition
|
|
ansible.builtin.set_fact:
|
|
docker_needs_install: "{{ docker_check.rc != 0 or 'docker-ce' not in ansible_facts.packages }}"
|
|
|
|
- name: Docker installation tasks
|
|
when: docker_needs_install
|
|
block:
|
|
- name: Install Docker requirements
|
|
ansible.builtin.apt:
|
|
name:
|
|
- apt-transport-https
|
|
- ca-certificates
|
|
- curl
|
|
- gnupg
|
|
- lsb-release
|
|
state: present
|
|
|
|
- name: Remove old Docker repository files
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: absent
|
|
loop:
|
|
- /etc/apt/sources.list.d/docker.list
|
|
- /etc/apt/sources.list.d/docker-ce.list
|
|
|
|
- name: Create keyrings directory
|
|
ansible.builtin.file:
|
|
path: /etc/apt/keyrings
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Setup Docker GPG key
|
|
ansible.builtin.include_tasks: setup_gpg_key.yml
|
|
|
|
- name: Setup Docker repository
|
|
ansible.builtin.include_tasks: "setup_repo_{{ ansible_facts['distribution'] | lower | replace(' ', '_') }}.yml"
|
|
|
|
- name: Install Docker CE
|
|
ansible.builtin.apt:
|
|
name:
|
|
- docker-ce
|
|
- docker-ce-cli
|
|
- containerd.io
|
|
- docker-buildx-plugin
|
|
- docker-compose-plugin
|
|
state: present
|
|
|
|
- name: Start and enable Docker service
|
|
ansible.builtin.systemd:
|
|
name: docker
|
|
state: started
|
|
enabled: true
|
|
|
|
- name: Set target user variable
|
|
ansible.builtin.set_fact:
|
|
docker_target_user: "{{ ansible_user | default(ansible_user_id) }}"
|
|
|
|
- name: Add user to docker group
|
|
ansible.builtin.user:
|
|
name: "{{ docker_target_user }}"
|
|
groups: docker
|
|
append: true
|
|
|
|
- name: Display Docker status
|
|
ansible.builtin.debug:
|
|
msg:
|
|
- "Docker already installed: {{ docker_check.stdout if docker_check.rc == 0 else 'Not found' }}"
|
|
- "Docker CE package installed: {{ 'Yes' if 'docker-ce' in ansible_facts.packages else 'No' }}"
|
|
- "Actions taken: {{ 'None - Docker already present' if not docker_needs_install else 'Docker installation/configuration performed' }}"
|
|
when: ansible_debug_output | default(false) | bool
|