ansible-lint: Don't use bare variables (#4608)
Circumvented one false positive from ansible-lint Moved a block of jinja magic into its own variable
This commit is contained in:
parent
424e59805f
commit
a65605b17a
3 changed files with 4 additions and 5 deletions
|
@ -4,7 +4,6 @@ skip_list:
|
||||||
# see https://docs.ansible.com/ansible-lint/rules/default_rules.html for a list of all default rules
|
# see https://docs.ansible.com/ansible-lint/rules/default_rules.html for a list of all default rules
|
||||||
# The following rules throw errors.
|
# The following rules throw errors.
|
||||||
# These either still need to be corrected in the repository and the rules re-enabled or they are skipped on purpose.
|
# These either still need to be corrected in the repository and the rules re-enabled or they are skipped on purpose.
|
||||||
- '104'
|
|
||||||
- '201'
|
- '201'
|
||||||
- '204'
|
- '204'
|
||||||
- '206'
|
- '206'
|
||||||
|
|
|
@ -22,13 +22,14 @@
|
||||||
- ca.pem
|
- ca.pem
|
||||||
- node-{{ inventory_hostname }}-key.pem
|
- node-{{ inventory_hostname }}-key.pem
|
||||||
|
|
||||||
|
|
||||||
- name: "Check_certs | Set 'gen_certs' to true"
|
- name: "Check_certs | Set 'gen_certs' to true"
|
||||||
set_fact:
|
set_fact:
|
||||||
gen_certs: true
|
gen_certs: true
|
||||||
when: not item in etcdcert_master.files|map(attribute='path') | list
|
when: not item in etcdcert_master.files|map(attribute='path') | list
|
||||||
run_once: true
|
run_once: true
|
||||||
with_items: >-
|
with_items: "{{ expected_files }}"
|
||||||
|
vars:
|
||||||
|
expected_files: >-
|
||||||
['{{etcd_cert_dir}}/ca.pem',
|
['{{etcd_cert_dir}}/ca.pem',
|
||||||
{% set all_etcd_hosts = groups['k8s-cluster']|union(groups['etcd'])|union(groups['calico-rr']|default([]))|unique|sort %}
|
{% set all_etcd_hosts = groups['k8s-cluster']|union(groups['etcd'])|union(groups['calico-rr']|default([]))|unique|sort %}
|
||||||
{% for host in all_etcd_hosts %}
|
{% for host in all_etcd_hosts %}
|
||||||
|
@ -36,7 +37,6 @@
|
||||||
{% if not loop.last %}{{','}}{% endif %}
|
{% if not loop.last %}{{','}}{% endif %}
|
||||||
{% endfor %}]
|
{% endfor %}]
|
||||||
|
|
||||||
|
|
||||||
- name: "Check_certs | Set 'gen_node_certs' to true"
|
- name: "Check_certs | Set 'gen_node_certs' to true"
|
||||||
set_fact:
|
set_fact:
|
||||||
gen_node_certs: |-
|
gen_node_certs: |-
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
etc_hosts_localhosts_dict: >-
|
etc_hosts_localhosts_dict: >-
|
||||||
{%- set splitted = (item | regex_replace('[ \t]+', ' ')|regex_replace('#.*$')|trim).split( ' ') -%}
|
{%- set splitted = (item | regex_replace('[ \t]+', ' ')|regex_replace('#.*$')|trim).split( ' ') -%}
|
||||||
{{ etc_hosts_localhosts_dict|default({}) | combine({splitted[0]: splitted[1::] }) }}
|
{{ etc_hosts_localhosts_dict|default({}) | combine({splitted[0]: splitted[1::] }) }}
|
||||||
with_items: "{{ (etc_hosts_content['content'] | b64decode).split('\n') }}"
|
with_items: "{{ (etc_hosts_content['content'] | b64decode).splitlines() }}"
|
||||||
when:
|
when:
|
||||||
- etc_hosts_content.content is defined
|
- etc_hosts_content.content is defined
|
||||||
- (item is match('^::1 .*') or item is match('^127.0.0.1 .*'))
|
- (item is match('^::1 .*') or item is match('^127.0.0.1 .*'))
|
||||||
|
|
Loading…
Reference in a new issue