schemaVersion: 2.2.2
metadata:
  name: ansible-demo
components:
  - name: tooling-container
    container:
      image: ghcr.io/ansible/ansible-devspaces@sha256:a28fa23d254ff1b3ae10b95a0812132148f141bda4516661e40d0c49c4ace200
      memoryRequest: 256M
      memoryLimit: 6Gi
      cpuRequest: 250m
      cpuLimit: 2000m
      args: ['tail', '-f', '/dev/null']
      env:
        - name: 'ANSIBLE_COLLECTIONS_PATH'
          value: '~/.ansible/collections:/usr/share/ansible/collections:/projects/ansible-devspaces-demo/collections'
commands:
  - id: molecule-create
    exec:
      label: "1.Molecule: start a test pod for the automation"
      commandLine: 'source $HOME/.bashrc && molecule create'
      workingDir: ${PROJECTS_ROOT}/ansible-devspaces-demo/collections/ansible_collections/sample_namespace/sample_collection/extensions
      group:
        kind: run
        isDefault: true
      component: tooling-container
  - id: molecule-list
    exec:
      label: "2.Molecule: view the test instance that was created"
      commandLine: 'source $HOME/.bashrc && molecule list'
      workingDir: ${PROJECTS_ROOT}/ansible-devspaces-demo/collections/ansible_collections/sample_namespace/sample_collection/extensions
      group:
        kind: run
        isDefault: true
      component: tooling-container
  - id: molecule-converge
    exec:
      label: "3.Molecule: apply the role to the pod"
      commandLine: 'source $HOME/.bashrc && molecule converge'
      workingDir: ${PROJECTS_ROOT}/ansible-devspaces-demo/collections/ansible_collections/sample_namespace/sample_collection/extensions
      group:
        kind: run
        isDefault: true
      component: tooling-container
  - id: molecule-verify
    exec:
      label: "4.Molecule: run the verification against the test pod"
      commandLine: 'source $HOME/.bashrc && molecule verify'
      workingDir: ${PROJECTS_ROOT}/ansible-devspaces-demo/collections/ansible_collections/sample_namespace/sample_collection/extensions
      group:
        kind: run
        isDefault: true
      component: tooling-container
  - id: molecule-destroy
    exec:
      label: "5.Molecule: reset the test pod back to a fresh instance"
      commandLine: 'source $HOME/.bashrc && molecule destroy'
      workingDir: ${PROJECTS_ROOT}/ansible-devspaces-demo/collections/ansible_collections/sample_namespace/sample_collection/extensions
      group:
        kind: run
        isDefault: true
      component: tooling-container
  - id: molecule-test
    exec:
      label: "6.Molecule: run the full molecule test"
      commandLine: 'source $HOME/.bashrc && molecule test'
      workingDir: ${PROJECTS_ROOT}/ansible-devspaces-demo/collections/ansible_collections/sample_namespace/sample_collection/extensions
      group:
        kind: run
        isDefault: true
      component: tooling-container
  - id: ansible-navigator
    exec:
      label: "Ansible-Navigator: Start ansible-navigator"
      commandLine: |
        if [ ! -d "$HOME/.cache/ansible-navigator" ]; then
          mkdir -p "$HOME/.cache/ansible-navigator"
        fi
        cp /usr/local/lib/python3.11/site-packages/ansible_navigator/data/catalog_collections.py $HOME/.cache/ansible-navigator
        ansible-navigator --ee false
      workingDir: ${PROJECTS_ROOT}/ansible-devspaces-demo
      component: tooling-container
events:
  preStop:
    - "molecule-destroy"
projects:
  - name: ansible-devspaces-demo
    zip:
      location: CHE_DASHBOARD_INTERNAL_URL/dashboard/api/airgap-sample/project/download?id=ansible
