-1

Can someone please post a example on how to use a predefined Ansible module, in example git module in a Custom Module?

I was trying to convert the below tasks into a single Custom Module

- name: Clone repo on Remote Hosts
  git:
    repo: "{{ git_repo_src }}"
    dest: "{{ git_repo_dest }}"

- name: Fetch template from single Remote Host
  run_once: true
  fetch:
    src: "{{ template_path }}/{{ template_file }}"
    dest: "/tmp/{{ templalte_file }}"
    flat: yes
    fail_on_missing: yes

- name: Template Remote Hosts
  template:
    src: "/tmp/{{ template_file }}"
    dest: "{{ templated_file_dest }}"
    owner: "{{ templated_file_owner }}"
    group: "{{ templated_file_group }}"
    mode: "{{ templated_file_mode }}"
U880D
  • 8,601
  • 6
  • 24
  • 40

1 Answers1

0

the below tasks into a single custom module

So, what I'm hearing is that you'd like to orchestrate several built-in ansible actions, sometimes conditionally, or with looping, perhaps with some variables and with notifications, and maybe even the ability to store all that in a separate git repo, for easy inclusion/composition?

That does sound familiar

mdaniel
  • 31,240
  • 5
  • 55
  • 58