ansible: Register SLES nodes if necessary
[lttng-ci.git] / automation / ansible / roles / common / tasks / setup-Suse.yml
CommitLineData
599b56d0 1---
a895f79d
KS
2- name: Register with SLES
3 when: ansible_distribution == 'SLES'
4 block:
5 - name: Check registration
6 ansible.builtin.command:
7 argv: ['SUSEConnect', '--status']
8 register: registration_status
9 ignore_errors: true
10 - name: Cleanup registration
11 when: registration_status.rc != 0
12 ansible.builtin.command:
13 argv[ 'SUSEConnect', '--cleanup']
14 - ansible.builtin.set_fact:
15 registration_status_data: "{{registration_status.stdout|ansible.builtin.from_json|first}}"
16 - name: Get key from host environment
17 when: registration_status_data['status'] == 'Not Registered'
18 ansible.builtin.set_fact:
19 registration_key: "{{lookup('ansible.builtin.env', 'SLES_REGISTRATION_CODE_' + ansible_architecture, default='')}}"
20 - name: Get key from bitwarden
21 when: registration_key|default('') == '' and registration_status_data['status'] == 'Not Registered'
22 ansible.builtin.set_fact:
23 registration_key: "{{lookup('community.general.bitwarden', 'bec75018-99e8-4064-9cd9-addd011947e5', search='id', field='SLES_REGISTRATION_CODE_' +ansible_architecture)[0]}}"
24 - name: Perform registration
25 when: registration_status_data['status'] == 'Not Registered'
26 ansible.builtin.command:
27 argv: ['SUSEConnect', '-r', "{{registration_key}}"]
28
eb2261ea
KS
29- name: Connect SLES Repo
30 when: ansible_distribution == 'SLES'
31 ansible.builtin.command:
32 argv: ['suseconnect', '-p', "{{item}}/{{ansible_distribution_version}}/{{ansible_architecture}}"]
33 with_items: "{{common_sles_connect_repos}}"
34
599b56d0 35- name: Ensure common patterns are installed.
58e747d8 36 zypper: "name={{ common_patterns }} type=pattern state=present update_cache=yes"
599b56d0
MJ
37
38- name: Ensure common packages are installed.
58e747d8 39 zypper: "name={{ common_packages }} type=package state=present update_cache=yes"
This page took 0.029258 seconds and 4 git commands to generate.