I am new to ansible modules / playbooks and I simply can not get the archive module to work

19 views
Skip to first unread message

David Brendlinger

unread,
Mar 3, 2017, 10:10:50 PM3/3/17
to Ansible Project

I just want to make a very simple playbook  using the archive module: 



I tried many things including:
---
  - hosts: all
    tasks:
    - name: Archive
- archive:
    path: /path/to/foo
    dest: /path/to/foo.tgz

Can someone show me how to archive a file in a playbook ? 
Is there a better place for newbies to post this level of question?

Kai Stian Olstad

unread,
Mar 4, 2017, 4:18:58 AM3/4/17
to ansible...@googlegroups.com
On 04. mars 2017 04:10, David Brendlinger wrote:
>
> I just want to make a very simple playbook using the archive module:
>
> http://docs.ansible.com/ansible/archive_module.html

If you look at the top of this site you will see it says
"New in version 2.3.", Ansible 2.3 is not released yet.


> I tried many things including:
> ---
> - hosts: all
> tasks:
> - name: Archive
>
> - archive:
> path: /path/to/foo
> dest: /path/to/foo.tgz
>
>
> Can someone show me how to archive a file in a playbook ?

When posting problems we appreciate the error messages as well, this
makes it much easier to help.
I'm guessing you are using Ansible 2.2 that do not include this module.

You YAML syntax is also wrong, in YAML indentation(spaces) is very
important and need to be consistent.
Take a look at this page and you will see how playbook is written
https://docs.ansible.com/ansible/playbooks_intro.html

If you have 2.3 the correct playbook should look like this (indentation
2 spaces)

---
- hosts: all
tasks:
- name: Archive
archive:
path: /path/to/foo
dest: /path/to/foo.tgz


>
> Is there a better place for newbies to post this level of question?

No, this is the correct place. Welcome to the community.

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages