# Controller schedule job help

**URL:** <https://forum.ansible.com/t/controller-schedule-job-help/44810>\
**Category:** Get Help\
**Tags:** vmware, aap, awx\
**Created:** [November 7, 2025, 2:57pm UTC](https://forum.ansible.com/t/controller-schedule-job-help/44810 "2025-11-07T14:57:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fracture7144](https://avatars.discourse-cdn.com/v4/letter/f/73ab20/32.png) [@Fracture7144](https://forum.ansible.com/u/Fracture7144)\
**Post date:** [November 7, 2025, 2:57pm UTC](https://forum.ansible.com/t/controller-schedule-job-help/44810/1 "2025-11-07T14:57:21Z")

</div>

I currently have a ansible role I am working on that does os\_patching for us. In that role I need tit to take snapshots and then create a scheduled job in AAP to remove those snapshots after 1 week. I’ve got most of this working using the vmware.vmware or vmware\_rest collections. Right now I’m running into an issue with the ansible.controller.schedule module. I am aware of the set\_fact statement that has a date WAY in the past. My main issue comes down to making the rrule work. This seems to be where the role fails in my AAP instance and I’m not understanding why.

Here is the code I have written:

```auto
- name: Calculate 'DTSTART' 7 days in the future using shell
  ansible.builtin.shell: |
    date -d "+7 days"
  register: future_rrule_shell
  delegate_to: localhost

- name: Set 'dynamic_rrule' fact from shell output
  ansible.builtin.set_fact:
    dynamic_rrule: "{{ future_rrule_shell.stdout }}"

- name: Create a ruleset for everyday except Sundays
  ansible.builtin.set_fact:
    complex_rule: "{{ lookup(awx.awx.schedule_rruleset, '2022-04-30 10:30:45', rules=rrules, timezone='UTC' ) }}"
  vars:
    rrules:
    - frequency: 'day'
      interval: 1
    - frequency: 'day'
      interval: 1
      byweekday: 'sunday'
      include: False

- name: Schedule a one-time snapshot cleanup in AAP (T+{{ snapshot_ttl_days|default(7) }} days)
  ansible.controller.schedule:
    controller_host: "{{ lookup ('env', 'CONTROLLER_HOST') }}"
    controller_username: "{{ lookup ('env', 'CONTROLLER_USERNAME') }}"
    controller_password: "{{ lookup ('env', 'CONTROLLER_PASSWORD') }}"
    validate_certs: "{{ controller_validate_certs | default(true) }}"
    enabled: true
    job_type: run
    unified_job_template: vmware_snapshot_cleanup # your JobTemplate name
    name: "Cleanup {{ vm_name | default(inventory_hostname_short) }} pre-change on {{ selected_aap_instance.name }}"
    rrule: "DTSTART:{{ dynamic_rrule }}"
    #extra_data:
    # vcenter_hostname: "{{ _chosen_vcenter }}"
    # vcenter_username: "{{ vcenter_username }}"
    # vcenter_password: "{{ vcenter_password }}"
    # vcenter_validate_certs: "{{ vcenter_validate_certs | default(false) }}"
    # vm_id: "{{ _vm_id }}"
  delegate_to: localhost

```

Here is the output from AAP.

```auto
[ERROR]: Task failed: Module failed: 'NoneType' object has no attribute 'replace'
Origin: /runner/requirements_roles/os_patching/tasks/vmware/schedule_removal.yml:64:3
62 dynamic_rrule: "{{ future_rrule_shell.stdout }}"
63
64 - name: Schedule a one-time snapshot cleanup in AAP (T+{{ snapshot_ttl_days|default(7) }} days)
     ^ column 3

fatal: [testserver03.example.com -> localhost]: FAILED! => {
    "changed": false,
    "msg": "Task failed: Module failed: 'NoneType' object has no attribute 'replace'"
}
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1762377189.6961734-301-224640049938324/ > /dev/null 2>&1 && sleep 0'

fatal: [testserver01.example -> localhost]: FAILED! => {
    "changed": false,
    "msg": "Task failed: Module failed: 'NoneType' object has no attribute 'replace'"

```

Any help is greatly appreciated!
