forked from Twingate-Labs/Twingate-CLI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
48 lines (39 loc) · 1.31 KB
/
main.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
---
- name: Run Python script
hosts: localhost # Adjust the host as needed
environment:
TG_TENANT: "{{ tg_tenant }}"
TG_API: "{{ custom_token }}"
tasks:
- name: Install multi python packages with version specifiers
ansible.builtin.pip:
name:
- pandas
- name: Output var
ansible.builtin.debug:
msg: "Script output: {{ tg_tenant }}"
- name: Basic usage
ansible.builtin.debug:
msg: "'{{ lookup('ansible.builtin.env', 'TG_TENANT') }}'"
- name: Clone the Git repository
ansible.builtin.git:
repo: https://github.com/openshift-eng/Twingate-CLI.git
dest: /tmp/Twingate-CLI
# force: true
- name: Check if repository was cloned successfully
ansible.builtin.stat:
path: /tmp/Twingate-CLI/.git
register: git_repo_created
- name: Fail if repository was not cloned
ansible.builtin.fail:
msg: "Failed to clone Git repository"
when: not git_repo_created.stat.exists
- name: Execute Python script
ansible.builtin.script: /tmp/Twingate-CLI/deletependingusertimelimit.py
args:
chdir: /tmp/Twingate-CLI
no_log: true
register: script_output
- name: Output Python script
ansible.builtin.debug:
msg: "Script output: {{ script_output.stdout }}"