From dbdf88fe3698864046c6b618c36e19354355ea26 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 20 Jun 2024 20:47:00 +0200 Subject: [PATCH] Set become_method in ansible.cfg --- ansible.cfg | 3 +++ roles/forgejo/tasks/main.yml | 3 --- roles/netbox/handlers/main.yml | 1 - roles/netbox/tasks/app.yml | 3 --- roles/postgres/tasks/main.yml | 3 --- 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/ansible.cfg b/ansible.cfg index c6e6e02..b9a76ef 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -2,3 +2,6 @@ nocows = true inventory = inventory.yml remote_user = root + +[privilege_escalation] +become_method = su diff --git a/roles/forgejo/tasks/main.yml b/roles/forgejo/tasks/main.yml index 3d4540c..269aca4 100644 --- a/roles/forgejo/tasks/main.yml +++ b/roles/forgejo/tasks/main.yml @@ -59,7 +59,6 @@ - name: Set up authentication become: yes - become_method: su become_user: forgejo block: - name: Get passwords @@ -136,14 +135,12 @@ block: - name: Get runner token become: yes - become_method: su become_user: forgejo command: forgejo actions generate-runner-token register: token - name: Register runner become: yes - become_method: su become_user: forgejo-runner become_flags: '-s /bin/sh -l' command: | diff --git a/roles/netbox/handlers/main.yml b/roles/netbox/handlers/main.yml index 3280c02..a7b1f19 100644 --- a/roles/netbox/handlers/main.yml +++ b/roles/netbox/handlers/main.yml @@ -20,7 +20,6 @@ - name: run migrations become: yes - become_method: su become_user: '{{ user }}' command: sh ~/app/upgrade.sh notify: restart netbox diff --git a/roles/netbox/tasks/app.yml b/roles/netbox/tasks/app.yml index 5ea5542..2a65094 100644 --- a/roles/netbox/tasks/app.yml +++ b/roles/netbox/tasks/app.yml @@ -12,7 +12,6 @@ - name: Checkout repo become: yes - become_method: su become_user: '{{ user }}' git: repo: https://github.com/netbox-community/netbox.git @@ -83,7 +82,6 @@ - name: Set additional requirements become: yes - become_method: su become_user: '{{ user }}' copy: dest: '{{ user_info.home }}/app/' @@ -94,7 +92,6 @@ - name: Create superuser become: yes - become_method: su become_user: '{{ user }}' command: cmd: '{{ user_info.home }}/app/venv/bin/python {{ user_info.home }}/app/netbox/manage.py shell --interface python' diff --git a/roles/postgres/tasks/main.yml b/roles/postgres/tasks/main.yml index 8c3854b..ced677a 100644 --- a/roles/postgres/tasks/main.yml +++ b/roles/postgres/tasks/main.yml @@ -13,7 +13,6 @@ - name: Check for existing database password become: yes become_user: '{{ user }}' - become_method: su slurp: path: '~/.pgpass' register: pgpass @@ -30,7 +29,6 @@ - name: Create .pgpass become: yes become_user: '{{ user }}' - become_method: su copy: dest: '~/.pgpass' content: | @@ -39,7 +37,6 @@ mode: 0600 - become: yes - become_method: su become_user: postgres block: - name: Create database