r/ansible•
gitnik

Git module always clones as root

I have a playbook that I execute as a root (become: yes), but for several tasks concerning my git repo, I use specific application user on my server (e.g. appuser). Despite using become: appuser on the git task, the files after cloning are still owner by root! Is this normal? Here is the task:

- name: Clone application repo
  git:
    repo: git@gitlab.com:example-group/example/example.com.git
    version: master
    dest: /home/application
    clone: yes
    update: no
    accept_hostkey: yes
    key_file: "/home/application/.ssh/id_rsa"
  become: appuser

Posted Jul 3, 2018, 9:32 AM UTC

411
Loading comments…