diff --git a/tasks/assert.yml b/tasks/assert.yml index 3034ce6..f20edb1 100644 --- a/tasks/assert.yml +++ b/tasks/assert.yml @@ -5,7 +5,7 @@ that: - bootstrap_wait_for_host is defined - bootstrap_wait_for_host is boolean - quiet: yes + quiet: true - name: assert | Test bootstrap_timeout ansible.builtin.assert: @@ -13,11 +13,11 @@ - bootstrap_timeout is defined - bootstrap_timeout is number - bootstrap_timeout >= 0 - quiet: yes + quiet: true - name: assert | Test bootstrap_become ansible.builtin.assert: that: - bootstrap_become is defined - bootstrap_become is boolean - quiet: yes + quiet: true diff --git a/tasks/gather_facts.yml b/tasks/gather_facts.yml index ad0aa6c..1c47dd6 100644 --- a/tasks/gather_facts.yml +++ b/tasks/gather_facts.yml @@ -2,10 +2,10 @@ - name: gather_facts | Lookup bootstrap facts ansible.builtin.raw: "cat /etc/os-release" - become: no - check_mode: no + become: false + check_mode: false register: bootstrap_facts - changed_when: no + changed_when: false - name: gather_facts | Set bootstrap facts (I) ansible.builtin.set_fact: @@ -16,7 +16,7 @@ - bootstrap_facts.rc == 0 - bootstrap_distribution is not defined - bootstrap_facts.stdout is regex('PRETTY_NAME=.'~ bootstrap_search[item] | default(item) ~'.*') - become: no + become: false - name: gather_facts | Set bootstrap facts (II) ansible.builtin.set_fact: @@ -26,4 +26,4 @@ label: "{{ item.key }}" when: - bootstrap_distribution in item.value - become: no + become: false diff --git a/tasks/main.yml b/tasks/main.yml index efcb3e1..be1b275 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,14 +4,14 @@ - name: Import assert.yml ansible.builtin.import_tasks: file: assert.yml - run_once: yes + run_once: true delegate_to: localhost - name: Wait for port to be available ansible.builtin.wait_for: port: "{{ ansible_port | default('22') }}" timeout: "{{ bootstrap_timeout }}" - become: no + become: false when: - ansible_connection is defined - ansible_connection not in [ "container", "docker", "community.docker.docker" ] @@ -20,17 +20,18 @@ - name: Prepare system # At this stage, python and/or sudo are not installed, `become` can't be used. - become: no + # This means this role has to run as root, can't switch user. + become: false block: - name: Test connection ansible.builtin.wait_for_connection: timeout: "{{ bootstrap_timeout }}" register: bootstrap_connect - changed_when: no + changed_when: false - name: Test sudo ansible.builtin.command: cmd: sudo --version - changed_when: no + changed_when: false rescue: - name: Gather bootstrap facts ansible.builtin.include_tasks: @@ -49,11 +50,12 @@ - name: Gather ansible facts ansible.builtin.setup: - become: no + become: false - name: Install bootstrap packages (package) ansible.builtin.package: name: "{{ item }}" state: present + update_cache: true loop: "{{ bootstrap_facts_packages.split() }}" become: "{{ bootstrap_become }}"