-
Notifications
You must be signed in to change notification settings - Fork 2
/
playbook_get.yml
81 lines (73 loc) · 2.75 KB
/
playbook_get.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
# NOTE: some custom 'filter_plugins' are used: https://github.com/niceshops/ansible-module-ascio/tree/main/plugins/filter
- name: ASCIO Get Information
hosts: localhost
vars_prompt:
- name: api_user
prompt: Provide the api user (same as for the portal.ascio.com login)
private: no
- name: api_pwd
prompt: Provide the api password
private: yes
- name: filter_names
prompt: Provide domains to search (comma separated)
private: no
default: ''
- name: filter_tld_list
prompt: Provide a comma-separated list of tlds to filter on
private: no
default: ''
- name: output_console
prompt: Output result to console?
private: no
default: 'yes'
- name: output_file
prompt: Output result to file? (/tmp/ascio_get_${DATETIME}.json & /tmp/ascio_get_${DATETIME}.csv)
private: no
default: 'yes'
- name: ascio_get_page
prompt: Get another 'page' via API? (limited to 1000 results..)
private: no
default: "1"
vars:
remove_fields_from_results: ['PrivacyProxy', 'DnsSecKeys', 'Trademark', 'Reseller']
tasks:
- name: ASCIO | Get domain details if we registered it
niceshopsOrg.ascio.get:
user: "{{ api_user }}"
password: "{{ api_pwd }}"
filter_names: "{{ filter_names.split(',') }}"
filter_tld: "{{ filter_tld }}"
# filter_type: 'Premium'
# filter_comment: 'Test'
# filter_status: "{{ filter_status | default('All') }}"
# filter_expire_from: '2021-10-12T13:08:56.956+02:00'
# filter_expire_to: '2021-10-12T16:08:56.956+02:00'
# results: 5000
results_page: "{{ ascio_get_page }}"
register: results
delegate_to: localhost
- name: ASCIO | Filter resultes
ansible.builtin.set_fact:
filtered_results: "{{ results | ascio_filter_results(remove_fields_from_results) }}"
- name: ASCIO | Output to Console
ansible.builtin.debug:
msg: [
"filter domains: {{ filter_names.split(',') }}",
"filter tld's: {{ filter_tld }}",
"{{ filtered_results }}"
]
when: output_console | bool
ignore_errors: true
- name: ASCIO | Writing output to json-file
ansible.builtin.copy:
content: "{{ filtered_results | to_json }}"
dest: "/tmp/ascio_get_{{ filter_tld }}_{{ ansible_date_time.iso8601_basic }}.json"
mode: 0640
when: output_file | bool
ignore_errors: true
- name: ASCIO | Writing output to csv-file
ansible.builtin.debug:
msg: "{{ filtered_results | ascio_write_domain_csv('/tmp/ascio_get_' + filter_tld + '_' + ansible_date_time.iso8601_basic + '.csv') }}"
when: output_file | bool
ignore_errors: true