-
Notifications
You must be signed in to change notification settings - Fork 8
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 #21 from ehelms/update-to-1.1.0
Update to 1.1.0
- Loading branch information
Showing
13 changed files
with
203 additions
and
10 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
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
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 |
---|---|---|
|
@@ -10,7 +10,7 @@ authors: | |
- "Kyle Williams <[email protected]>" | ||
- "Matthias Dellweg <[email protected]>" | ||
- "willtome <[email protected]>" | ||
version: "1.0.2" | ||
version: "1.1.0" | ||
license: | ||
- "GPL-3.0-or-later" | ||
tags: | ||
|
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,29 @@ | ||
redhat.satellite_operations.cloud_connector | ||
===================================== | ||
|
||
Install and configure Red Hat Cloud Connector | ||
|
||
Role Variables | ||
-------------- | ||
|
||
Required: | ||
|
||
- `satellite_cloud_connector_url`: The URL of the Satellite server. | ||
- `satellite_cloud_connector_user`: The username cloud connector will use to talk to Satellite API. | ||
- `satellite_cloud_connector_password`: The password cloud connector will use to talk to Satellite API. | ||
|
||
Example Playbooks | ||
----------------- | ||
|
||
Run the installer setting the initial admin password: | ||
Configure Cloud Connector: | ||
|
||
```yaml | ||
- hosts: target-host | ||
roles: | ||
- role: redhat.satellite_operations.cloud_connector | ||
vars: | ||
satellite_cloud_connector_url: https://satellite.example.com | ||
satellite_cloud_connector_user: admin | ||
satellite_cloud_connector_password: changeme | ||
``` |
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,4 @@ | ||
--- | ||
satellite_cloud_connector_console_redhat_host: cert.cloud.redhat.com | ||
satellite_cloud_connector_config_file: /etc/rhc/workers/foreman_rh_cloud.toml | ||
satellite_cloud_connector_validate_certs: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
- name: Identify Satellite ID from Satellite | ||
ansible.builtin.uri: | ||
url: "{{ satellite_cloud_connector_url }}/api/settings?search=name%20%3D%20instance_id" | ||
user: "{{ satellite_cloud_connector_user }}" | ||
password: "{{ satellite_cloud_connector_password }}" | ||
return_content: true | ||
validate_certs: true | ||
force_basic_auth: true | ||
register: satellite_uuid_json | ||
|
||
- name: Find receptor configs | ||
find: | ||
paths: /etc/receptor | ||
file_type: directory | ||
register: receptor_configs | ||
|
||
- include_tasks: delete_source.yaml | ||
loop: "{{ receptor_configs['files'] }}" | ||
|
||
- name: Check if foreman-maintain installed | ||
ansible.builtin.package_facts: | ||
manager: auto | ||
|
||
- name: Collect service facts | ||
ansible.builtin.service_facts: | ||
|
||
- name: Stop any receptor services | ||
ansible.builtin.service: | ||
state: stopped | ||
enabled: false | ||
name: "{{ item.name }}" | ||
loop: "{{ ansible_facts.services.values() | selectattr('name', 'regex', 'receptor\\@.+.service') | list }}" | ||
|
||
- name: Remove receptor packages | ||
yum: | ||
state: absent | ||
name: | ||
- receptor | ||
- python3-receptor-satellite | ||
- ansiblerole-satellite-receptor-installer | ||
disable_plugin: foreman-protector | ||
|
||
- name: Cleanup receptor config | ||
file: | ||
state: absent | ||
path: /etc/receptor | ||
|
||
- name: Remove receptor service file | ||
file: | ||
state: absent | ||
path: /etc/systemd/system/[email protected] |
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,20 @@ | ||
--- | ||
- name: Get source record | ||
ansible.builtin.uri: | ||
url: "https://{{ foreman_cloud_connector_console_redhat_host }}/api/sources/v3.1/sources?filter[source_ref]={{ satellite_uuid_json.json.results[0].value }}" | ||
client_cert: "{{ item.path }}/cert.pem" | ||
client_key: "{{ item.path }}/key.pem" | ||
return_content: true | ||
register: source_record_response | ||
|
||
- name: Delete Source | ||
vars: | ||
source_id: "{{ source_record_response.json.data[0].id }}" | ||
when: "source_record_response.json.data | length == 1" | ||
ansible.builtin.uri: | ||
url: "https://{{ foreman_cloud_connector_console_redhat_host }}/api/sources/v3.1/sources/{{ source_id }}" | ||
client_cert: "{{ item.path }}/cert.pem" | ||
client_key: "{{ item.path }}/key.pem" | ||
method: "DELETE" | ||
status_code: | ||
- 204 |
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,62 @@ | ||
--- | ||
- name: Install yggdrasil-worker-forwarder and rhc | ||
yum: | ||
name: | ||
- rhc | ||
- yggdrasil-worker-forwarder | ||
disable_plugin: foreman-protector | ||
|
||
- name: Create workers directory | ||
file: | ||
state: directory | ||
path: "/etc/rhc/workers" | ||
owner: root | ||
group: root | ||
mode: 0755 | ||
|
||
- name: Configure rhc-cloud-connector-worker | ||
ansible.builtin.template: | ||
src: "foreman_rh_cloud.toml.j2" | ||
dest: "{{ satellite_cloud_connector_config_file }}" | ||
owner: root | ||
group: root | ||
mode: 0640 | ||
|
||
- name: Create rhcd worker | ||
ansible.builtin.copy: | ||
dest: /usr/libexec/rhc/foreman-rh-cloud-worker | ||
content: | | ||
#!/bin/bash | ||
CONFIG_FILE="{{ satellite_cloud_connector_config_file }}" exec /usr/libexec/yggdrasil-worker-forwarder | ||
owner: root | ||
group: root | ||
mode: 0755 | ||
|
||
- name: Ensure rhcd started | ||
service: | ||
name: rhcd | ||
state: started | ||
|
||
- name: Read client ID from CN of consumer | ||
ansible.builtin.command: openssl x509 -in /etc/pki/consumer/cert.pem -subject -noout | ||
register: cert_output | ||
when: cert_output is not defined | ||
|
||
- name: Set client ID in Satellite | ||
ansible.builtin.uri: | ||
url: "{{ satellite_cloud_connector_url }}/api/settings/rhc_instance_id" | ||
user: "{{ satellite_cloud_connector_user }}" | ||
password: "{{ satellite_cloud_connector_password }}" | ||
body: | ||
setting: | ||
value: "{{ client_id }}" | ||
method: "PUT" | ||
validate_certs: "{{ satellite_cloud_connector_validate_certs }}" | ||
force_basic_auth: true | ||
body_format: json | ||
vars: | ||
client_id: "{{ cert_output.stdout.replace('subject= /CN=', '') }}" | ||
|
||
- name: Cleanup receptor | ||
include: cleanup_receptor.yml |
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,8 @@ | ||
exec = "/usr/libexec/yggdrasil-worker-forwarder" | ||
protocol = "grpc" | ||
env = [ | ||
"FORWARDER_USER={{ satellite_cloud_connector_user }}", | ||
"FORWARDER_PASSWORD={{ satellite_cloud_connector_password }}", | ||
"FORWARDER_URL={{ satellite_cloud_connector_url }}", | ||
"FORWARDER_HANDLER=foreman_rh_cloud" | ||
] |