Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ansible/artifactory] Add ability to generate bootstrap admin token #432

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ artifactory_allowNonPostgresql: false
# artifactory_admin_username: admin
# artifactory_admin_password: password

# Set this to true to generate a bootstrap admin token - https://jfrog.com/help/r/jfrog-installation-setup-documentation/create-an-automatic-admin-token
artifactory_generate_bootstrap_token: false

artifactory_service_file: /lib/systemd/system/artifactory.service

# Provide systemyaml content below with 2-space indentation
Expand Down Expand Up @@ -118,10 +121,10 @@ artifactory_systemyaml_override: false
# Allow artifactory user to create crontab rules
artifactory_allow_crontab: false

# Provide access config patch content
# Provide access config patch content
artifactory_access_config_patch: |-
# security:
# authentication:
# mtls:
# enabled: true
# extraction-regex: (.*)
# enabled: true
# extraction-regex: (.*)
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
- "{{ artifactory_home }}/var/etc"
- "{{ artifactory_home }}/var/etc/security/"
- "{{ artifactory_home }}/var/etc/artifactory/info/"
- "{{ artifactory_home }}/var/bootstrap/etc/access/keys"

- name: Check if system.yaml exists
become: true
Expand Down Expand Up @@ -172,19 +173,31 @@
- artifactory_licenses | length > 0
notify: Restart artifactory

- name: Set up Artifactory admin account
- name: Set up Artifactory admin account
become: true
ansible.builtin.template:
src: bootstrap.creds.j2
dest: "{{ artifactory_home }}/var/etc/access/bootstrap.creds"
owner: "{{ artifactory_user }}"
group: "{{ artifactory_group }}"
mode: 0600
when:
when:
- artifactory_admin_username is defined
- artifactory_admin_password is defined
notify: Restart artifactory

- name: Generate Artifactory bootstrap admin token
become: true
ansible.builtin.file:
path: "{{ artifactory_home }}/var/bootstrap/etc/access/keys/generate.token.json"
state: touch
owner: "{{ artifactory_user }}"
group: "{{ artifactory_group }}"
mode: 0600
when:
- artifactory_generate_bootstrap_token | bool
notify: Restart artifactory

- name: Check if included database driver is the correct version
become: true
ansible.builtin.stat:
Expand Down Expand Up @@ -239,4 +252,4 @@
delay: 5
when:
- not ansible_check_mode
- artifactory_start_service | bool
- artifactory_start_service | bool
Loading