From d06aab167ef29b59d24e3ffb6579800f7fff2b1f Mon Sep 17 00:00:00 2001 From: Christoph Schug Date: Sun, 3 Mar 2024 17:25:42 +0100 Subject: [PATCH] fix: replace shell commands by Ansible modules --- ansible/installation/inst-microk8s.yaml | 7 +++++-- vagrant/hyperv/ubuntu/docker/playbook.yaml | 7 +++++-- vagrant/hyperv/ubuntu/microk8s-installed/playbook.yaml | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ansible/installation/inst-microk8s.yaml b/ansible/installation/inst-microk8s.yaml index 083acb4..c7c63c7 100644 --- a/ansible/installation/inst-microk8s.yaml +++ b/ansible/installation/inst-microk8s.yaml @@ -9,5 +9,8 @@ classic: true name: microk8s - - name: Add user permissions - ansible.builtin.shell: "usermod -aG microk8s {{ lookup('env', 'USER') }}" + - name: Add user to group microk8s + ansible.builtin.user: + name: "{{ lookup('env', 'USER') }}" + groups: microk8s + append: true diff --git a/vagrant/hyperv/ubuntu/docker/playbook.yaml b/vagrant/hyperv/ubuntu/docker/playbook.yaml index 25cbefc..44e513e 100644 --- a/vagrant/hyperv/ubuntu/docker/playbook.yaml +++ b/vagrant/hyperv/ubuntu/docker/playbook.yaml @@ -31,5 +31,8 @@ - docker-compose update_cache: true - - name: Add user permissions - ansible.builtin.shell: "usermod -aG docker vagrant" + - name: Add user vagrant to group docker + ansible.builtin.user: + name: vagrant + groups: docker + append: true diff --git a/vagrant/hyperv/ubuntu/microk8s-installed/playbook.yaml b/vagrant/hyperv/ubuntu/microk8s-installed/playbook.yaml index 99a2927..980075a 100644 --- a/vagrant/hyperv/ubuntu/microk8s-installed/playbook.yaml +++ b/vagrant/hyperv/ubuntu/microk8s-installed/playbook.yaml @@ -9,5 +9,8 @@ classic: true name: microk8s - - name: Add user permissions - ansible.builtin.shell: "usermod -aG microk8s vagrant" + - name: Add user vagrant to group microk8s + ansible.builtin.user: + name: vagrant + groups: microk8s + append: true