ilia 378b9d4686
Some checks failed
CI / lint-and-test (pull_request) Successful in 1m16s
CI / ansible-validation (pull_request) Successful in 5m54s
CI / secret-scanning (pull_request) Successful in 1m33s
CI / dependency-scan (pull_request) Successful in 2m49s
CI / sast-scan (pull_request) Successful in 8m53s
CI / license-check (pull_request) Successful in 1m16s
CI / vault-check (pull_request) Failing after 9m5s
CI / playbook-test (pull_request) Successful in 6m10s
CI / container-scan (pull_request) Successful in 4m35s
CI / sonar-analysis (pull_request) Successful in 5m55s
CI / workflow-summary (pull_request) Successful in 1m6s
Enhance Makefile and host configurations for improved usability and error handling
- Update `dev` target in Makefile to support optional SUDO and SSH_PASS parameters for better flexibility.
- Correct the IP address for `dev02` in the inventory file.
- Add host variables for `KrakenMint`, including user configuration and vault file for sensitive data.
- Modify `dev02` host variables to skip data science stack installation.
- Implement tasks to remove NodeSource repository across multiple roles to prevent GPG errors during apt operations.
- Update development playbook to handle Node.js installation more robustly, including checks for existing installations and repository configurations.
- Ensure apt cache updates ignore NodeSource errors to improve reliability.
2025-12-25 16:46:47 -05:00

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