- name: Install oh-my-zsh
shell: wget -qO - https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | bash -
veya
- name: Install nodesource repo
shell: curl -sL https://deb.nodesource.com/setup_5.x | bash -
- name: Install oh-my-zsh
shell: wget -qO - https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | bash -
veya
- name: Install nodesource repo
shell: curl -sL https://deb.nodesource.com/setup_5.x | bash -
Bu benim için çalıştı:
- name: Download zsh installer
get_url: url=https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh dest=/tmp/zsh-installer.sh
- name: Execute the zsh-installer.sh
shell: /tmp/zsh-installer.sh
bu temel örnek y yardımcı olabilir olabilir ou başlatmak için: Çalıştırmak istediğiniz dosya/script size oynat/rol yürütmek makinede olmalıdır çünkü
---
- name: Installing Zsh and git
apt: pkg=zsh,git state=latest
register: installation
- name: Backing up existing ~/.zshrc
shell: if [ -f ~/.zshrc ]; then mv ~/.zshrc{,.orig}; fi
when: installation|success
sudo: no
- name: Cloning oh-my-zsh
git:
repo=https://github.com/robbyrussell/oh-my-zsh
dest=~/.oh-my-zsh
when: installation|success
register: cloning
sudo: no
- name: Creating new ~/.zshrc
copy:
src=~/.oh-my-zsh/templates/zshrc.zsh-template
dest=~/.zshrc
when: cloning|success
sudo: no
@RaviTezu çözüm çalışmaz. dokümantasyon here
yolda yerel komut uzak düğüme aktarılır ve daha sonra idam edilecektir gereğince
.
- name: execute the script.sh script: /local/path/to/script.sh
Yoksa bunu yapabilirsiniz:
- name: download setup_5.x file to tmp dir get_url: url: https://deb.nodesource.com/setup_5.x dest: /tmp/ mode: 0755 - name: execute setup_5.x script shell: setup_5.x args: chdir: /tmp/
Ben giderdim
Yani tek yönlü yerel olarak dosya indirme ve bir görev kullanarak aşağıdaki gibi gereğidir yapmak ilk yöntem kendi senaryonuzu yüklüyorsanız, ikinci yöntem sizin durumunuzda daha faydalıdır çünkü komut dosyası zaman içinde güncellenebilir, böylece her çalıştırdığınız zaman en son komut dosyasını kullandığınızdan eminsiniz.
Not: Her zaman eski kodu geçersiz kılan komut dosyasını indirecek olan "force = yes". Ayrıca, durumunuza göre hassaslaştırabileceğiniz "changed_when" öğesini de unutmayın. Benim için
- name: 'Download {{ helm.install_script_url }}'
environment:
http_proxy: '{{proxy_env.http_proxy | default ("") }}'
https_proxy: '{{proxy_env.https_proxy | default ("") }}'
no_proxy: '{{proxy_env.no_proxy | default ("") }}'
get_url: url={{ helm.install_script_url | default ("") }} dest=/tmp/helm_install_script force=yes mode="0755"
when: helm.install_script_url is defined
tags:
- helm_x
- name: Run {{ helm.install_script_url }}
environment:
http_proxy: '{{proxy_env.http_proxy | default ("") }}'
https_proxy: '{{proxy_env.https_proxy | default ("") }}'
no_proxy: '{{proxy_env.no_proxy | default ("") }}'
command: "/tmp/helm_install_script"
register: command_result
changed_when: "'is up-to-date' not in command_result.stdout"
when: helm.install_script_url is defined
args:
chdir: /tmp/
tags:
- helm_x
aşağıdaki deyimi çalıştı:
- name: "Execute Script"
shell: curl -sL https://rpm.nodesource.com/setup_6.x | bash -
Soru, bunun nasıl önleneceğiydi ve Kabuk değil, Ansible native modülleri kullanıldı. –
Bu doğru, teşekkürler. –
Ben bunun doğru yoldur sayesinde düşünür;) – Oliboy50
'senaryo' modülü hedef ana bilgisayara yerel komut dosyası aktarır, ardından yürütür. 'Get_url', hedef ana bilgisayara indirir. Bu nedenle 'komut' yerine 'kabuk' veya 'komut' gerekir. –