From 657efa16e57ff5f18d7150545ee07fd436be619c Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Thu, 24 Mar 2022 15:26:33 +0100 Subject: [PATCH] Fix Ansible tests (#2668) --- .../ansible/roles/ghe_initialize/handlers/main.yml | 2 +- .../roles/ghe_initialize/tasks/collectd-settings.yml | 12 ++++++------ .../ghe_initialize/tasks/ghe-api-config-apply.yml | 6 +++--- .../roles/ghe_initialize/tasks/ghe-config-apply.yml | 4 ++-- .../tasks/ghe-initial-configuration.yml | 12 ++++++------ .../ghe_initialize/tasks/ghe-ldap-configuration.yml | 4 ++-- .../test/ansible/roles/ghe_initialize/tasks/main.yml | 6 +++--- .../roles/ghe_initialize/tasks/splunk-settings.yml | 8 ++++---- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.automation/test/ansible/roles/ghe_initialize/handlers/main.yml b/.automation/test/ansible/roles/ghe_initialize/handlers/main.yml index 8556b297..9df0bf67 100644 --- a/.automation/test/ansible/roles/ghe_initialize/handlers/main.yml +++ b/.automation/test/ansible/roles/ghe_initialize/handlers/main.yml @@ -9,6 +9,6 @@ # GHE config apply # #################### - name: ghe config apply - command: ghe-config-apply + ansible.builtin.command: ghe-config-apply poll: 0 async: 300 diff --git a/.automation/test/ansible/roles/ghe_initialize/tasks/collectd-settings.yml b/.automation/test/ansible/roles/ghe_initialize/tasks/collectd-settings.yml index 0c73fc94..17bc2bba 100644 --- a/.automation/test/ansible/roles/ghe_initialize/tasks/collectd-settings.yml +++ b/.automation/test/ansible/roles/ghe_initialize/tasks/collectd-settings.yml @@ -6,7 +6,7 @@ - name: Wait for Admin port to come up (Port 8443) ## Doc: http://docs.ansible.com/ansible/latest/modules/wait_for_module.html ## Helpful Google: ansible wait_for - wait_for: + ansible.builtin.wait_for: host: "{{ ansible_host }}" port: 8443 delay: 5 @@ -19,7 +19,7 @@ ################################# - name: Wait for http status 200 changed_when: false - uri: + ansible.builtin.uri: url: "https://{{ ansible_host }}:8443" validate_certs: "no" register: http_result @@ -35,7 +35,7 @@ # and place it on the new remote machine - name: Copy collectd-settings.json File to GHE become: true - template: + ansible.builtin.template: src: "collectd-settings.json.j2" dest: /tmp/collectd-settings.json owner: admin @@ -47,7 +47,7 @@ ######################################################## - name: Setup Grafana # yamllint disable - shell: curl --fail -Lk \ + ansible.builtin.shell: curl --fail -Lk \ -X PUT "https://api_key:{{ github_admin_password }}@{{ ansible_host }}:8443/setup/api/settings" \ --data-urlencode "settings=`cat /tmp/collectd-settings.json`" # yamllint enable @@ -63,7 +63,7 @@ ##################################### - name: Copy forwarding.conf File to GHE become: true - template: + ansible.builtin.template: force: true src: "forwarding.conf.j2" dest: /etc/collectd/conf.d/forwarding.conf @@ -76,7 +76,7 @@ ########################################### - name: Restart Collectd service become: true - service: + ansible.builtin.service: name: collectd state: restarted diff --git a/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-api-config-apply.yml b/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-api-config-apply.yml index 64e4be65..3c3e4ff0 100644 --- a/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-api-config-apply.yml +++ b/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-api-config-apply.yml @@ -14,7 +14,7 @@ # Run config to take in settings # ################################## - name: Run Configure for Settings to Take Effect - uri: + ansible.builtin.uri: url: "https://{{ ansible_host }}:8443/setup/api/configure" method: POST return_content: "yes" @@ -31,7 +31,7 @@ # https://docs.ansible.com/ansible/uri_module.html # yamllint disable-line # https://developer.github.com/enterprise/v3/enterprise-admin/management_console/#check-configuration-status - uri: + ansible.builtin.uri: url: "https://{{ ansible_host }}:8443/setup/api/configcheck" method: GET return_content: "yes" @@ -51,7 +51,7 @@ # files that were copied to the ghe server - name: Remove temp Files from GHE become: true - file: + ansible.builtin.file: path: "{{ item }}" state: absent with_items: diff --git a/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-config-apply.yml b/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-config-apply.yml index 9c8fabca..78b7edc3 100644 --- a/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-config-apply.yml +++ b/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-config-apply.yml @@ -5,7 +5,7 @@ ######################################## - name: Copy the script to the GHE instance become: true - template: + ansible.builtin.template: force: 'yes' src: "ghe-config-apply.sh" dest: /tmp/ghe-config-apply.sh @@ -17,7 +17,7 @@ # Run config to take in settings # ################################## - name: Run ghe-config-apply for Settings to Take Effect - shell: "nohup ./tmp/ghe-config-apply.sh /dev/null 2>&1 &" + ansible.builtin.shell: "nohup ./tmp/ghe-config-apply.sh /dev/null 2>&1 &" async: 300 poll: 0 args: diff --git a/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-initial-configuration.yml b/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-initial-configuration.yml index d44e2101..b8737299 100644 --- a/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-initial-configuration.yml +++ b/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-initial-configuration.yml @@ -7,7 +7,7 @@ # yamllint disable-line ## Documentation: http://docs.ansible.com/ansible/latest/modules/wait_for_module.html ## Helpful Google: ansible wait_for - wait_for: + ansible.builtin.wait_for: host: "{{ ansible_host }}" port: 8443 delay: 5 @@ -20,7 +20,7 @@ ################################# - name: Wait for http status 200 changed_when: false - uri: + ansible.builtin.uri: url: "https://{{ ansible_host }}:8443" validate_certs: "no" register: http_result @@ -36,7 +36,7 @@ # and place it on the new remote machine - name: Copy License File to GHE become: true - copy: + ansible.builtin.copy: src: "{{ role_path }}/files/ghe-license.ghl" dest: /tmp/ghe-license.ghl owner: admin @@ -50,7 +50,7 @@ # and place it on the new remote machine - name: Copy settings.json File to GHE become: true - template: + ansible.builtin.template: src: "settings.json.j2" dest: /tmp/settings.json owner: admin @@ -61,7 +61,7 @@ # Set up Admin password, License, and Initial Settings # ######################################################## - name: Setup License, Admin Password, and Initial Settings - command: curl --fail -Lk \ + ansible.builtin.command: curl --fail -Lk \ -X POST "https://{{ ansible_host }}:8443/setup/api/start" \ -F license=@/tmp/ghe-license.ghl \ -F "password={{ github_admin_password }}" \ @@ -75,7 +75,7 @@ # Set the GHE Admin Password fact # ################################### - name: Set the GitHub Admin password fact - set_fact: + ansible.builtin.set_fact: github_admin_password: "{{ github_admin_password }}" ###################### diff --git a/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-ldap-configuration.yml b/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-ldap-configuration.yml index b886ee30..30b0b2e5 100644 --- a/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-ldap-configuration.yml +++ b/.automation/test/ansible/roles/ghe_initialize/tasks/ghe-ldap-configuration.yml @@ -7,7 +7,7 @@ # and place it on the new remote machine - name: Copy ldap-settings.json File to GHE become: true - template: + ansible.builtin.template: src: "ldap-settings.json.j2" dest: /tmp/ldap-settings.json owner: admin @@ -18,7 +18,7 @@ # Set up LDAP with ldap-settings.json # ####################################### - name: Setup ldap with ldap-settings.json - shell: curl --fail -Lk -X PUT 'https://api_key:{{ github_admin_password }}@{{ ansible_host }}:8443/setup/api/settings' --data-urlencode "settings=`cat /tmp/ldap-settings.json`" # yamllint disable-line + ansible.builtin.shell: curl --fail -Lk -X PUT 'https://api_key:{{ github_admin_password }}@{{ ansible_host }}:8443/setup/api/settings' --data-urlencode "settings=`cat /tmp/ldap-settings.json`" # yamllint disable-line retries: 10 delay: 2 register: http_ldapconfig_result diff --git a/.automation/test/ansible/roles/ghe_initialize/tasks/main.yml b/.automation/test/ansible/roles/ghe_initialize/tasks/main.yml index 7f403d33..7cc0cf2a 100644 --- a/.automation/test/ansible/roles/ghe_initialize/tasks/main.yml +++ b/.automation/test/ansible/roles/ghe_initialize/tasks/main.yml @@ -9,7 +9,7 @@ # Need to run the tasks to stand up the GHE instance # ###################################################### # Configure the base system - - include_tasks: ghe-initial-configuration.yml + - ansible.builtin.include_tasks: ghe-initial-configuration.yml ###################### # Set the tags block # @@ -32,7 +32,7 @@ # Need to run the tasks to config LDAP on the GHE instance # ############################################################ # Configure the base system - - include_tasks: ghe-ldap-configuration.yml + - ansible.builtin.include_tasks: ghe-ldap-configuration.yml ###################### # Set the tags block # @@ -53,7 +53,7 @@ # Need to run the tasks to stand up the GHE instance # ###################################################### # Configure the base system - - include_tasks: ghe-api-config-apply.yml + - ansible.builtin.include_tasks: ghe-api-config-apply.yml ###################### # Set the tags block # diff --git a/.automation/test/ansible/roles/ghe_initialize/tasks/splunk-settings.yml b/.automation/test/ansible/roles/ghe_initialize/tasks/splunk-settings.yml index aaaa0780..cec794a8 100644 --- a/.automation/test/ansible/roles/ghe_initialize/tasks/splunk-settings.yml +++ b/.automation/test/ansible/roles/ghe_initialize/tasks/splunk-settings.yml @@ -6,7 +6,7 @@ - name: Wait for Admin port to come up (Port 8443) ## Doc: http://docs.ansible.com/ansible/latest/modules/wait_for_module.html ## Helpful Google: ansible wait_for - wait_for: + ansible.builtin.wait_for: host: "{{ ansible_host }}" port: 8443 delay: 5 @@ -19,7 +19,7 @@ ################################# - name: Wait for http status 200 changed_when: false - uri: + ansible.builtin.uri: url: "https://{{ ansible_host }}:8443" validate_certs: "no" register: http_result @@ -35,7 +35,7 @@ # and place it on the new remote machine - name: Copy splunk-settings.json File to GHE become: true - template: + ansible.builtin.template: src: "splunk-settings.json.j2" dest: /tmp/splunk-settings.json owner: admin @@ -47,7 +47,7 @@ ######################################################## - name: Setup Splunk # yamllint disable - shell: curl --fail -Lk \ + ansible.builtin.shell: curl --fail -Lk \ -X PUT "https://api_key:{{ github_admin_password }}@{{ ansible_host }}:8443/setup/api/settings" \ --data-urlencode "settings=`cat /tmp/splunk-settings.json`" # yamllint enable