From 40ebe3a021885477870d3ff863213862c95037e8 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 10 Feb 2022 14:27:54 -0500 Subject: [PATCH] add file-creation-single.yml --- file-creation-single.yml | 36 ++++++++++++++++++++++++++++++++++++ inmem-test.yml | 6 +++--- 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 file-creation-single.yml diff --git a/file-creation-single.yml b/file-creation-single.yml new file mode 100644 index 0000000..29d08f2 --- /dev/null +++ b/file-creation-single.yml @@ -0,0 +1,36 @@ +--- +- name: Create inventory based on passed extra_vars + hosts: localhost + gather_facts: no + become: no + + + vars: + provision_host: "{{ tower_provision_host | default('localhost') }}" + + + tasks: + - name: "Create in-memory inventory for {{ provision_host }}" + add_host: + name: "{{ provision_host }}" + groups: + - remdiation + + +# =========================================================================== # + + +- name: Create a test file on remediation group + hosts: remdiation + gather_facts: no + become: no + + + tasks: + - name: "Test #1 - Copy file to machine" + copy: + src : files/hello-ansible.txt + dest : /tmp/hello-ansible.txt + + +... diff --git a/inmem-test.yml b/inmem-test.yml index d000c26..57f570a 100644 --- a/inmem-test.yml +++ b/inmem-test.yml @@ -1,5 +1,5 @@ --- -- name: Utilize workflow based on an in-memory inventory +- name: Create inventory based on passed extra_vars hosts: localhost gather_facts: no become: no @@ -20,7 +20,7 @@ # =========================================================================== # -- name: Verify file existance and handle errors if needed +- name: Verify file existence and handle errors if needed hosts: remdiation gather_facts: no become: no @@ -59,7 +59,7 @@ - name: Re-create files as needed uri: - url : "{{ tower_api_host }}/api/v2/job_templates/22/launch/" + url : "{{ tower_api_host }}/api/v2/job_templates/27/launch/" method : POST status_code : 201 force_basic_auth : yes