• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to download a file from FTP on Windows by using Ansible playbook

  • 01:19 lsb_release -a
  • 01:28 apt list -a ansible
  • 01:47 apt list -a python3
  • 02:05 pip list | grep pywinrm
  • 02:33 vi /etc/ansible/hosts
  • 03:41 vi test.yml
  • 06:58 ansible-playbook test.yml --syntax-check
  • 07:02 ansible-playbook test.yml
{{postValue.id}}

To Download a File From Ftp on Windows by using Ansible playbook

Introduction:

Ansible is an automatic configuration tool used in wide range of systems and devices such as databases, storage devices, networks, firewalls. win_package is the module which is used for manages Windows packages.

Master Server Requirements:

ansible

python3-pip

pywinrm (python package)

Windows Requirements:

powershell 3+

Dot net 4

Step 1: Application already present in the system Snaps 1

Step 2: Checking the OS version by using following command

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.04
Release:	21.04
Codename:	hirsute

Step 3: Checking the availability of Ansible package

root@linuxhelp:~# apt list -a ansible
Listing... Done
ansible/hirsute,hirsute,now 4.8.0-1ppa~hirsute all [installed]
ansible/hirsute,hirsute 2.10.7-1 all

Step 4: Checking the availability of python3-pip package

root@linuxhelp:~# apt list -a python3
Listing... Done
python3/hirsute,now 3.9.4-1 amd64 [installed,automatic]
python3/hirsute 3.9.4-1 i386

Step 5: Checking the availability of python package pywinrm

root@linuxhelp:~# pip list | grep pywinrm
pywinrm                0.4.2

Step 6: Creating inventory for Windows node system

root@linuxhelp:~# vi /etc/ansible/hosts 


[windows]
192.168.2.134

[windows:vars]
ansible_user=Admin
ansible_password=Admin@123
ansible_port=5986
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore

Step 7: Creating playbook for Downloading an Application from ftp and installing

root@linuxhelp:~# vi test.yml
- hosts: windows
  gather_facts: true
  tasks:
  - name: copy file
    win_get_url:
         url: ftp://ftpadmin@192.168.7.150/ZoomInstaller.exe
         url_username: ftpadmin
         url_password: <password of ftp account>
         dest: D:\Apps
  - name: Install Zoom
    win_package:
         path: D:\Apps\ZoomInstaller.exe
         state: present

Step 8: Checking the syntax of the test.yml ansible playbook by using following command

root@linuxhelp:~# ansible-playbook test.yml --syntax-check

playbook: test.yml



Step 9:  Running the test.yml playbook by using the following command
root@linuxhelp:~# ansible-playbook test.yml 

PLAY [windows] *******************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************
ok: [192.168.2.134]

TASK [copy file] *****************************************************************************************************
changed: [192.168.2.134]

TASK [Install Zoom] **************************************************************************************************
changed: [192.168.2.134]

PLAY RECAP ***********************************************************************************************************
192.168.2.134              : ok=3    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 

Step 10: Zoom Application Downloaded from ftp is installed Snaps 2

with this process of downloading a file from FTP using Ansible Comes to end

Tags:
markdjokovic
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Which ansible module is used to download any file from the internet?

A

win_get_url is the module is used to download any file from the internet.

Q

What module is used to install and uninstall the windows application?

A

win_package module is used to install and uninstall the windows application.

Q

What is Ansible configuration?

A

Ansible is pull-type configuration management tool, whose main purpose is to automate storage and networking and the tasks also become less vulnerable.

Q

Ansible is written in which programming language?

A

Ansible is written in Python programming language.

Q

Does Ansible configure cloud machine?

A

Ansible can automate everything from code deployment to network configuration to cloud management and by using it one can also provide virtual machines.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help keel johnston ?
Unhide the folders on windows Explorer

Give any solutions to unhide folder using command prompt?

forum3

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.