Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

alg-2_git_clone.yaml

  • 脚本内容
    - hosts: prod
      vars:
        gitkey_path: /home/ubuntu/.ssh/gitkey
        project_path: /home/ubuntu/qin-server
      tasks:
        - name: Create project directory
          file:
            path: "{{ project_path }}"
            recurse: yes
            state: directory
        - name: Clone Git repository
          git:
            repo: git@e.coding.net:mangofuture/qin-server.git
            dest: "{{ project_path }}"
            key_file: "{{ gitkey_path }}"
            accept_hostkey: yes
            force: yes
            version: product_alg
          ignore_errors: yes
        - name: add key to git pull command
          command:
            chdir: "{{ project_path }}"
            cmd: "git config core.sshCommand 'ssh -i {{ gitkey_path }}'"