Skip to content

Commit c4ef7df

Browse files
committed
Added awx job exporter
1 parent 19143bd commit c4ef7df

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

awx-project-export/group_vars/all.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tower:
2+
username: admin
3+
password: password

awx-project-export/inventories/hosts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[tower]
2+
localhost
3+
#ansible_port=22
4+
#ansible_ssh_user=ec2-user
5+
#ansible_ssh_pass=
6+
#ansible_ssh_private_key_file=~/.ssh/xxxxxx.pem

awx-project-export/job_exp.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
- hosts: tower
2+
gather_facts: no
3+
connection: local
4+
5+
vars:
6+
# ansible-tower-cli をインストールした環境
7+
ansible_python_interpreter: /usr/bin/python
8+
9+
tasks:
10+
- name: export job
11+
# ↓ https://docs.ansible.com/ansible/latest/modules/tower_receive_module.html
12+
tower_receive:
13+
tower_host: "{{ ansible_host }}"
14+
tower_username: "{{ tower.username }}" # 別途定義した認証情報
15+
tower_password: "{{ tower.password }}" # 別途定義した認証情報
16+
validate_certs: no
17+
job_template:
18+
- testjob1
19+
register: result
20+
21+
- name: save job
22+
copy:
23+
content: "{{ result.assets | to_nice_yaml }}"
24+
dest: job_data.yml

0 commit comments

Comments
 (0)