Skip to content

Multiple task and requirements #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions chatty_block.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: send one message
ansible.builtin.debug:
msg: "{{ chatty_message | default('This is test message') }}"

- name: Pause for {{ pause_time_min | default('1') }} min.
ansible.builtin.pause:
minutes: "{{ pause_time_min | default('1') }}"
13 changes: 13 additions & 0 deletions chatty_multiple_tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- hosts: all
gather_facts: false

vars:
num_messages: 50

tasks:

- name: Running {{ num_messages }} tasks
with_sequence: 'count={{ num_messages }}'
ansible.builtin.include_tasks:
file: single_task.yml
15 changes: 15 additions & 0 deletions chatty_payload_block.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- hosts: all
gather_facts: false

vars:
message_size: 1024 #message size in Bytes[1KB]
num_messages: 10 #number of messages
chatty_message: "{{ '$' * message_size|int }}"

tasks:

- name: Running {{ num_messages }} tasks
with_sequence: 'count={{ num_messages }}'
ansible.builtin.include_tasks:
file: single_payload_task.yml
14 changes: 14 additions & 0 deletions chatty_sleep_tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- hosts: all
gather_facts: no
vars:
message_size: 1048576 # message size in Bytes[1MB]
num_messages: 5 # number of messages
chatty_message: "{{ '$' * message_size|int }}"
pause_time_min: 65

tasks:

- name: Run a task an sleep
include_tasks: chatty_block.yml
with_sequence: "count={{ num_messages }}"
14 changes: 14 additions & 0 deletions chatty_tasks_sleep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

- hosts: all
gather_facts: false
vars:
num_messages: 50
tasks:
- debug:
msg: "This is a debug message: {{ item }}"
with_sequence: 'count={{ num_messages }}'

- name: Pause for {{ pause_time_min | default('1') }} min.
ansible.builtin.pause:
minutes: "{{ pause_time_min | default('1') }}"
13 changes: 13 additions & 0 deletions cidr_merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---

- hosts: all
tasks:

- name: cidr_merge with merge action
ansible.builtin.set_fact:
value:
- 192.168.0.0/17
- 192.168.128.0/17
- 192.168.128.1
- debug:
msg: '{{ value|ansible.utils.cidr_merge }}'
4 changes: 3 additions & 1 deletion gen_host_status.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
- hosts: all
gather_facts: false
tasks:
- include: gen_host_status_base.yml
- name: Run gen host status base tasks
ansible.builtin.include_tasks:
file: gen_host_status_base.yml
2 changes: 1 addition & 1 deletion inventories/changes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json

Expand Down
2 changes: 1 addition & 1 deletion inventories/changes_slow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import time
Expand Down
2 changes: 1 addition & 1 deletion inventories/dyn_inventory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from argparse import ArgumentParser
import json

Expand Down
2 changes: 1 addition & 1 deletion inventories/dyn_inventory_sleep_60s.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

from datetime import datetime
import json
Expand Down
2 changes: 1 addition & 1 deletion inventories/dyn_inventory_test_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from argparse import ArgumentParser
from datetime import datetime
import json
Expand Down
2 changes: 1 addition & 1 deletion inventories/dyn_inventory_test_two_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from argparse import ArgumentParser
from datetime import datetime
import json
Expand Down
2 changes: 1 addition & 1 deletion inventories/invalid_dyn_inventory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from argparse import ArgumentParser
import json

Expand Down
2 changes: 1 addition & 1 deletion inventories/metaless_dyn_inventory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from argparse import ArgumentParser
import json

Expand Down
2 changes: 1 addition & 1 deletion inventories/more_inventories/dyn_inventory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from argparse import ArgumentParser
import json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from argparse import ArgumentParser
import json

Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/ansible_host.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import os
Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/bad_script_1.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env python
#!/usr/bin/env python3
raise Exception("Fail!")
2 changes: 1 addition & 1 deletion inventories/script_migrations/bad_script_2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import sys

sys.exit(1)
2 changes: 1 addition & 1 deletion inventories/script_migrations/bad_script_3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import json

print(json.dumps({}))
2 changes: 1 addition & 1 deletion inventories/script_migrations/basic_structure.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json

Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/credential_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

from __future__ import print_function
import os, sys
Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/custom_script.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import uuid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import uuid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import uuid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import uuid
Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/empty_group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json

Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/encrypted_var.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json

Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/large_5.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import json


Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/large_5000.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import json


Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/large_dense.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import json
import os

Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/large_hostvars.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import json
import random
import string
Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/large_sparse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import json
import os

Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/ordering.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json

Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/overwrite1.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json

Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/overwrite2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# changes made relative to overwrite1.py:
Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/script_source.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import json
Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/sleep_20s.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import json, time

time.sleep(20)
Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/sleep_2s.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import json, time

time.sleep(2)
Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/sleep_300s.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import json, time

time.sleep(300)
Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/stderr.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from __future__ import print_function
import sys

Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/test_isolation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import os
import json
import re
Expand Down
2 changes: 1 addition & 1 deletion inventories/script_migrations/test_limit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import json

# Create hosts and groups
Expand Down
2 changes: 1 addition & 1 deletion library/test_scan_facts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
Expand Down
9 changes: 9 additions & 0 deletions long_running.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

- name: 'Test playbook that sleeps for long so there's time to cancel it'
hosts: all
gather_facts: false

tasks:
- name: sleep for long
command: sleep 100000
4 changes: 4 additions & 0 deletions single_payload_task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- name: Send single debug message
ansible.builtin.debug:
msg: "{{ chatty_message | default('This is test message') }}"
4 changes: 4 additions & 0 deletions single_task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- name: Running task number {{ item }}
ansible.builtin.debug:
msg: "This is a debug message for task number : {{ item }}"