]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ansible/examples/builder.yml: use secret for jenkins_api_token
authorDan Mick <dmick@redhat.com>
Thu, 8 Jun 2023 08:59:28 +0000 (01:59 -0700)
committerDan Mick <dmick@redhat.com>
Mon, 10 Jul 2023 23:17:39 +0000 (16:17 -0700)
Put it into variable 'token' for all the other tasks.

Signed-off-by: Dan Mick <dmick@redhat.com>
ansible/ansible.cfg
ansible/examples/builder.yml

index 8ac5e420e0cdd7866136062adcb8bfefca7066f8..585ae0350be1e6b7f76a80812aa580a3a512390b 100644 (file)
@@ -1,6 +1,7 @@
 [defaults]
 callback_plugins = callbacks
 retry_files_enabled = False
+vault_password_file = ~/.vault_pass.txt
 
 [ssh_connection]
 pipelining=True
index 8ed95543f8908691efdf7dc997e7d4fcdb47b987..2ecad6ef23245298f80263621a658f430fa6719f 100644 (file)
     - libvirt: false # Should vagrant be installed?
     - permanent: false # Is this a permanent builder?  Since the ephemeral (non-permanent) tasks get run more often, we'll default to false.
     - jenkins_user: 'jenkins-build'
-    #- jenkins_key: This gets defined below now.
-    # jenkins API credentials:
     - api_user: 'ceph-jenkins'
-    - token: '{{ token }}'
     - api_uri: 'https://jenkins.ceph.com'
     - jenkins_credentials_uuid: 'jenkins-build'
     - nodename: '{{ nodename }}'
     - osc_user: 'username'
     - osc_pass: 'password'
     - container_mirror: 'docker-mirror.front.sepia.ceph.com:5000'
+    - secrets_path: "{{ lookup('env', 'ANSIBLE_SECRETS_PATH') | default('/etc/ansible/secrets', true) }}"
+
 
   tasks:
+    - name: "Include secrets"
+      include_vars: "{{ secrets_path | mandatory }}/jenkins_api_token.yml"
+      no_log: true
+      tags:
+        always
+
+    - set_fact:
+        token: "{{ jenkins_api_token }}"
+      no_log: true
+      tags:
+        always
+
     ## DEFINE PACKAGE LISTS BELOW
     # Universal DEBs
     - set_fact: