Di salah satu playbook yang saya gunakan sebut saja tes_benchmark.yml

---
- hosts: all
  gather_facts: no
  tasks:
  - name: Install packages
    yum: name:{{ item }} state:present update_cache:yes
    with_items:
      - wget
      - nc
      - curl

  - name: Download script benchmark-api.sh
    get_url: url=http://127.0.0.1/benchmark-api.sh dest=/tmp/benchmark-api.sh

  - name: Jalankan script benchmark-api.sh
    shell: bash /tmp/benchmark-api.sh

  - name: Hapus script benchmark-api.sh
    file:
      state: absent
      path: /tmp/benchmark-api.sh

di ansible 2.11 ke bawah playbook diatas tidak ada masalah, tetapi mulai versi 2.11 fungsi tersebut telah deprecated (kadaluarsa). Solusinya ubah menjadi

---
- hosts: all
  gather_facts: no
  tasks:
  - name: Install a list of packages
    yum:
      name:
        - wget
        - nc
        - curl
      state: present
      update_cache: yes

  - name: Download script benchmark-api.sh
    get_url: url=http://127.0.0.1/benchmark-api.sh dest=/tmp/benchmark-api.sh

  - name: Jalankan script benchmark-api.sh
    shell: bash /tmp/benchmark-api.sh

  - name: Hapus script benchmark-api.sh
    file:
      state: absent
      path: /tmp/benchmark-api.sh

Leave a comment

Your email address will not be published. Required fields are marked *