From 2fcc8948f4b479b8fe20c88fd452524cfb1e3a56 Mon Sep 17 00:00:00 2001 From: Siong Chin Date: Fri, 27 Oct 2023 10:55:35 +0100 Subject: [PATCH] Update yml files after linting (NO_JIRA) --- meta/main.yml | 4 ++-- tasks/CentOS.yml | 6 +++--- tasks/Darwin.yml | 30 +++++++++++++++++------------- tasks/Debian.yml | 2 +- tasks/RedHat.yml | 4 ++-- tasks/Windows.yml | 6 +++--- tasks/install-pkg.yml | 8 ++++---- tasks/main.yml | 2 +- 8 files changed, 33 insertions(+), 29 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index 4519d63..c6d55e3 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -8,7 +8,7 @@ galaxy_info: description: C++ compiler deployment and setup for CCDC build machines. company: The Cambridge Crystallographic Data Centre license: "license (BSD, MIT)" - min_ansible_version: 2.9 + min_ansible_version: "2.9" platforms: - name: EL versions: @@ -21,7 +21,7 @@ galaxy_info: - all - name: MacOSX versions: - - 10.15 + - all - name: Windows versions: - all diff --git a/tasks/CentOS.yml b/tasks/CentOS.yml index a3bb17d..abc4be0 100644 --- a/tasks/CentOS.yml +++ b/tasks/CentOS.yml @@ -1,6 +1,6 @@ --- - name: Install build tools - yum: + ansible.builtin.yum: name: - devtoolset-10 - llvm-toolset-10.0 @@ -12,14 +12,14 @@ - name: Enable devtoolset globally for all users # See https://developers.redhat.com/blog/2014/03/19/permanently-enable-a-software-collection/ - copy: + ansible.builtin.copy: src: enable-devtoolset.sh dest: /etc/profile.d/enable-devtoolset.sh mode: u=rwx,g=rx,o=rx become: true - name: Enable llvm-toolset globally for all users - copy: + ansible.builtin.copy: src: enable-llvm-toolset.sh dest: /etc/profile.d/enable-llvm-toolset.sh mode: u=rwx,g=rx,o=rx diff --git a/tasks/Darwin.yml b/tasks/Darwin.yml index e898cac..09d4102 100644 --- a/tasks/Darwin.yml +++ b/tasks/Darwin.yml @@ -1,11 +1,11 @@ --- - name: Check for existing Xcode installation - stat: + ansible.builtin.stat: path: "/Applications/Xcode_{{ xcode_version }}.app" register: xcode_app - name: "Download XCode {{ xcode_version }}" - shell: > + ansible.builtin.shell: > jfrog rt dl --flat --fail-no-op @@ -21,45 +21,49 @@ JFROG_CLI_OFFER_CONFIG: "false" when: xcode_app.stat.isdir is not defined or not xcode_app.stat.isdir register: download + args: + creates: "~/Downloads/Xcode_{{ xcode_version }}.xip" - name: Extract XCode archive - command: xip -x ~/Downloads/Xcode_{{ xcode_version }}.xip + ansible.builtin.command: xip -x ~/Downloads/Xcode_{{ xcode_version }}.xip args: chdir: "/Applications" creates: "/Applications/Xcode.app" when: xcode_app.stat.isdir is not defined or not xcode_app.stat.isdir register: extract_xcode_xip -- name: Move XCode to /Applications/Xcode_{{ xcode_version }}.app - command: mv /Applications/Xcode.app /Applications/Xcode_{{ xcode_version }}.app +- name: Move XCode to /Applications/Xcode_{{ xcode_version }}.app # noqa: name[template] + ansible.builtin.command: mv /Applications/Xcode.app /Applications/Xcode_{{ xcode_version }}.app when: xcode_app.stat.isdir is not defined or not xcode_app.stat.isdir + args: + creates: "/Applications/Xcode_{{ xcode_version }}.app" - name: Remove downloaded Xcode archive - file: + ansible.builtin.file: state: absent path: "~/Downloads/Xcode_{{ xcode_version }}.xip" -- name: switch to /Applications/Xcode_{{ xcode_version }}.app # noqa: no-changed-when - command: xcode-select --switch /Applications/Xcode_{{ xcode_version }}.app/Contents/Developer +- name: Switch to /Applications/Xcode_{{ xcode_version }}.app # noqa: no-changed-when,name[template] + ansible.builtin.command: xcode-select --switch /Applications/Xcode_{{ xcode_version }}.app/Contents/Developer become: true - name: Accept Xcode licence # noqa: no-changed-when - command: xcodebuild -license accept + ansible.builtin.command: xcodebuild -license accept become: true - name: Get list of installed packages # noqa: no-changed-when - command: pkgutil --pkgs + ansible.builtin.command: pkgutil --pkgs register: pkgutil_packages - name: Get list of packages available with Xcode - find: + ansible.builtin.find: path: /Applications/Xcode_{{ xcode_version }}.app/Contents/Resources/Packages/ patterns: "*.pkg" recurse: no register: packages -- name: Install Xcode packages - include: install-pkg.yml +- name: Install Xcode packages # noqa: deprecated-module + ansible.builtin.include: install-pkg.yml vars: package_file: "{{ package }}" package_list: "{{ pkgutil_packages.stdout }}" diff --git a/tasks/Debian.yml b/tasks/Debian.yml index 8a6565a..a4cc4ae 100644 --- a/tasks/Debian.yml +++ b/tasks/Debian.yml @@ -1,6 +1,6 @@ --- - name: Install build tools - apt: + ansible.builtin.apt: name: - build-essential state: present diff --git a/tasks/RedHat.yml b/tasks/RedHat.yml index fc39b4d..4cd6a09 100644 --- a/tasks/RedHat.yml +++ b/tasks/RedHat.yml @@ -12,14 +12,14 @@ - name: Enable devtoolset globally for all users # See https://developers.redhat.com/blog/2014/03/19/permanently-enable-a-software-collection/ - copy: + ansible.builtin.copy: src: enable-devtoolset.sh dest: /etc/profile.d/enable-devtoolset.sh mode: u=rwx,g=rx,o=rx become: true - name: Enable llvm-toolset globally for all users - copy: + ansible.builtin.copy: src: enable-llvm-toolset.sh dest: /etc/profile.d/enable-llvm-toolset.sh mode: u=rwx,g=rx,o=rx diff --git a/tasks/Windows.yml b/tasks/Windows.yml index 9d9fa8b..7e6846f 100644 --- a/tasks/Windows.yml +++ b/tasks/Windows.yml @@ -1,15 +1,15 @@ --- - name: Install visualstudio2019professional (SLOW) - win_chocolatey: + chocolatey.chocolatey.win_chocolatey: name: visualstudio2019professional state: present - name: Install visualstudio2019-workload-nativedesktop (SLOW) - win_chocolatey: + chocolatey.chocolatey.win_chocolatey: name: visualstudio2019-workload-nativedesktop state: present - name: Install visualstudio2019-remotetools - win_chocolatey: + chocolatey.chocolatey.win_chocolatey: name: visualstudio2019-remotetools state: present diff --git a/tasks/install-pkg.yml b/tasks/install-pkg.yml index ea658a2..1a2242c 100644 --- a/tasks/install-pkg.yml +++ b/tasks/install-pkg.yml @@ -1,9 +1,9 @@ --- -- name: read package info # noqa: no-changed-when - command: installer -pkginfo -pkg "{{ package_file }}" +- name: Read package info # noqa: no-changed-when + ansible.builtin.command: installer -pkginfo -pkg "{{ package_file }}" register: package_pkginfo -- name: install package - command: installer -pkg "{{ package_file }}" -target / +- name: Install package #noqa: no-changed-when + ansible.builtin.command: installer -pkg "{{ package_file }}" -target / when: package_pkginfo.stdout not in package_list become: true diff --git a/tasks/main.yml b/tasks/main.yml index dd08fb8..a5637cb 100755 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Set up C++ compilers - include_tasks: "{{ taskfile }}" + ansible.builtin.include_tasks: "{{ taskfile }}" with_first_found: - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml" - "{{ ansible_distribution }}.yml"