Skip to content
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

updated preflight and added debian tasks #300

Open
wants to merge 4 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
278 changes: 3 additions & 275 deletions cephadm-preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,284 +41,12 @@
- ceph-radosgw
- rbd-mirror
tasks:
- name: import_role ceph_defaults
- name: Import_role ceph_defaults
import_role:
name: ceph_defaults

- name: redhat family of OS related tasks
when: ansible_facts['os_family'] == 'RedHat'
block:
- name: rhcs related tasks
when: ceph_origin == 'rhcs'
block:
- name: enable red hat ceph storage tools repository
rhsm_repository:
name: "rhceph-{{ ceph_rhcs_version }}-tools-for-rhel-{{ ansible_facts['distribution_major_version'] }}-{{ ansible_facts['architecture'] }}-rpms"

- name: disable older rhceph repositories if any on RHEL{{ansible_facts['distribution_major_version']}}
when: ansible_facts['distribution_major_version'] == '8'
rhsm_repository:
name: "{{ repos_4_to_disable + repos_5_to_disable }}"
state: absent

- name: disable older rhceph repositories if any on RHEL{{ansible_facts['distribution_major_version']}}
when: ansible_facts['distribution_major_version'] == '9'
rhsm_repository:
name: "{{ repos_5_to_disable + repos_6_to_disable }}"
state: absent

- name: enable ceph package repositories
when: ceph_origin in ['community', 'ibm']
block:
- name: set_fact _ceph_repo
set_fact:
_ceph_repo:
name: ceph_stable
description: "{{ 'Ceph Stable repo' if ceph_origin == 'community' else 'IBM Ceph repo' }}"
rpm_key: "{{ ceph_stable_key if ceph_origin == 'community' else ceph_ibm_key }}"
baseurl: "{{ ceph_community_repo_baseurl if ceph_origin == 'community' else ceph_ibm_repo_baseurl }}"
paths: "{{ [ 'noarch', '$basearch' ] if ceph_origin == 'community' else [ '$basearch' ] }}"

- name: configure ceph repository key
rpm_key:
key: "{{ _ceph_repo.rpm_key }}"
state: present
register: result
until: result is succeeded

- name: configure ceph stable repository
yum_repository:
name: "ceph_stable_{{ item }}"
description: "{{ _ceph_repo.description }} - {{ item }}"
gpgcheck: true
state: present
gpgkey: "{{ _ceph_repo.rpm_key }}"
baseurl: "{{ _ceph_repo.baseurl }}/{{ item }}"
file: "ceph_stable_{{ item }}"
priority: '2'
register: result
until: result is succeeded
loop: "{{ _ceph_repo.paths }}"

- name: enable repo from shaman - dev
when: ceph_origin == 'shaman'
block:
- name: fetch ceph development repository
uri:
url:
"https://shaman.ceph.com/api/repos/ceph/\
{{ ceph_dev_branch }}/\
{{ ceph_dev_sha1 }}/\
centos/{{ ansible_facts['distribution_major_version'] }}/\
repo?arch={{ ansible_facts['architecture'] }}"
return_content: true
register: ceph_dev_yum_repo

- name: configure ceph development repository
copy:
content: "{{ ceph_dev_yum_repo.content }}"
dest: /etc/yum.repos.d/ceph-dev.repo
owner: root
group: root
mode: '0644'
backup: true

- name: remove ceph_stable repositories
yum_repository:
name: '{{ item }}'
file: ceph_stable
state: absent
with_items:
- ceph_stable
- ceph_stable_noarch

- name: enable custom repo
when: ceph_origin == 'custom'
block:
- name: set_fact ceph_custom_repositories
set_fact:
ceph_custom_repositories:
- name: ceph_custom
description: Ceph custom repo
gpgcheck: "{{ 'yes' if custom_repo_gpgkey is defined else 'no' }}"
state: "{{ custom_repo_state | default('present') }}"
gpgkey: "{{ custom_repo_gpgkey | default(omit) }}"
baseurl: "{{ custom_repo_url }}"
enabled: "{{ custom_repo_enabled | default(1) }}"
file: ceph_custom
priority: '2'
when: ceph_custom_repositories is undefined

- name: setup custom repositories
yum_repository:
name: "{{ item.name }}"
description: "{{ item.description }}"
state: "{{ item.state | default(omit) }}"
gpgcheck: "{{ item.gpgcheck | default(omit) }}"
gpgkey: "{{ item.gpgkey | default(omit) }}"
baseurl: "{{ item.baseurl }}"
file: "{{ item.ceph_custom | default(omit) }}"
priority: "{{ item.priority | default(omit) }}"
enabled: "{{ item.enabled | default(omit) }}"
register: result
until: result is succeeded
loop: "{{ ceph_custom_repositories }}"

- name: install epel-release
when: ansible_facts['distribution'] != 'RedHat'
block:
- name: enable required CentOS repository for epel
command: dnf config-manager --set-enabled "{{ 'powertools' if ansible_facts['distribution_major_version'] == '8' else 'crb' }}"
changed_when: false

