lint/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-api-config-apply.yml
Marco Ferrari c69c254b1d
Add missing Ansible task names (#2921)
Co-authored-by: Lukas Gravley <admiralawkbar@github.com>
2022-05-23 14:51:47 -05:00

69 lines
2.2 KiB
YAML

---
- name: GHE API Configuration
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"
######################
# Set the tags block #
######################
tags:
- github
- ghe_primary
- initialize