Skip to content

Commit

Permalink
feat: client-scripts: clients.yaml: Set up yggdrasild if needed
Browse files Browse the repository at this point in the history
Set up the yggdrasild configuration file to register against the Satellite
server.
  • Loading branch information
pablomh committed Oct 19, 2022
1 parent 089a669 commit 71883ab
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 1 deletion.
18 changes: 18 additions & 0 deletions playbooks/satellite/roles/client-scripts/files/clients.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,24 @@
TZ: UTC # make sure returned times are in UTC
register: reg

- name: Upload yggdrasild configuration file (if rex_mode == 'mqtt')
ansible.builtin.copy:
dest: /etc/yggdrasil/config.toml
content: |
# yggdrasil global configuration settings written by katello-pull-transport-migrate
broker = ["mqtts://{{ server }}:1883"]
cert-file = "/etc/pki/consumer/cert.pem"
key-file = "/etc/pki/consumer/key.pem"
ca-root = ["/etc/rhsm/ca/katello-server-ca.pem"]
log-level = "error"
when: "rex_mode == 'mqtt'"

- name: Restart yggdrasild service unit (if rex_mode == 'mqtt')
ansible.builtin.systemd:
name: yggdrasild
state: restarted
when: "rex_mode == 'mqtt'"

- name: "Register - output"
debug:
msg:
Expand Down
23 changes: 22 additions & 1 deletion playbooks/tests/registrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,28 @@
&> "{{ clients_yaml_cmd_log }}"
register: clients_yaml_cmd
ignore_errors: true
when: "method == 'clients.yaml'"
when:
- method == 'clients.yaml'
- hostvars[groups['satellite6']|first].rex_mode is not defined or hostvars[groups['satellite6']|first].rex_mode == 'ssh'

- name: "Run clients.yaml (log = {{ clients_yaml_cmd_log }})"
shell: |
ansible-playbook \
--private-key /root/id_rsa_key \
--forks "{{ size }}" \
-i clients.ini \
-e "server={{ groups['satellite6']|first }}" \
-e "activationkey='ActivationKey'" \
-e "organization='{{ sat_orglabel }}'" \
-e "config_server_server_timeout='{{ config_server_server_timeout|default('') }}'" \
-e "rex_mode='mqtt'" \
clients.yaml \
&> "{{ clients_yaml_cmd_log }}"
register: clients_yaml_cmd
ignore_errors: true
when:
- method == 'clients.yaml'
- hostvars[groups['satellite6']|first].rex_mode is defined and hostvars[groups['satellite6']|first].rex_mode == 'mqtt'

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

0 comments on commit 71883ab

Please sign in to comment.