- name: install epel package
package:
name: epel-release
state: present
register: result
until: result is succeeded

- name: remove remaining local services ceph packages
dnf:
name: "{{ packages_to_uninstall }}"
state: absent
autoremove: false

- name: install ceph-common on rhel
package:
name: ceph-common
state: "{{ (upgrade_ceph_packages | bool) | ternary('latest', 'present') }}"
register: result
until: result is succeeded

- name: install prerequisites packages on servers
package:
name: "{{ ceph_pkgs + infra_pkgs }}"
state: "{{ (upgrade_ceph_packages | bool) | ternary('latest', 'present') }}"
register: result
until: result is succeeded
when: group_names != [client_group]

- name: install prerequisites packages on clients
package:
name: "{{ ceph_client_pkgs }}"
state: "{{ (upgrade_ceph_packages | bool) | ternary('latest', 'present') }}"
register: result
until: result is succeeded
when: client_group in group_names


- name: ensure chronyd is running
service:
name: chronyd
state: started
enabled: true

- name: Ubuntu related tasks
when: ansible_facts['distribution'] == 'Ubuntu'
block:
- name: enable repo from download.ceph.com
block:
- name: prevent ceph certificate error
apt:
name: ca-certificates
state: latest
update_cache: true
register: result
until: result is succeeded

- name: configure ceph community repository stable key
apt_key:
url: "{{ ceph_stable_key }}"
state: present

- name: configure Ceph community repository
when: ceph_origin == 'community'
apt_repository:
repo: "deb https://download.ceph.com/debian-{{ ceph_release }}/ {{ ansible_facts['distribution_release'] }} main"
state: present
filename: ceph
update_cache: false

- name: configure Ceph testing repository
when: ceph_origin == 'testing'
apt_repository:
repo: "deb https://download.ceph.com/debian-testing/ {{ ansible_facts['distribution_release'] }} main"
state: present
filename: ceph
update_cache: false

- name: configure Ceph custom repositories
when: ceph_origin == 'custom'
apt_repository:
repo: "deb {{ item.baseurl }}/ {{ ansible_facts['distribution_release'] }} {{ item.components }}"
state: "{{ item.state | default(omit) }}"
filename: ceph_custom
update_cache: false
loop: "{{ ceph_custom_repositories }}"

- name: install prerequisites packages
apt:
name: "{{ ['python3','chrony'] + ceph_pkgs }}"
state: "{{ (upgrade_ceph_packages | bool) | ternary('latest', 'present') }}"
update_cache: true
register: result
until: result is succeeded

- name: ensure chronyd is running
service:
name: chronyd
state: started
enabled: true

- name: install container engine
block:
- name: install podman
when: ansible_facts['distribution_version'] is version('20.10', '>=')
apt:
name: podman
state: present
update_cache: true
register: result
until: result is succeeded

- name: install docker
when: ansible_facts['distribution_version'] is version('20.10', '<')
block:
- name: uninstall old version packages
apt:
name: "{{ item }}"
state: absent
loop:
- docker
- docker-engine
- docker.io
- containerd
- runc

- name: configure docker repository key
apt_key:
url: "https://download.docker.com/linux/ubuntu/gpg"
state: present

- name: setup docker repository
apt_repository:
repo: "deb https://download.docker.com/linux/ubuntu {{ ansible_facts['distribution_release'] }} stable"
state: present
filename: docker
update_cache: false

- name: install docker
apt:
name: "{{ item }}"
state: present
update_cache: true
register: result
until: result is succeeded
loop:
- docker-ce
- docker-ce-cli
- containerd.io
- name: Import specific OS-related tasks
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't seem to work

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TASK [Import specific OS-related tasks] ****************************************
task path: /home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/cephadm-preflight.yml:48
fatal: [ceph-node0]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [ceph-node1]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [ceph-node2]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [ceph-node3]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [ceph-node4]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [ceph-node5]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [client0]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [client1]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have to make it that 'complex' ?
I didn't test the following myself but I'd expect it to work as expected:

      import_tasks: tasks/redhat.yml
      - name: Import specific OS-related tasks
        import_tasks: "{{ item }}"
        with_first_found:
          - "{{ ansible_distribution }}.yml"

any issue with it?

Copy link
Author

@0lzi 0lzi Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the more complex way as when i did local linting it complained about import_tasks

WARNING  Listing 1 violation(s) that are fatal
syntax-check[specific]: You cannot use loops on 'import_tasks' statements. You should use 'include_tasks' instead.
cephadm-preflight.yml:48:7

Which it complained about in the latest job here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was also this on the previous job run

Using /home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/tests/functional/ansible.cfg as config file
ERROR! the role 'ceph-defaults' was not found in /home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/roles:/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional:/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional

The error appears to be in '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/collect-logs.yml': line 6, column 15, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

      import_role:
        name: ceph-defaults
              ^ here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is some links I looked over :

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was also this on the previous job run

Using /home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/tests/functional/ansible.cfg as config file
ERROR! the role 'ceph-defaults' was not found in /home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/roles:/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional:/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional

The error appears to be in '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/collect-logs.yml': line 6, column 15, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

      import_role:
        name: ceph-defaults
              ^ here

you can ignore this error

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the more complex way as when i did local linting it complained about import_tasks

WARNING  Listing 1 violation(s) that are fatal
syntax-check[specific]: You cannot use loops on 'import_tasks' statements. You should use 'include_tasks' instead.
cephadm-preflight.yml:48:7

Which it complained about in the latest job here

yeh the linter error makes sense, then just use include_tasks instead

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have ran this locally against my own inv file and don't get the same error than what is in the CI

TASK [Import specific OS-related tasks] ****************************************
task path: /home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/cephadm-preflight.yml:48
fatal: [ceph-node0]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [ceph-node1]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [ceph-node2]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [ceph-node3]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [ceph-node4]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [ceph-node5]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [client0]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.
fatal: [client1]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/[]' on the Ansible Controller.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplfying the include_tasks shows a path, but still not available.

    - name: Import specific OS-related tasks
      include_tasks: "tasks/{{ ansible_facts['distribution'] }}.yml"

I am wondering if the tasks folder path needs adjusting, as the Vagrantfile is using ansible.playbook = '../cephadm-preflight.yml'

TASK [Import specific OS-related tasks] ****************************************
task path: /home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/cephadm-preflight.yml:48
fatal: [ceph-node0]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/tasks/CentOS.yml' on the Ansible Controller.
fatal: [ceph-node1]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/tasks/CentOS.yml' on the Ansible Controller.
fatal: [ceph-node2]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/tasks/CentOS.yml' on the Ansible Controller.
fatal: [ceph-node3]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/tasks/CentOS.yml' on the Ansible Controller.
fatal: [ceph-node4]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/tasks/CentOS.yml' on the Ansible Controller.
fatal: [ceph-node5]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/tasks/CentOS.yml' on the Ansible Controller.
fatal: [client0]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/tasks/CentOS.yml' on the Ansible Controller.
fatal: [client1]: FAILED! => 
  reason: Could not find or access '/home/jenkins-build/build/workspace/cephadm-ansible-prs-el9-functional/tasks/CentOS.yml' on the Ansible Controller.

include_tasks: "tasks/{{ ansible_facts['distribution'] }}.yml"

- name: set insecure container registry in /etc/containers/registries.conf
ansible.builtin.import_playbook: cephadm-set-container-insecure-registries.yml
Expand Down
1 change: 1 addition & 0 deletions tasks/Centos.yml
103 changes: 103 additions & 0 deletions tasks/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
- name: enable repo from download.ceph.com
block:
- name: prevent ceph certificate error
apt:
name: ca-certificates
state: latest
update_cache: true
register: result
until: result is succeeded

- name: configure ceph community repository stable key
apt_key:
url: "{{ ceph_stable_key }}"
state: present

- name: configure Ceph community repository
when: ceph_origin == 'community'
apt_repository:
repo: "deb https://download.ceph.com/debian-{{ ceph_release }}/ {{ ansible_facts['distribution_release'] }} main"
state: present
filename: ceph
update_cache: false

- name: configure Ceph testing repository
when: ceph_origin == 'testing'
apt_repository:
repo: "deb https://download.ceph.com/debian-testing/ {{ ansible_facts['distribution_release'] }} main"
state: present
filename: ceph
update_cache: false

- name: configure Ceph custom repositories
when: ceph_origin == 'custom'
apt_repository:
repo: "deb {{ item.baseurl }}/ {{ ansible_facts['distribution_release'] }} {{ item.components }}"
state: "{{ item.state | default(omit) }}"
filename: ceph_custom
update_cache: false
loop: "{{ ceph_custom_repositories }}"

- name: install prerequisites packages
apt:
name: "{{ ['python3','chrony'] + ceph_pkgs }}"
state: "{{ (upgrade_ceph_packages | bool) | ternary('latest', 'present') }}"
update_cache: true
register: result
until: result is succeeded

- name: ensure chronyd is running
service:
name: chronyd
state: started
enabled: true

- name: install container engine
block:
- name: install podman
when: ansible_facts['distribution_version'] is version('11', '>=')
apt:
name: podman
state: present
update_cache: true
register: result
until: result is succeeded

- name: install docker
when: ansible_facts['distribution_version'] is version('10', '<')
block:
- name: uninstall old version packages
apt:
name: "{{ item }}"
state: absent
loop:
- docker
- docker-engine
- docker.io
- containerd
- runc

- name: configure docker repository key
apt_key:
url: "https://download.docker.com/linux/debian/gpg"
state: present

- name: setup docker repository
apt_repository:
repo: "deb https://download.docker.com/linux/debian {{ ansible_facts['distribution_release'] }} stable"
state: present
filename: docker
update_cache: false

- name: install docker
apt:
name: "{{ item }}"
state: present
update_cache: true
register: result
until: result is succeeded
loop:
- docker-ce
- docker-ce-cli
- containerd.io

Loading