Clone文件至apache主目录

下一步我们将从一个Github Repo中clone静态页面的代码,并把它们放在apache主目录下。

所以,此时我们的playbook(setup_static_page.yml)将变成这样:

---
- hosts: static_page

  vars:
    packages:
      - git
      - apache2

  tasks:
    - name: Apt update
      sudo: yes
      run_once: true
      apt:
        update_cache: yes

    - name: Ensure packages installed
      sudo: yes
      apt:
        name: "{{ item }}"
        state: present
      with_items: "{{ packages }}"

    - name: Git clone remote static page repo
      git:
        repo=https://github.com/Yaowenjie/static_page.git
        dest=/var/www/html/static_page
        update=yes

执行playbook:

ansible-playbook -i hosts setup_static_page.yml

results matching ""

    No results matching ""