-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from ceph/mergify/bp/pacific/pr-145
playbooks: add new playbook 'cephadm-set-container-insecure-registries' (backport #145)
- Loading branch information
Showing
5 changed files
with
113 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
# Copyright Red Hat | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Author: Guillaume Abrioux <[email protected]> | ||
# | ||
# Usage: | ||
# | ||
# ansible-playbook -i <inventory host file> cephadm-set-container-insecure-registries.yml -e insecure_registry=<registry url> | ||
# | ||
# eg: | ||
# | ||
# ansible-playbook -i hosts cephadm-set-container-insecure-registries.yml -e insecure_registry=localhost:5000 | ||
|
||
- name: variables validations | ||
ansible.builtin.import_playbook: validate/insecure-registries.yml | ||
|
||
- hosts: all | ||
become: true | ||
gather_facts: false | ||
tasks: | ||
- name: fail if insecure_registry is undefined | ||
fail: | ||
msg: "'insecure_registry' is undefined" | ||
when: insecure_registry is undefined | ||
|
||
- name: add registry as insecure registry in registries.conf | ||
blockinfile: | ||
path: "{{ registries_conf_path | default('/etc/containers/registries.conf') }}" | ||
state: present | ||
marker: "# {mark} cephadm-ansible managed : {{ insecure_registry }}" | ||
create: yes | ||
mode: '0644' | ||
block: | | ||
[[registry]] | ||
location = '{{ insecure_registry }}' | ||
insecure = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
# Copyright Red Hat | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Author: Guillaume Abrioux <[email protected]> | ||
|
||
- hosts: localhost | ||
become: false | ||
gather_facts: false | ||
tasks: | ||
- name: fail if insecure_registry is undefined | ||
fail: | ||
msg: "'insecure_registry' is undefined, it must be set when 'set_insecure_registries' is 'true'." | ||
when: | ||
- set_insecure_registries | default(false) | bool | ||
- insecure_registry is undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
# Copyright Red Hat | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Author: Guillaume Abrioux <[email protected]> | ||
|
||
- ansible.builtin.import_playbook: insecure-registries.yml | ||
when: set_insecure_registries | default(false) | bool | ||
|
||
- hosts: localhost | ||
become: false | ||
gather_facts: false | ||
tasks: | ||
- name: import_role ceph_defaults | ||
import_role: | ||
name: ceph_defaults | ||
|
||
- name: fail when ceph_origin is custom with no repository defined | ||
fail: | ||
msg: "You must define 'ceph_custom_repositories' or 'custom_repo_url' when ceph_origin is 'custom'" | ||
when: | ||
- ceph_origin == 'custom' | ||
- custom_repo_url is undefined | ||
- ceph_custom_repositories is undefined |