Skip to content

Commit 2db3161

Browse files
committed
feat: client-scripts: clients.yaml: Set up yggdrasild if needed
Set up the yggdrasild configuration file to register against the Satellite server.
1 parent 089a669 commit 2db3161

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

playbooks/satellite/roles/client-scripts/files/clients.yaml.j2

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,24 @@
8282
TZ: UTC # make sure returned times are in UTC
8383
register: reg
8484

85+
- name: Upload yggdrasild configuration file (if rex_mode == 'mqtt')
86+
ansible.builtin.copy:
87+
dest: /etc/yggdrasil/config.toml
88+
content: |
89+
# yggdrasil global configuration settings written by katello-pull-transport-migrate
90+
broker = ["mqtts://{{ server }}:1883"]
91+
cert-file = "/etc/pki/consumer/cert.pem"
92+
key-file = "/etc/pki/consumer/key.pem"
93+
ca-root = ["/etc/rhsm/ca/katello-server-ca.pem"]
94+
log-level = "error"
95+
when: "rex_mode == 'mqtt'"
96+
97+
- name: Restart yggdrasild service unit (if rex_mode == 'mqtt')
98+
ansible.builtin.systemd:
99+
name: yggdrasild
100+
state: restarted
101+
when: "rex_mode == 'mqtt'"
102+
85103
- name: "Register - output"
86104
debug:
87105
msg:

playbooks/tests/registrations.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,28 @@
7272
&> "{{ clients_yaml_cmd_log }}"
7373
register: clients_yaml_cmd
7474
ignore_errors: true
75-
when: "method == 'clients.yaml'"
75+
when:
76+
- method == 'clients.yaml'
77+
- hostvars[groups['satellite6']|first].rex_mode is not defined or hostvars[groups['satellite6']|first].rex_mode == 'ssh'
78+
79+
- name: "Run clients.yaml (log = {{ clients_yaml_cmd_log }})"
80+
shell: |
81+
ansible-playbook \
82+
--private-key /root/id_rsa_key \
83+
--forks "{{ size }}" \
84+
-i clients.ini \
85+
-e "server={{ groups['satellite6']|first }}" \
86+
-e "activationkey='ActivationKey'" \
87+
-e "organization='{{ sat_orglabel }}'" \
88+
-e "config_server_server_timeout='{{ config_server_server_timeout|default('') }}'" \
89+
-e "rex_mode='mqtt'" \
90+
clients.yaml \
91+
&> "{{ clients_yaml_cmd_log }}"
92+
register: clients_yaml_cmd
93+
ignore_errors: true
94+
when:
95+
- method == 'clients.yaml'
96+
- hostvars[groups['satellite6']|first].rex_mode is defined and hostvars[groups['satellite6']|first].rex_mode == 'mqtt'
7697

7798
- name: "Run clients-register.yaml (log = {{ clients_yaml_cmd_log }})"
7899
shell: |

0 commit comments

Comments
 (0)