--- # tasks file for bootstrap - name: Import assert.yml ansible.builtin.import_tasks: assert.yml run_once: yes delegate_to: localhost - name: Wait for port to be available ansible.builtin.wait_for: port: "{{ ansible_port | default('22') }}" timeout: "{{ bootstrap_timeout }}" become: no when: - ansible_connection is defined - ansible_connection not in [ "container", "docker", "community.docker.docker" ] - bootstrap_wait_for_host | bool - name: Prepare system # At this stage, python and/or sudo are not installed, `become` can't be used. become: no block: - name: Test connection ansible.builtin.wait_for_connection: timeout: "{{ bootstrap_timeout }}" register: bootstrap_connect changed_when: no - name: Test sudo ansible.builtin.command: cmd: sudo --version changed_when: no rescue: - name: Gather bootstrap facts ansible.builtin.include_tasks: file: gather_facts.yml - name: Install bootstrap packages (raw) ansible.builtin.raw: "{{ bootstrap_install.raw }}" register: bootstrap_install_packages changed_when: - (bootstrap_install.stdout_regex in bootstrap_install_packages.stdout and bootstrap_os_family in [ "Alpine", "Archlinux", "Gentoo" ]) or (bootstrap_install.stdout_regex not in bootstrap_install_packages.stdout and bootstrap_os_family in [ "Debian", "RedHat", "Rocky", "Suse" ]) - name: Gather ansible facts ansible.builtin.setup: become: no - name: Install bootstrap packages (package) ansible.builtin.package: name: "{{ item }}" state: present loop: "{{ bootstrap_facts_packages.split() }}" become: "{{ bootstrap_become }}"