Skip to content

Commit 528b9ee

Browse files
committed
Added import playbook
1 parent 6ffb928 commit 528b9ee

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed

awx-project-export/inventories/hosts

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
tower:
2-
host: localhost
2+
host: http://xxx.xxx.xxx.xxx
33
username: admin
44
password: password
55

66
# ansible-tower-cli をインストールした環境
7-
ansible_python_interpreter: /usr/bin/python
7+
ansible_python_interpreter: /Users/kento/.pyenv/shims/python
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[tower]
2+
# AWXのグローバルIP
3+
xxx.xxx.xxx.xxx

awx-project-export/job_exp.yml renamed to awx-project-import-export/prj_exp.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
connection: local
44

55
tasks:
6-
- name: export job
6+
- name: export all project
77
# ↓ https://docs.ansible.com/ansible/latest/modules/tower_receive_module.html
88
tower_receive:
9-
tower_host: "{{ tower.host }}"
10-
tower_username: "{{ tower.username }}" # 別途定義した認証情報
11-
tower_password: "{{ tower.password }}" # 別途定義した認証情報
129
validate_certs: no
13-
job_template:
14-
- testjob1
10+
tower_host: "{{ tower.host }}"
11+
tower_username: "{{ tower.username }}"
12+
tower_password: "{{ tower.password }}"
13+
project:
14+
- all
1515
register: result
1616

17-
- name: save job
17+
- name: save project
1818
copy:
1919
content: "{{ result.assets | to_nice_yaml }}"
20-
dest: job_data.yml
20+
dest: project_data.yml

awx-project-import-export/prj_imp.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
- hosts: tower
2+
gather_facts: no
3+
connection: local
4+
5+
tasks:
6+
- name: import all project
7+
# ↓ https://docs.ansible.com/ansible/latest/modules/tower_receive_module.html
8+
tower_send:
9+
validate_certs: no
10+
tower_host: "{{ tower.host }}"
11+
tower_username: "{{ tower.username }}"
12+
tower_password: "{{ tower.password }}"
13+
files:
14+
- project_data.yml

0 commit comments

Comments
 (0)