ansible add a file to zip
[root@controller home]# cat createzip.yml
---
- hosts: localhost
become: true
tasks:
- name: Ansible zip file example
archive:
path: /home/kiran/kiran.txt
dest: /home/kiran/kiran.zip
format: zip
[root@controller home]# ansible-playbook createzip.yml
PLAY [all] *******************************************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************************************
ok: [localhost]
TASK [Ansible zip file example] **********************************************************************************************************************
changed: [localhost]
PLAY RECAP *******************************************************************************************************************************************
192.168.0.107 : ok=2 changed=1 unreachable=0 failed=0
[root@controller home]# cd kiran/
[root@controller kiran]# ls -ltr
total 4
-rw-r--r-- 1 root root 0 Oct 18 14:42 kiran.txt
drwxrwxr-x 2 kiran kiran 6 Oct 18 14:47 kiran
-rw-r--r-- 1 root root 118 Oct 18 15:17 kiran.zip
---
- hosts: localhost
become: true
tasks:
- name: Ansible zip file example
archive:
path: /home/kiran/kiran.txt
dest: /home/kiran/kiran.zip
format: zip
[root@controller home]# ansible-playbook createzip.yml
PLAY [all] *******************************************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************************************
ok: [localhost]
TASK [Ansible zip file example] **********************************************************************************************************************
changed: [localhost]
PLAY RECAP *******************************************************************************************************************************************
192.168.0.107 : ok=2 changed=1 unreachable=0 failed=0
[root@controller home]# cd kiran/
[root@controller kiran]# ls -ltr
total 4
-rw-r--r-- 1 root root 0 Oct 18 14:42 kiran.txt
drwxrwxr-x 2 kiran kiran 6 Oct 18 14:47 kiran
-rw-r--r-- 1 root root 118 Oct 18 15:17 kiran.zip
Comments
Post a Comment