lint/test/linters/ansible/roles/ghe_initialize/tasks/ghe-initial-configuration.yml

89 lines
2.8 KiB
YAML
Raw Normal View History

2020-02-04 09:49:58 -05:00
---
- name: GHE Initial configuration
######################
# Set the tags block #
######################
tags:
- github
- ghe_primary
- initialize
block:
2020-02-04 09:49:58 -05:00
###############################
# Wait for admin port to open #
###############################
- name: Wait for Admin port to come up (Port 8443)
# yamllint disable-line
## Documentation: http://docs.ansible.com/ansible/latest/modules/wait_for_module.html
## Helpful Google: ansible wait_for
2022-03-24 10:26:33 -04:00
ansible.builtin.wait_for:
2020-02-04 09:49:58 -05:00
host: "{{ ansible_host }}"
port: 8443
delay: 5
timeout: 300
state: started
changed_when: false
#################################
# Wait for successful open port #
#################################
- name: Wait for http status 200
changed_when: false
2022-03-24 10:26:33 -04:00
ansible.builtin.uri:
2020-02-04 09:49:58 -05:00
url: "https://{{ ansible_host }}:8443"
validate_certs: "no"
register: http_result
# ignore_errors: true
until: http_result.status == 200
retries: 100
delay: 3
#######################################################
# Copy License file to GHE to decrypt file and upload #
#######################################################
# Copy of the file will allow for Ansible Vault to decrypt the file
# and place it on the new remote machine
- name: Copy License File to GHE
become: true
2022-03-24 10:26:33 -04:00
ansible.builtin.copy:
2020-02-04 09:49:58 -05:00
src: "{{ role_path }}/files/ghe-license.ghl"
dest: /tmp/ghe-license.ghl
owner: admin
group: admin
mode: 0600
#######################################################
# Copy License file to GHE to decrypt file and upload #
#######################################################
# Copy of the file will allow for Ansible Vault to decrypt the file
# and place it on the new remote machine
- name: Copy settings.json File to GHE
become: true
2022-03-24 10:26:33 -04:00
ansible.builtin.template:
2020-02-04 09:49:58 -05:00
src: "settings.json.j2"
dest: /tmp/settings.json
owner: admin
group: admin
mode: 0644
2020-06-21 00:00:08 -04:00
########################################################
# Set up Admin password, License, and Initial Settings #
########################################################
- name: Setup License, Admin Password, and Initial Settings
2022-03-24 10:26:33 -04:00
ansible.builtin.command: curl --fail -Lk \
2020-02-04 09:49:58 -05:00
-X POST "https://{{ ansible_host }}:8443/setup/api/start" \
-F license=@/tmp/ghe-license.ghl \
-F "password={{ github_admin_password }}" \
-F "settings=</tmp/settings.json"
retries: 10
delay: 2
register: http_initialconfig_result
until: http_initialconfig_result.rc == 0
###################################
# Set the GHE Admin Password fact #
###################################
- name: Set the GitHub Admin password fact
2022-03-24 10:26:33 -04:00
ansible.builtin.set_fact:
2020-02-04 09:49:58 -05:00
github_admin_password: "{{ github_admin_password }}"