Playbook #1

/root/kubeinit/ci/builds/6mbKNrxD/0/kubeinit/kubeinit/kubeinit-aux/kubeinit/playbook.yml

Report Status CLI Date Duration Controller User Versions Hosts Plays Tasks Results Files Records
26 Oct 2023 19:36:23 +0000 00:45:02.10 nyctea root Ansible 2.15.2 ara 1.6.1 (client), 1.6.1 (server) Python 3.11.4 8 9 1048 1048 53 1

File: /root/.ansible/collections/ansible_collections/kubeinit/kubeinit/roles/kubeinit_prepare/tasks/create_host_ssh_config.yml

---
# Copyright kubeinit contributors
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

### DOCUMENTATION
#
# title: Create an ssh config file for a list of hosts
#
# description: |-
#   This task has two params for the template task below
#     - config_path      optional       default: '~/.ssh/config'
#     - file_mode        optional       default: '0644'
#
#   and two passthrough params for the template itself
#     - ssh_hosts        required       list of hosts
#     - ssh_keytype      optional       default: 'rsa'
#     - keypair_path     optional       default: '~/.ssh/id_' + ssh_keytype
#     - include_paths    optional       default: empty list
#
#   The hosts are used as hostvars keys meeting the following expectations:
#
#   hostvars[host].ansible_host must be defined.
#
#   A stanza will be added to the ssh config pairing each host with the
#   corresponding ansible_host
#
#   hostvars[host].ssh_connection_address may be defined
#   hostvars[host].ssh_hostname may be defined
#
#   A stanza will be added to the ssh config pairing each ansible_host with either of
#   these, in the order listed. If neither is defined then the pairing will be omitted.
#
# examples: |-
#   - include_role:
#       name: kubeinit.kubeinit.kubeinit_prepare
#       tasks_from: create_host_ssh_config
#     vars:
#       ssh_hosts: "{{ groups['kubeinit_hypervisors'] }}"
#       keypair_path: "{{ kubeinit_cluster_keypair_path }}"
#       config_path: "{{ kubeinit_cluster_ssh_config }}"
#       file_mode: '0644'

- name: Create ssh config file from template
  ansible.builtin.template:
    src: ssh-config.j2
    dest: "{{ _param_dest_path | default('~/.ssh/config') }}"
    mode: "{{ _param_file_mode | default('0644') }}"

- name: Print the contents of the result
  ansible.builtin.command: cat {{ _param_dest_path | default('~/.ssh/config') }}
  register: _result
  changed_when: "_result.rc == 0"