summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-10-12 19:02:38 +0000
committerGerrit Code Review <review@openstack.org>2018-10-12 19:02:38 +0000
commit8b2fe277e22d5f483eed104c790afed066f88b6d (patch)
tree570bb0d350629121cdbc7ea58de23214d9980112
parentc195d514df5085204438f9b96af3c70410800624 (diff)
parent5e1a7e7234cd67fe1c62726599bd98cbeb80832a (diff)
Merge "Create ansible-galaxy-import role"
-rw-r--r--roles/ansible-galaxy-import/README.rst28
-rw-r--r--roles/ansible-galaxy-import/defaults/main.yaml4
-rw-r--r--roles/ansible-galaxy-import/tasks/main.yaml6
3 files changed, 38 insertions, 0 deletions
diff --git a/roles/ansible-galaxy-import/README.rst b/roles/ansible-galaxy-import/README.rst
new file mode 100644
index 0000000..5d9d623
--- /dev/null
+++ b/roles/ansible-galaxy-import/README.rst
@@ -0,0 +1,28 @@
1Import 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.
diff --git a/roles/ansible-galaxy-import/defaults/main.yaml b/roles/ansible-galaxy-import/defaults/main.yaml
new file mode 100644
index 0000000..51c8869
--- /dev/null
+++ b/roles/ansible-galaxy-import/defaults/main.yaml
@@ -0,0 +1,4 @@
1---
2ansible_galaxy_branch: "{{ zuul.branch }}"
3ansible_galaxy_executable: ansible-galaxy
4ansible_galaxy_server: "{{ ansible_galaxy_info.server|default('https://galaxy.ansible.com') }}"
diff --git a/roles/ansible-galaxy-import/tasks/main.yaml b/roles/ansible-galaxy-import/tasks/main.yaml
new file mode 100644
index 0000000..d5de23e
--- /dev/null
+++ b/roles/ansible-galaxy-import/tasks/main.yaml
@@ -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'] }}"