-
-
Notifications
You must be signed in to change notification settings - Fork 58
/
main.yml
52 lines (45 loc) · 1.56 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
# 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
block:
- name: test connection
ansible.builtin.wait_for_connection:
timeout: "{{ bootstrap_timeout }}"
register: bootstrap_connect
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" ])
become: no
- name: ensure system is prepared
block:
- name: gather ansible facts
ansible.builtin.setup:
- name: install bootstrap packages (package)
ansible.builtin.package:
name: "{{ item }}"
state: present
loop: "{{ bootstrap_facts_packages.split() }}"
become: no