Friday, August 31, 2018

Ansible become_user for a block of commands

use a block to apply a become_user to a block of commands
- block:
    - name: checkout repo
      git:
        repo: https://github.com/some/repo.git
        version: master
        dest: "{{ dst }}"
    - name: change perms
      file:
      dest: "{{ dst }}"
      state: directory
      mode: 0755
      owner: some_user
  become: yes
  become_user: some user

No comments:

Post a Comment