superlint/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-api-config-apply.yml

69 lines
2.2 KiB
YAML
Raw Normal View History

2020-02-04 09:49:58 -05:00
---
- name: GHE API Configuration
######################
# Set the tags block #
######################
tags:
- github
- ghe_primary
- initialize
block:
2020-02-04 09:49:58 -05:00
# ##################################
# # Run config to take in settings #
# ##################################
# - name: Run ghe-config-apply for Settings to Take Effect
# shell: "nohup ghe-config-apply </dev/null >/dev/null 2>&1 &"
# async: 45
# poll: 0
# args:
# executable: "/bin/bash"
##################################
# Run config to take in settings #
##################################
- name: Run Configure for Settings to Take Effect
2022-03-24 10:26:33 -04:00
ansible.builtin.uri:
2020-02-04 09:49:58 -05:00
url: "https://{{ ansible_host }}:8443/setup/api/configure"
method: POST
return_content: "yes"
user: "api_key"
password: "{{ github_admin_password }}"
force_basic_auth: "yes"
validate_certs: "no"
status_code: 202
#################################################################
# Wait for 'ghe-config-apply' to be completed before continuing #
#################################################################
- name: Ensure ghe-config-apply is completed
# https://docs.ansible.com/ansible/uri_module.html
# yamllint disable-line
# https://developer.github.com/enterprise/v3/enterprise-admin/management_console/#check-configuration-status
2022-03-24 10:26:33 -04:00
ansible.builtin.uri:
2020-02-04 09:49:58 -05:00
url: "https://{{ ansible_host }}:8443/setup/api/configcheck"
method: GET
return_content: "yes"
user: "api_key"
password: "{{ github_admin_password }}"
force_basic_auth: "yes"
validate_certs: "no"
register: configcheck
until: configcheck.status == 200 and configcheck.json.status == "success"
retries: 100
delay: 10
#####################################
# Remove the files from the machine #
#####################################
# Need to remove the license file and settings
# files that were copied to the ghe server
- name: Remove temp Files from GHE
become: true
2022-03-24 10:26:33 -04:00
ansible.builtin.file:
2020-02-04 09:49:58 -05:00
path: "{{ item }}"
state: absent
with_items:
- "/tmp/ghe-license.ghl"
- "/tmp/settings.json"
- "/tmp/ldap-settings.json"