1 #!/usr/bin/env ansible-playbook
2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: Apache-2.0
6 - name: Load Arvados configuration
9 - name: Load Arvados configuration file
10 delegate_to: localhost
11 ansible.builtin.include_vars:
13 file: "{{ arvados_config_file }}"
14 - name: Load Arvados cluster configuration
15 ansible.builtin.set_fact:
16 arvados_cluster: "{{ arvados_config.Clusters[arvados_cluster_id] }}"
17 failed_when: arvados_cluster is undefined
18 - name: Get Crunch dispatch public key
19 when: arvados_cluster.Containers.DispatchPrivateKey is defined and arvados_cluster.Containers.DispatchPrivateKey is truthy
20 delegate_to: localhost
22 # Try to parse DispatchPrivateKey as a URL.
23 # If it's recognized as a file: URL, pass the path to `ssh-keygen -f`.
24 # Otherwise, expect it's private key content,
25 # and pass it through `ssh-keygen` stdin.
26 key_url: "{{ arvados_cluster.Containers.DispatchPrivateKey | urlsplit }}"
27 ansible.builtin.command:
28 argv: "{{ ['ssh-keygen', '-y'] + (['-f', key_url.path] if key_url.scheme == 'file' else []) }}"
29 stdin: "{{ arvados_cluster.Containers.DispatchPrivateKey if key_url.scheme != 'file' else '' }}"
30 register: compute_dispatch_ssh_keygen
32 - name: Build compute node
33 # `default` is the name that the Packer Ansible plugin assigns to the
34 # instance used to create the image.
38 - name: Bootstrap packages required for Ansible
39 ansible.builtin.raw: "apt-get -o DPkg::Lock::Timeout=300 -qy {{ item }}"
42 - install gnupg python3-apt python3-debian xz-utils
47 - name: Upgrade packages
51 - name: Remove unwanted packages
59 - ansible.builtin.include_role:
60 name: compute_encrypt_tmp
61 - ansible.builtin.include_role:
63 - ansible.builtin.include_role:
65 when: "arvados_cluster.Containers.RuntimeEngine == 'docker'"
66 - ansible.builtin.include_role:
70 ansible.builtin.lineinfile:
71 path: /etc/dhcp/dhclient.conf
72 regexp: "^[# ]*prepend +domain-name-servers "
73 line: "prepend domain-name-servers {{ dns_resolver }};"
74 when: dns_resolver is defined
78 ansible.builtin.debug:
79 msg: Skipping apt update handler before an apt upgrade