Browse Source

Merge "Create ansible-galaxy-import role"

changes/74/518374/2
Zuul 7 months ago
parent
commit
8b2fe277e2

+ 28
- 0
roles/ansible-galaxy-import/README.rst View File

@@ -0,0 +1,28 @@
1
+Import ansible roles into ansible galaxy
2
+
3
+**Role Variables**
4
+
5
+.. zuul:rolevar:: ansible_galaxy_branch
6
+   :default: zuul.branch
7
+
8
+   The name of a branch to import.
9
+
10
+.. zuul:rolevar:: ansible_galaxy_executable
11
+   :default: ansible-galaxy
12
+
13
+   Path to ansible-galaxy executable.
14
+
15
+.. zuul:rolevar:: ansible_galaxy_info
16
+
17
+   Complex argument which contains the information about the Ansible
18
+   Galaxy server as well as the authentication information needed. It
19
+   is expected that this argument comes from a `Secret`.
20
+
21
+  .. zuul:rolevar:: server
22
+     :default: https://galaxy.ansible.com
23
+
24
+     The API server destination.
25
+
26
+  .. zuul:rolevar:: token
27
+
28
+     Identify with github token rather than username and password.

+ 4
- 0
roles/ansible-galaxy-import/defaults/main.yaml View File

@@ -0,0 +1,4 @@
1
+---
2
+ansible_galaxy_branch: "{{ zuul.branch }}"
3
+ansible_galaxy_executable: ansible-galaxy
4
+ansible_galaxy_server: "{{ ansible_galaxy_info.server|default('https://galaxy.ansible.com') }}"

+ 6
- 0
roles/ansible-galaxy-import/tasks/main.yaml View File

@@ -0,0 +1,6 @@
1
+- name: Login into Ansible Galaxy
2
+  command: "{{ ansible_galaxy_executable }} -s {{ ansible_galaxy_server }} login --github-token {{ galaxy_info.token }}"
3
+  no_log: True
4
+
5
+- name: Import role into Ansible Galaxy
6
+  command: "{{ ansible_galaxy_executable }} -s {{ ansible_galaxy_server }} import --branch {{ ansible_galaxy_branch }} {{ zuul.project['name'].split('/')[0] }} {{ zuul.project['short_name'] }}"

Loading…
Cancel
Save