Use include/import tasks (#2192)

import_tasks will consume far less memory, so it should be
used whenever it is compatible.
This commit is contained in:
Matthew Mosesohn
2018-01-29 14:37:48 +03:00
committed by GitHub
parent f4180503c8
commit dc6a17e092
43 changed files with 117 additions and 117 deletions

View File

@@ -7,7 +7,7 @@
- reload etcd
- wait for etcd up
- include: backup.yml
- import_tasks: backup.yml
- name: etcd | reload systemd
command: systemctl daemon-reload

View File

@@ -30,7 +30,7 @@
notify: restart etcd
- name: Configure | Join member(s) to cluster one at a time
include: join_member.yml
include_tasks: join_member.yml
vars:
target_node: "{{ item }}"
loop_control:

View File

@@ -1,16 +1,16 @@
---
- include: sync_etcd_master_certs.yml
- include_tasks: sync_etcd_master_certs.yml
when: inventory_hostname in groups.etcd
tags:
- etcd-secrets
- include: sync_etcd_node_certs.yml
- include_tasks: sync_etcd_node_certs.yml
when: inventory_hostname in etcd_node_cert_hosts
tags:
- etcd-secrets
# Issue master certs to Etcd nodes
- include: ../../vault/tasks/shared/issue_cert.yml
- include_tasks: ../../vault/tasks/shared/issue_cert.yml
vars:
issue_cert_common_name: "etcd:master:{{ item.rsplit('/', 1)[1].rsplit('.', 1)[0] }}"
issue_cert_alt_names: "{{ groups['etcd'] + ['localhost'] + (etcd_cert_alt_names)|default() }}"
@@ -37,7 +37,7 @@
notify: set etcd_secret_changed
# Issue node certs to everyone else
- include: ../../vault/tasks/shared/issue_cert.yml
- include_tasks: ../../vault/tasks/shared/issue_cert.yml
vars:
issue_cert_common_name: "etcd:node:{{ item.rsplit('/', 1)[1].rsplit('.', 1)[0] }}"
issue_cert_alt_names: "{{ etcd_node_cert_hosts }}"

View File

@@ -10,7 +10,7 @@
ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem"
ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}-key.pem"
- include: refresh_config.yml
- include_tasks: refresh_config.yml
vars:
etcd_peer_addresses: >-
{% for host in groups['etcd'] -%}

View File

@@ -1,15 +1,15 @@
---
- include: check_certs.yml
- include_tasks: check_certs.yml
when: cert_management == "script"
tags:
- etcd-secrets
- facts
- include: "gen_certs_{{ cert_management }}.yml"
- include_tasks: "gen_certs_{{ cert_management }}.yml"
tags:
- etcd-secrets
- include: upd_ca_trust.yml
- include_tasks: upd_ca_trust.yml
tags:
- etcd-secrets
@@ -24,18 +24,18 @@
etcd_client_cert_serial: "{{ etcd_client_cert_serial_result.stdout }}"
when: inventory_hostname in groups['k8s-cluster']|union(groups['etcd'])|union(groups['calico-rr']|default([]))|unique|sort
- include: "install_{{ etcd_deployment_type }}.yml"
- include_tasks: "install_{{ etcd_deployment_type }}.yml"
when: is_etcd_master
tags:
- upgrade
- include: set_cluster_health.yml
- import_tasks: set_cluster_health.yml
when: is_etcd_master and etcd_cluster_setup
- include: configure.yml
- import_tasks: configure.yml
when: is_etcd_master and etcd_cluster_setup
- include: refresh_config.yml
- import_tasks: refresh_config.yml
when: is_etcd_master and etcd_cluster_setup
- name: Restart etcd if certs changed
@@ -56,8 +56,8 @@
# After etcd cluster is assembled, make sure that
# initial state of the cluster is in `existing`
# state insted of `new`.
- include: set_cluster_health.yml
- import_tasks: set_cluster_health.yml
when: is_etcd_master and etcd_cluster_setup
- include: refresh_config.yml
- import_tasks: refresh_config.yml
when: is_etcd_master and etcd_cluster_setup

View File

@@ -8,7 +8,7 @@
"member-" + inventory_hostname + ".pem"
] }}
- include: ../../vault/tasks/shared/sync_file.yml
- include_tasks: ../../vault/tasks/shared/sync_file.yml
vars:
sync_file: "{{ item }}"
sync_file_dir: "{{ etcd_cert_dir }}"
@@ -26,7 +26,7 @@
set_fact:
sync_file_results: []
- include: ../../vault/tasks/shared/sync_file.yml
- include_tasks: ../../vault/tasks/shared/sync_file.yml
vars:
sync_file: ca.pem
sync_file_dir: "{{ etcd_cert_dir }}"

View File

@@ -4,7 +4,7 @@
set_fact:
etcd_node_cert_list: "{{ etcd_node_cert_list|default([]) + ['node-' + inventory_hostname + '.pem'] }}"
- include: ../../vault/tasks/shared/sync_file.yml
- include_tasks: ../../vault/tasks/shared/sync_file.yml
vars:
sync_file: "{{ item }}"
sync_file_dir: "{{ etcd_cert_dir }}"
@@ -22,7 +22,7 @@
set_fact:
sync_file_results: []
- include: ../../vault/tasks/shared/sync_file.yml
- include_tasks: ../../vault/tasks/shared/sync_file.yml
vars:
sync_file: ca.pem
sync_file_dir: "{{ etcd_cert_dir }}"