代码之家  ›  专栏  ›  技术社区  ›  Nespony

如何使用Ansible将项目克隆到GCE上?

  •  0
  • Nespony  · 技术社区  · 6 年前

    我有下面的剧本:

    ---
    - hosts: agent
      connection: local
      gather_facts: no
    
      tasks:
        - name: Launch gcp instance
          gce:
            instance_names: test-gcp-instance
            zone: us-central1-a
            machine_type: n1-standard-1
            image: ubuntu-1604
            state: present
            service_account_email: "mydetails@developer.gserviceaccount.com"
            credentials_file: "Kcreds.json"
            project_id: "kubernetes-test-project-v1"
    
    
        - name: Clone project to be run
          git:
            repo: https://github.com/projects.git
            dest: ~/
          become: no
    

    1 回复  |  直到 6 年前
        1
  •  0
  •   Digil    6 年前

    克隆GCP项目目前还不可能。也就是说,有一个现有的特性请求来实现这个功能。我建议你去参观 this 问题跟踪器链接,并提供您的宝贵建议在那里。可能的解决方法是

    1. persistent disk
    2. 创建新项目;
    3. 使用 image from the first project

    提供的链接是为GCP提供的,但是您可以找到Ansible的相应命令。