check git is installed

 ---

- name: cecking git

  hosts: web2

  tasks:

    - shell: dpkg -i git

      register: check_if_git_installed

      ignore_errors: yes

    - debug: var=check_if_git_installed

    - shell: echo 'Oops, git is missing' > /tmp/is_git_installed.txt

      when: check_if_git_installed.rc != 0


    - shell: git --version > /tmp/is_git_installed.txt

      when: check_if_git_installed.rc == 0

~                                             

Comments

Popular posts from this blog

exam 16

ansible 5

practical 3