From 81053a3795b6c631c6d470d1c006917914506d72 Mon Sep 17 00:00:00 2001 From: Romain Pelisse Date: Thu, 19 Oct 2023 17:58:35 +0200 Subject: [PATCH] lint: add missing become stmt --- cci_worker.yml | 1 + roles/cci_worker/tasks/main.yml | 3 +++ roles/payload_status/tasks/deploy_website.yml | 1 + roles/payload_status/tasks/main.yml | 3 ++- roles/podman/tasks/images.yml | 6 ++++-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cci_worker.yml b/cci_worker.yml index 05645782..47376e65 100644 --- a/cci_worker.yml +++ b/cci_worker.yml @@ -38,6 +38,7 @@ - name: "Ensure jaegertracing docker image is downloaded for tests" containers.podman.podman_image: name: "quay.io/jaegertracing/all-in-one:latest" + become: yes become_user: "{{cci_worker_username}}" tasks: diff --git a/roles/cci_worker/tasks/main.yml b/roles/cci_worker/tasks/main.yml index 2cfd45b8..c16ba428 100644 --- a/roles/cci_worker/tasks/main.yml +++ b/roles/cci_worker/tasks/main.yml @@ -67,6 +67,7 @@ enabled: yes - name: Set environment variables + become: yes become_user: "{{ cci_worker_username }}" ansible.builtin.template: src: templates/bashrc_template.j2 @@ -75,10 +76,12 @@ owner: "{{ cci_worker_username }}" - name: "Enable Linger for {{ cci_worker_username }}" + become: yes become_user: "{{ cci_worker_username }}" ansible.builtin.shell: loginctl enable-linger {{ cci_worker_username }} - name: Enable podman + become: yes become_user: "{{ cci_worker_username }}" ansible.builtin.systemd: name: "podman.socket" diff --git a/roles/payload_status/tasks/deploy_website.yml b/roles/payload_status/tasks/deploy_website.yml index 9997707a..ab61614b 100644 --- a/roles/payload_status/tasks/deploy_website.yml +++ b/roles/payload_status/tasks/deploy_website.yml @@ -10,6 +10,7 @@ state: started detach: no command: "./build.sh" + become: yes become_user: "{{ payload_status.owner }}" - ansible.builtin.set_fact: diff --git a/roles/payload_status/tasks/main.yml b/roles/payload_status/tasks/main.yml index 716429e3..6d028885 100644 --- a/roles/payload_status/tasks/main.yml +++ b/roles/payload_status/tasks/main.yml @@ -13,7 +13,7 @@ - ansible.builtin.stat: path: "{{ ares.home }}" register: ares_home - + - ansible.builtin.assert: that: - ares_home is defined @@ -78,6 +78,7 @@ # the next steps depend on outcome of this run - keep container attached until build is done detach: no command: "./build.sh" + become: yes become_user: "{{ payload_status.owner }}" when: - git_results.changed or payload_env.changed diff --git a/roles/podman/tasks/images.yml b/roles/podman/tasks/images.yml index cb9c174b..f748d993 100644 --- a/roles/podman/tasks/images.yml +++ b/roles/podman/tasks/images.yml @@ -1,6 +1,6 @@ --- - ansible.builtin.assert: - that: + that: - podman_images_home is defined quiet: True fail_msg: "Required parameters podman_images_home is not defined." @@ -16,7 +16,7 @@ - podman_images_home_info.stat.exists is defined - podman_images_home_info.stat.exists - podman_images_home_info.stat.isdir is defined - - podman_images_home_info.stat.isdir + - podman_images_home_info.stat.isdir quiet: True fail_msg: "Invalid podman_images_home_info provided: {{ podman_images_home_info.stat.isdir }}." @@ -26,6 +26,7 @@ - name: "Ensure remote images are downloaded" containers.podman.podman_image: name: "{{ files.name }}" + become: yes become_user: "{{ files.owner | default('root') }}" with_items: "{{ podman.images.remotes }}" loop_control: @@ -36,6 +37,7 @@ name: "{{ files.tag }}" path: "{{ podman_images_home }}/{{ files.name }}" state: build + become: yes become_user: "{{ files.owner | default('root') }}" with_items: "{{ podman.images.locals }}" loop_control: