The secrets role provides a var 'secrets_path' we can use to access
secrets stored outside of this repo. We will store the inventory and
secrets in lab specific repos.
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
--- /dev/null
+---
+dependencies:
+ - role: secrets
--- /dev/null
+---
+- name: Include Red Hat encrypted variables.
+ include_vars: "{{ secrets_path | mandatory }}/entitlements.yml"
+ no_log: true
+ tags:
+ - vars
+
+- name: Determine if node is registered with subscription-manager.
+ command: subscription-manager identity
+ register: subscription
+ ignore_errors: true
+ changed_when: false
+ no_log: true
+
+- name: Register with subscription-manager.
+ command: subscription-manager register
+ --activationkey={{ subscription_manager_activationkey }}
+ --org={{ subscription_manager_org }}
+ no_log: true
+ when: subscription.rc != 0
--- /dev/null
+---
+secrets_path: "{{ lookup('env', 'ANSIBLE_SECRETS_PATH') | default('/etc/ansible/secrets', true) }}"