Skip to content

Commit b6d644a

Browse files
committed
Fix ansible-lint errors in roles - change argument_spec.yml
Signed-off-by: Justin Cinkelj <justin.cinkelj@xlab.si>
1 parent 9d30abb commit b6d644a

File tree

25 files changed

+181
-103
lines changed

25 files changed

+181
-103
lines changed

docs/rst/extra/deprecation.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ For ``scale_computing.hypercore.iso`` module:
5757
ansible.builtin.debug:
5858
msg: The uploaded_iso size={{ uploaded_iso.record.size }}
5959
60+
Release 1.3.0
61+
=============
62+
63+
Role parameters were renamed to start with ``role_name_`` prefix.
64+
For example, role `scale_computing.hypercore.version_update_single_node <../collections/scale_computing/hypercore/version_update_single_node_role.html>`_:
65+
66+
* ``scale_computing_hypercore_desired_version`` name was used before.
67+
* ``version_update_single_node_desired_version`` name is used now.
68+
69+
Old names are still valid, but will be removed in future release 3.0.0.
70+
6071
Release 3.0.0 (not yet released)
6172
================================
6273

examples/cluster_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@
5050
ansible.builtin.include_role:
5151
name: scale_computing.hypercore.cluster_config
5252
vars:
53-
scale_computing_hypercore_cluster_config: "{{ cluster_configuration }}"
53+
cluster_config_configuration: "{{ cluster_configuration }}"

examples/shutdown_restart_tagged_vms.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
name: scale_computing.hypercore.version_update_single_node
6464
tasks_from: shutdown_vms
6565
vars:
66-
scale_computing_hypercore_shutdown_vms: "{{ vm_desired_state }}"
67-
scale_computing_hypercore_shutdown_tags: "{{ vm_shutdown_tags }}"
66+
version_update_single_node_shutdown_vms: "{{ vm_desired_state }}"
67+
version_update_single_node_shutdown_tags: "{{ vm_shutdown_tags }}"
6868

6969
- name: List tagged VMs power-state after shutdown
7070
block: *list-tagged-vms
@@ -75,7 +75,7 @@
7575
name: scale_computing.hypercore.version_update_single_node
7676
tasks_from: restart_vms.yml
7777
vars:
78-
scale_computing_hypercore_restart_vms: "{{ vm_desired_state }}"
78+
version_update_single_node_restart_vms: "{{ vm_desired_state }}"
7979

8080
- name: List tagged VMs power-state after restart
8181
block: *list-tagged-vms

examples/version_update_single_node.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
ansible.builtin.include_role:
2929
name: scale_computing.hypercore.check_local_time
3030
vars:
31-
time_zone: "{{ time_zone_info.record.zone }}"
32-
time_interval: 22:00-6:00
31+
check_local_time_time_zone: "{{ time_zone_info.record.zone }}"
32+
check_local_time_time_interval: 22:00-6:00
3333

3434
- name: Update HyperCore single-node system to a desired version
3535
ansible.builtin.include_role:
3636
name: scale_computing.hypercore.version_update_single_node
3737
vars:
38-
scale_computing_hypercore_desired_version: "{{ desired_version }}"
38+
version_update_single_node_desired_version: "{{ desired_version }}"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
# renamed variables - if new name is not present, use deprecated name as default value
3+
check_local_time_time_zone: "{{ time_zone | default(omit) }}"
4+
check_local_time_time_interval: "{{ time_interval | default(omit) }}"

roles/check_local_time/meta/argument_specs.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,29 @@ argument_specs:
55
description:
66
- Check if local time meets the required time interval
77
options:
8-
time_zone:
8+
check_local_time_time_zone: &check_local_time_time_zone
99
description:
1010
- Time zone for which to calculate if local time meets the required time interval
1111
- Must be provided in a form 'Europe/Amsterdam'
1212
required: true
1313
type: str
14-
time_interval:
14+
check_local_time_time_interval: &check_local_time_time_interval
1515
description:
1616
- Time interval in which local time must be located
1717
- Must be provided in a form '22:00-6:15' or '7:30-12:36'
1818
required: true
1919
type: str
20+
# -------------
21+
# Renamed/deprecated vars
22+
time_zone:
23+
<<: *check_local_time_time_zone
24+
description:
25+
- DEPRECATED, will be removed in release 3.0.0.
26+
- Please use I(check_local_time_time_zone) instead.
27+
required: false
28+
time_interval:
29+
<<: *check_local_time_time_interval
30+
description:
31+
- DEPRECATED, will be removed in release 3.0.0.
32+
- Please use I(check_local_time_time_interval) instead.
33+
required: false

