IT/Cloud & DevOps
Ansible playbook : 프로그램 설치 (file)
Hotman
2020. 5. 6. 18:54
Windows 와 Ubuntu 클라이언트에 Chrome 최신 버전 설치 예제
(apt나 win_package 등 기본적인 패키지 설치 기능이 상황에 맞게 구동되지 않는 경우가 많음...)
---
- name: Chrome Install
hosts: all
user: ansible
become: yes
#gather_facts: no
tasks:
- name: create directory Windows
win_file:
path: C:\Temp
state: directory
when: ansible_facts['os_family'] == "Windows"
- name: Chrome setup file copy (Windows)
win_copy:
src: /home/ansible/lab/ChromeSetup.exe
dest: C:\Temp\ChromeSetup.exe
when: ansible_facts['os_family'] == "Windows"
- name: Chrome setup file copy (Linux)
copy:
src: /home/ansible/lab/google-chrome-stable_current_amd64.deb
dest: /tmp/google-chrome-stable_current_amd64.deb
when: ansible_facts['os_family'] != "Windows"
- name: Install Chrome (Windows)
win_shell:
Start-Process -FilePath "C:\Temp\ChromeSetup.exe" -ArgumentList "/S /v/qn"
when: ansible_facts['os_family'] == "Windows"
- name: Install Chrome (Linux)
become: true
shell:
dpkg -i /tmp/google-chrome-stable_current_amd64.deb
when: ansible_facts['os_family'] != "Windows"
- name: Delete file (Windows)
win_file:
path: C:\Temp\ChromeSetup.exe
state: absent
when: ansible_facts['os_family'] == "Windows"
- name: Delete File (Linux)
file:
path: /tmp/google-chrome-stable_current_amd64.deb
state: absent
when: ansible_facts['os_family'] != "Windows"