superlint/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-api-config-apply.yml
Brett Logan 751e5c5444 Update ansible test
Signed-off-by: Brett Logan <lindluni@github.com>
2023-04-10 14:51:50 -04:00

68 lines
2.2 KiB
YAML

---
- name: GHE API Configuration
######################
# Set the tags block #
######################
tags:
- github
- ghe_primary
- initialize
block:
# ##################################
# # 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
ansible.builtin.uri:
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
ansible.builtin.uri:
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
ansible.builtin.file:
path: "{{ item }}"
state: absent
with_items:
- "/tmp/ghe-license.ghl"
- "/tmp/settings.json"
- "/tmp/ldap-settings.json"