roles/check_local_time/tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
- name: Check if local time is in time interval (run check_local_time.py)
33
ansible.builtin.script:
44
executable: "{{ ansible_python_interpreter | default(ansible_playbook_python) }}"
5-
cmd: check_local_time.py "{{ time_zone }}" "{{ time_interval }}"
5+
cmd: check_local_time.py "{{ check_local_time_time_zone }}" "{{ check_local_time_time_interval }}"
66
register: check_local_time_output
77

88
- name: Assert that local time is in time interval
99
ansible.builtin.assert:
10-
fail_msg: "Local time for time zone {{ time_zone }} is not in required time interval {{ time_interval }}"
11-
success_msg: "Local time for time zone {{ time_zone }} is in required time interval {{ time_interval }}"
10+
fail_msg: "Local time for time zone {{ check_local_time_time_zone }} is not in required time interval {{ check_local_time_time_interval }}"
11+
success_msg: "Local time for time zone {{ check_local_time_time_zone }} is in required time interval {{ check_local_time_time_interval }}"
1212
that:
1313
- check_local_time_output.stdout_lines[0] == "True"
1414
register: check_local_time_result
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
# Deprecated scale_computing_hypercore_cluster_config is still used if cluster_config_configuration is not defined
3+
cluster_config_configuration: "{{ scale_computing_hypercore_cluster_config | default(omit) }}"

roles/cluster_config/meta/argument_specs.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ argument_specs:
55
description:
66
- Role cluster_config can be used to fully configure a new HyperCore server, or partially reconfigure an existing HyperCore server.
77
options:
8-
scale_computing_hypercore_cluster_config:
8+
cluster_config_configuration: &cluster_config_configuration
99
description:
1010
- A dict describing a full or partial cluster configuration.
1111
- Partial configuration will be used if some of the keys in `scale_computing_hypercore_cluster_config` are omitted.
@@ -167,3 +167,9 @@ argument_specs:
167167
choices:
168168
- udp
169169
- tcp
170+
scale_computing_hypercore_cluster_config:
171+
<<: *cluster_config_configuration
172+
description:
173+
- DEPRECATED, will be removed in release 3.0.0.
174+
- Please use I(cluster_config_configuration) instead.
175+
required: false

roles/cluster_config/tasks/main.yml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,72 +7,72 @@
77

88
- name: Set cluster name
99
scale_computing.hypercore.cluster_name:
10-
name_new: "{{ scale_computing_hypercore_cluster_config.name }}"
11-
when: scale_computing_hypercore_cluster_config.name | default(False)
10+
name_new: "{{ cluster_config_configuration.name }}"
11+
when: cluster_config_configuration.name | default(False)
1212

1313
- name: Set registration data
1414
scale_computing.hypercore.registration:
15-
company_name: "{{ scale_computing_hypercore_cluster_config.registration.company_name }}"
16-
contact: "{{ scale_computing_hypercore_cluster_config.registration.contact }}"
17-
phone: "{{ scale_computing_hypercore_cluster_config.registration.phone }}"
18-
email: "{{ scale_computing_hypercore_cluster_config.registration.email }}"
15+
company_name: "{{ cluster_config_configuration.registration.company_name }}"
16+
contact: "{{ cluster_config_configuration.registration.contact }}"
17+
phone: "{{ cluster_config_configuration.registration.phone }}"
18+
email: "{{ cluster_config_configuration.registration.email }}"
1919
state: present
20-
when: scale_computing_hypercore_cluster_config.registration | default(False)
20+
when: cluster_config_configuration.registration | default(False)
2121

