0

Is there a way to create a customized ansible module that "wraps" an existing one?

I often write this:

- name: foo
  become: true
  copy:
    src: foo/bar/baz
    dest: spam/ham/eggs
    owner: "root"
    group: "root"
    mode: "0644"

So I want to eliminate the boilerplate:

- name: foo
  copyroot644:             # wraps `copy` module
    src: foo/bar/baz
    dest: spam/ham/eggs

Is there an easy way to do this, without getting knee-deep in Python? (I don't want to reinvent the wheel, just reuse the copy module.)

lonix
  • 14,255
  • 23
  • 85
  • 176

1 Answers1

1

Ansible modules are written in Python. I don't think there is any other alternative.

Sriram
  • 626
  • 7
  • 11