Skip to content
Merged
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
10 changes: 8 additions & 2 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
skip_list:
- no-changed-when
profile: shared

exclude_paths:
- changelogs/
- .github/

warn_list:
- meta-runtime[unsupported-version]
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

---
name: Tests

# Controls when the action will run.
Expand All @@ -25,4 +25,5 @@ jobs:
- name: Linting code
run: |
ansible-lint -v --force-color
antsibull-changelog lint
flake8 -v
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/changelogs/.plugin-cache.yaml
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
==============================
stackhpc.cephadm Release Notes
==============================

.. contents:: Topics


v1.13.0
=======

Release Summary
---------------

Minor release adding support for choosing plugin in EC profiles


Minor Changes
-------------

- Add support for choosing plugin in EC profiles
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ collections:

See [Ansible Using collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) for more details.

## Release notes handling

See [antsibull-changelog docs](https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelogs.rst) for instructions how to deal with release notes.

## More information

- [Ansible Collection overview](https://github.com/ansible-collections/overview)
Expand Down
9 changes: 9 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ancestor: null
releases:
1.13.0:
release_date: '2023-02-28'
changes:
release_summary: |
Minor release adding support for choosing plugin in EC profiles
minor_changes:
- Add support for choosing plugin in EC profiles
32 changes: 32 additions & 0 deletions changelogs/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
changelog_filename_template: ../CHANGELOG.rst
changelog_filename_version_depth: 0
changes_file: changelog.yaml
changes_format: combined
ignore_other_fragment_extensions: true
keep_fragments: false
mention_ancestor: true
new_plugins_after_name: removed_features
notesdir: fragments
prelude_section_name: release_summary
prelude_section_title: Release Summary
sanitize_changelog: true
sections:
- - major_changes
- Major Changes
- - minor_changes
- Minor Changes
- - breaking_changes
- Breaking Changes / Porting Guide
- - deprecated_features
- Deprecated Features
- - removed_features
- Removed Features (previously deprecated)
- - security_fixes
- Security Fixes
- - bugfixes
- Bugfixes
- - known_issues
- Known Issues
title: stackhpc.cephadm
trivial_section_name: trivial
use_fqcn: true
2 changes: 2 additions & 0 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ license:
- "Apache-2.0"
tags:
- cephadm
- infrastructure
description: "Ansible roles to create and manage cephadm-based Ceph deployments"
repository: "https://github.com/stackhpc/ansible-collection-cephadm"
16 changes: 8 additions & 8 deletions roles/cephadm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ All Ceph hosts must be in the `ceph` group.
* General
* `cephadm_ceph_release`: Ceph release to deploy (default: pacific)
* `cephadm_fsid`: FSID to use for cluster (default: empty - cephadm will generate FSID)
* `cephadm_recreate`: If existing cluster should be destroyed and recreated (default: False)
* `cephadm_custom_repos`: If enabled - the role won't define yum/apt repositories (default: False)
* `cephadm_package_update`: If enabled - cephadm package will be updated to latest version (default: False)
* `cephadm_recreate`: If existing cluster should be destroyed and recreated (default: false)
* `cephadm_custom_repos`: If enabled - the role won't define yum/apt repositories (default: false)
* `cephadm_package_update`: If enabled - cephadm package will be updated to latest version (default: false)
* `cephadm_host_labels`: If set (list format) - those additional labels will be applied to host definitions (default: [] - empty list)
* Bootstrap settings
* `cephadm_bootstrap_host`: The host on which to bootstrap Ceph (default: `groups['mons'][0]`)
* `cephadm_enable_dashboard`: If enabled - dashboard service on MGR will be enabled (default: False)
* `cephadm_enable_firewalld`: If enabled - firewalld will be installed and rules will be applied (default: False)
* `cephadm_enable_monitoring`: If enabled - cephadm monitoring stack will be deployed i.e. prometheus/node-exporters/grafana (default: False)
* `cephadm_enable_dashboard`: If enabled - dashboard service on MGR will be enabled (default: false)
* `cephadm_enable_firewalld`: If enabled - firewalld will be installed and rules will be applied (default: false)
* `cephadm_enable_monitoring`: If enabled - cephadm monitoring stack will be deployed i.e. prometheus/node-exporters/grafana (default: false)
* `cephadm_image`: If set - cephadm will use this image
* `cephadm_install_ceph_cli`: If enabled - ceph cli will be installed on the hosts (default: False)
* `cephadm_install_ceph_cli`: If enabled - ceph cli will be installed on the hosts (default: false)
* `cephadm_ssh_public_key`: Location where ssh public key used by cephadm will be saved (default: /etc/ceph/cephadm.pub)
* `cephadm_ssh_private_key`: Location where ssh private key used by cephadm will be saved (default: /etc/ceph/cephadm.id)
* `cephadm_ssh_user`: Pre-existing user name that should be used for bootstrapping the cluster. User must have passwordless sudo enabled. Since 1.4.0 (default: `ansible_user`)
Expand Down Expand Up @@ -97,7 +97,7 @@ All Ceph hosts must be in the `ceph` group.
virtual_ip: 10.66.0.1/24
ssl_cert: {example_certificate_chain}
```
Note that adding RGW or other services to an existing deployment requires setting `cephadm_bootstrap` variable to *True*.
Note that adding RGW or other services to an existing deployment requires setting `cephadm_bootstrap` variable to *true*.

* Registry
* `cephadm_registry_url`: (default: not used)
Expand Down
16 changes: 8 additions & 8 deletions roles/cephadm/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
cephadm_ceph_release: pacific
cephadm_skip_prechecks: False
cephadm_skip_prechecks: false
# FSID
cephadm_fsid: ""
# Recreate cluster
cephadm_recreate: False
cephadm_recreate: false
# Packages
cephadm_custom_repos: False
cephadm_package_update: False
cephadm_custom_repos: false
cephadm_package_update: false
# Image
cephadm_image: ""
# Registry
Expand All @@ -16,11 +16,11 @@ cephadm_registry_username: ""
cephadm_registry_password: ""
# Bootstrap settings
cephadm_bootstrap_host: "{{ groups['mons'][0] }}"
cephadm_enable_dashboard: False
cephadm_enable_firewalld: False
cephadm_enable_monitoring: False
cephadm_enable_dashboard: false
cephadm_enable_firewalld: false
cephadm_enable_monitoring: false
cephadm_host_labels: []
cephadm_install_ceph_cli: False
cephadm_install_ceph_cli: false
cephadm_ssh_public_key: "/etc/ceph/cephadm.pub"
cephadm_ssh_private_key: "/etc/ceph/cephadm.id"
cephadm_ssh_user: "{{ ansible_user }}"
Expand Down
14 changes: 10 additions & 4 deletions roles/cephadm/tasks/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,28 @@
--mon-ip={{ mon_ip }}
{{ cephadm_bootstrap_additional_parameters }}
become: true
changed_when: true
when: not cephadm_check_ceph_conf.stat.exists

- name: Set public network
command:
cmd: "cephadm shell -- ceph config set global public_network {{ cephadm_public_network }}"
cmd: "cephadm shell -- ceph config set mon public_network {{ cephadm_public_network }}"
become: true
changed_when: true

- name: Set cluster network
command:
cmd: "cephadm shell -- ceph config set global cluster_network {{ cephadm_cluster_network }}"
cmd: "cephadm shell -- ceph config set mon cluster_network {{ cephadm_cluster_network }}"
when: cephadm_cluster_network | length > 0
become: true
changed_when: true

- name: Get cluster fsid
command:
cmd: "cephadm shell -- ceph fsid"
when: cephadm_fsid | length == 0
become: true
changed_when: false
register: cephadm_fsid_current

- name: Template out cluster.yml
Expand All @@ -60,19 +64,21 @@
dest: "/var/run/ceph/{{ fsid }}/cephadm_cluster.yml"
owner: root
group: root
mode: 0644
mode: "0644"
become: true
run_once: True
run_once: true

- name: Apply spec
command:
cmd: >
cephadm shell --
ceph orch apply -i /var/run/ceph/cephadm_cluster.yml
changed_when: true
become: true

- name: Install ceph cli on mon hosts
command:
cmd: "cephadm install ceph"
become: true
changed_when: true
when: cephadm_install_ceph_cli
1 change: 1 addition & 0 deletions roles/cephadm/tasks/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
command:
cmd: "cephadm rm-cluster --fsid {{ fsid_result.stdout }} --force"
become: true
changed_when: true
when: fsid_result.rc != 1

- name: Remove ssh keys
Expand Down
24 changes: 16 additions & 8 deletions roles/cephadm/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
---
- include_tasks: "destroy.yml"
- name: "Destroy cephadm deployment"
include_tasks: "destroy.yml"
when:
- cephadm_recreate | bool

- include_tasks: "prechecks.yml"
- name: "Run prechecks"
include_tasks: "prechecks.yml"
when: not cephadm_skip_prechecks | bool

- include_tasks: "pkg_{{ ansible_facts.os_family | lower }}.yml"
- name: "Install packages"
include_tasks: "pkg_{{ ansible_facts.os_family | lower }}.yml"

- include_tasks: "prereqs_bootstrap.yml"
- name: "Bootstrap prereqs"
include_tasks: "prereqs_bootstrap.yml"
when:
- inventory_hostname == cephadm_bootstrap_host

- import_tasks: "prereqs.yml"
- name: "Prereq tasks"
import_tasks: "prereqs.yml"

- include_tasks: "bootstrap.yml"
- name: "Bootstrap"
include_tasks: "bootstrap.yml"
when:
- cephadm_bootstrap | bool
- inventory_hostname == cephadm_bootstrap_host

- import_tasks: "osds.yml"
- name: "Add osds individually"
import_tasks: "osds.yml"

- include_tasks: "osds_spec.yml"
- name: "Ensure osd spec is defined"
include_tasks: "osds_spec.yml"
when:
- cephadm_osd_spec | length > 0
- inventory_hostname == cephadm_bootstrap_host
3 changes: 2 additions & 1 deletion roles/cephadm/tasks/osds_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
dest: "/var/run/ceph/{{ fsid }}/osd_spec.yml"
owner: root
group: root
mode: 0644
mode: "0o644"
become: true

- name: Apply OSDs spec
Expand All @@ -24,3 +24,4 @@
cephadm shell --
ceph orch apply -i /var/run/ceph/osd_spec.yml
become: true
changed_when: true
6 changes: 3 additions & 3 deletions roles/cephadm/tasks/pkg_debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
path: "{{ cephadm_apt_key_path | dirname }}"
owner: root
group: root
mode: 0755
mode: "0755"
state: directory
when: not cephadm_custom_repos | bool
become: true
Expand All @@ -22,7 +22,7 @@
dest: "{{ cephadm_apt_key_path }}"
owner: root
group: root
mode: 0644
mode: "0644"
when: not cephadm_custom_repos | bool
become: true

Expand All @@ -40,5 +40,5 @@
apt:
name: "cephadm"
state: "{{ 'latest' if cephadm_package_update | bool else 'present' }}"
update_cache: yes
update_cache: true
become: true
4 changes: 2 additions & 2 deletions roles/cephadm/tasks/pkg_redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
name: "ceph-{{ item.0 + '-' + item.1 if item.0 == 'noarch' else item.1 }}"
description: "Ceph {{ item.1 }} repo {{ item.0 }}"
baseurl: "https://download.ceph.com/rpm-{{ item.1 }}/el8/{{ item.0 }}"
gpgcheck: yes
gpgcheck: true
gpgkey: "https://download.ceph.com/keys/release.asc"
state: "{{ 'present' if item.1 == cephadm_ceph_release else 'absent' }}"
when: not cephadm_custom_repos | bool
Expand All @@ -30,5 +30,5 @@
dnf:
name: "cephadm"
state: "{{ 'latest' if cephadm_package_update | bool else 'present' }}"
update_cache: yes
update_cache: true
become: true
2 changes: 1 addition & 1 deletion roles/cephadm/tasks/prereqs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package:
name: logrotate
state: present
become: True
become: true

- name: Log into Docker registry
docker_login:
Expand Down
7 changes: 4 additions & 3 deletions roles/cephadm/tasks/prereqs_bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
state: directory
owner: root
group: root
mode: 0755
mode: "0o755"
become: true

- name: Check if /etc/ceph/ceph.conf exists
Expand Down Expand Up @@ -33,7 +33,7 @@
dest: "{{ cephadm_ssh_public_key }}"
owner: root
group: root
mode: 0644
mode: "0o644"
become: true
when: not cephadm_check_ceph_id.stat.exists

Expand All @@ -45,4 +45,5 @@

- name: Set a fact about the SSH public key
set_fact:
cephadm_ssh_public_key_content: "{{ cephadm_ssh_public_key_slurp.content | b64decode if cephadm_check_ceph_id.stat.exists else cephadm_ssh_key.public_key }}"
cephadm_ssh_public_key_content: >-
{{ cephadm_ssh_public_key_slurp.content | b64decode if cephadm_check_ceph_id.stat.exists else cephadm_ssh_key.public_key }}
3 changes: 2 additions & 1 deletion roles/commands/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
register: cephadm_commands_result
with_items: "{{ cephadm_commands }}"
become: true
changed_when: true
when: cephadm_commands | length > 0

delegate_to: "{{ groups['mons'][0] }}"
run_once: True
run_once: true
3 changes: 2 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ansible>=2.9
ansible-lint<6
ansible-lint<7
antsibull-changelog
flake8<5