2222
- name: Set DNS servers configuration
2323
scale_computing.hypercore.dns_config:
24-
dns_servers: "{{ scale_computing_hypercore_cluster_config.dns.server_ips | default(omit) }}"
24+
dns_servers: "{{ cluster_config_configuration.dns.server_ips | default(omit) }}"
2525
state: set
2626
when:
27-
- scale_computing_hypercore_cluster_config.dns | default(False)
28-
- '"server_ips" in scale_computing_hypercore_cluster_config.dns'
29-
- scale_computing_hypercore_cluster_config.dns.server_ips is not none
27+
- cluster_config_configuration.dns | default(False)
28+
- '"server_ips" in cluster_config_configuration.dns'
29+
- cluster_config_configuration.dns.server_ips is not none
3030

3131
- name: Set DNS search_domains configuration
3232
scale_computing.hypercore.dns_config:
33-
dns_servers: "{{ scale_computing_hypercore_cluster_config.dns.server_ips | default(omit) }}"
34-
search_domains: "{{ scale_computing_hypercore_cluster_config.dns.search_domains | default(omit) }}"
33+
dns_servers: "{{ cluster_config_configuration.dns.server_ips | default(omit) }}"
34+
search_domains: "{{ cluster_config_configuration.dns.search_domains | default(omit) }}"
3535
state: set
3636
when:
37-
- scale_computing_hypercore_cluster_config.dns | default(False)
38-
- '"search_domains" in scale_computing_hypercore_cluster_config.dns'
39-
- scale_computing_hypercore_cluster_config.dns.search_domains is not none
37+
- cluster_config_configuration.dns | default(False)
38+
- '"search_domains" in cluster_config_configuration.dns'
39+
- cluster_config_configuration.dns.search_domains is not none
4040

4141
- name: Set OIDC configuration
4242
scale_computing.hypercore.oidc_config:
43-
client_id: "{{ scale_computing_hypercore_cluster_config.oidc.client_id }}"
44-
shared_secret: "{{ scale_computing_hypercore_cluster_config.oidc.shared_secret | default(omit) }}"
45-
certificate: "{{ scale_computing_hypercore_cluster_config.oidc.certificate | default(omit) }}"
46-
config_url: "{{ scale_computing_hypercore_cluster_config.oidc.config_url }}"
47-
scopes: "{{ scale_computing_hypercore_cluster_config.oidc.scopes }}"
48-
when: scale_computing_hypercore_cluster_config.oidc | default(False)
43+
client_id: "{{ cluster_config_configuration.oidc.client_id }}"
44+
shared_secret: "{{ cluster_config_configuration.oidc.shared_secret | default(omit) }}"
45+
certificate: "{{ cluster_config_configuration.oidc.certificate | default(omit) }}"
46+
config_url: "{{ cluster_config_configuration.oidc.config_url }}"
47+
scopes: "{{ cluster_config_configuration.oidc.scopes }}"
48+
when: cluster_config_configuration.oidc | default(False)
4949

5050
- name: Set time server
5151
scale_computing.hypercore.time_server:
52-
source: "{{ scale_computing_hypercore_cluster_config.time_server }}"
53-
when: scale_computing_hypercore_cluster_config.time_server | default(False)
52+
source: "{{ cluster_config_configuration.time_server }}"
53+
when: cluster_config_configuration.time_server | default(False)
5454

5555
- name: Set time zone
5656
scale_computing.hypercore.time_zone:
57-
zone: "{{ scale_computing_hypercore_cluster_config.time_zone }}"
58-
when: scale_computing_hypercore_cluster_config.time_zone | default(False)
57+
zone: "{{ cluster_config_configuration.time_zone }}"
58+
when: cluster_config_configuration.time_zone | default(False)
5959

6060
- name: Set SMTP configuration
6161
scale_computing.hypercore.smtp:
62-
server: "{{ scale_computing_hypercore_cluster_config.smtp.server }}"
63-
port: "{{ scale_computing_hypercore_cluster_config.smtp.port }}"
64-
use_ssl: "{{ scale_computing_hypercore_cluster_config.smtp.use_ssl | default(omit) }}"
65-
auth_user: "{{ scale_computing_hypercore_cluster_config.smtp.auth_user | default(omit) }}"
66-
auth_password: "{{ scale_computing_hypercore_cluster_config.smtp.auth_password | default(omit) }}"
67-
from_address: "{{ scale_computing_hypercore_cluster_config.smtp.from_address | default(omit) }}"
68-
when: scale_computing_hypercore_cluster_config.smtp | default(False)
62+
server: "{{ cluster_config_configuration.smtp.server }}"
63+
port: "{{ cluster_config_configuration.smtp.port }}"
64+
use_ssl: "{{ cluster_config_configuration.smtp.use_ssl | default(omit) }}"
65+
auth_user: "{{ cluster_config_configuration.smtp.auth_user | default(omit) }}"
66+
auth_password: "{{ cluster_config_configuration.smtp.auth_password | default(omit) }}"
67+
from_address: "{{ cluster_config_configuration.smtp.from_address | default(omit) }}"
68+
when: cluster_config_configuration.smtp | default(False)
6969

7070
- name: Reconfigure email alert recipients
7171
when:
72-
- '"email_alerts" in scale_computing_hypercore_cluster_config'
72+
- '"email_alerts" in cluster_config_configuration'
7373
- |
74-
scale_computing_hypercore_cluster_config.email_alerts or
75-
scale_computing_hypercore_cluster_config.email_alerts == []
74+
cluster_config_configuration.email_alerts or
75+
cluster_config_configuration.email_alerts == []
7676
block:
7777
- name: Get old email alert recipients
7878
scale_computing.hypercore.email_alert_info:
@@ -85,22 +85,22 @@
8585
loop: "{{ cluster_config_email_alert_info_result.records }}"
8686
loop_control:
8787
loop_var: email_alert_recipient
88-
when: email_alert_recipient.email not in scale_computing_hypercore_cluster_config.email_alerts
88+
when: email_alert_recipient.email not in cluster_config_configuration.email_alerts
8989

9090
- name: Set new email alerts
9191
scale_computing.hypercore.email_alert:
9292
email: "{{ email_address }}"
9393
state: present
94-
loop: "{{ scale_computing_hypercore_cluster_config.email_alerts or [] }}"
94+
loop: "{{ cluster_config_configuration.email_alerts or [] }}"
9595
loop_control:
9696
loop_var: email_address
9797

9898
- name: Reconfigure syslog servers
9999
when:
100-
- '"syslog_servers" in scale_computing_hypercore_cluster_config'
100+
- '"syslog_servers" in cluster_config_configuration'
101101
- |
102-
scale_computing_hypercore_cluster_config.syslog_servers or
103-
scale_computing_hypercore_cluster_config.syslog_servers == []
102+
cluster_config_configuration.syslog_servers or
103+
cluster_config_configuration.syslog_servers == []
104104
block:
105105
- name: Get old syslog servers
106106
scale_computing.hypercore.syslog_server_info:
@@ -113,14 +113,14 @@
113113
loop: "{{ cluster_config_syslog_server_info_result.records }}"
114114
loop_control:
115115
loop_var: syslog_server
116-
when: syslog_server.host not in (scale_computing_hypercore_cluster_config.syslog_servers | map(attribute='host') | list)
116+
when: syslog_server.host not in (cluster_config_configuration.syslog_servers | map(attribute='host') | list)
117117

118118
- name: Set new syslog servers
119119
scale_computing.hypercore.syslog_server:
120120
host: "{{ syslog_server.host }}"
121121
port: "{{ syslog_server.port | default(omit) }}"
122122
protocol: "{{ syslog_server.protocol | default(omit) }}"
123123
state: present
124-
loop: "{{ scale_computing_hypercore_cluster_config.syslog_servers or [] }}"
124+
loop: "{{ cluster_config_configuration.syslog_servers or [] }}"
125125
loop_control:
126126
loop_var: syslog_server

0 commit comments

Comments
 (0)