Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds roles xcode_offline and brew to Unix_Playbook #3414

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
download and copy (soft link) xcode offline files heare:
Xcode_12.4.xip
Xcode_13.1.xip
etc.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
#########################
# Xcdde offline install #
#########################

# Install Xcode withou need to login with appleID

Check failure on line 6 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/main.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[trailing-spaces]

Trailing spaces

Check failure on line 6 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/main.yml

View workflow job for this annotation

GitHub Actions / Yamllint

6:50 [trailing-spaces] trailing spaces
# Path /Applications/Xcode.app/

Check failure on line 7 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/main.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[trailing-spaces]

Trailing spaces

Check failure on line 7 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/main.yml

View workflow job for this annotation

GitHub Actions / Yamllint

7:32 [trailing-spaces] trailing spaces
# Requires the following variable:
# xcode_version: 12.4 | 13.1 | 13.2.1 | 13.4 | 14.3.1 | 15.0.1

- name: xcode offline

Check failure on line 11 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/main.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

name[casing]

All names should start with an uppercase letter.
include_tasks: xcode_offline.yml
tags: xcode_offline
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
- name: check xcode version

Check failure on line 2 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

name[casing]

All names should start with an uppercase letter.
shell: xcodebuild -version
register: xcodebuild_version
failed_when: false
tags: xcode_offline

- name: install and configure xcode if not installed

Check failure on line 8 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

key-order[task]

You can improve the task key order to: name, when, tags, block

Check failure on line 8 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

name[casing]

All names should start with an uppercase letter.
block:

- name: test tag

Check failure on line 11 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

name[casing]

All names should start with an uppercase letter.
debug:
var: xcodebuild_version

- name: copy xcode file to remote host

Check failure on line 15 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

name[casing]

All names should start with an uppercase letter.

Check failure on line 15 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[trailing-spaces]

Trailing spaces

Check failure on line 15 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Yamllint

15:43 [trailing-spaces] trailing spaces
copy:

Check failure on line 16 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[trailing-spaces]

Trailing spaces

Check failure on line 16 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Yamllint

16:12 [trailing-spaces] trailing spaces
src: Xcode_{{ xcode_version }}.xip
dest: '~'
force: false

- name: install xcode {{ xcode_version }}
shell: |
xip -x ~/Xcode_{{ xcode_version }}.xip
args:
chdir: /Applications
become: yes
become_user: "{{ ansible_user }}"

- name: Configure xcode {{ xcode_version }}
become: yes
shell: |
xcode-select -s /Applications/Xcode.app/Contents/Developer
xcodebuild -license accept

- name: Clean up after install Xcode
shell: |
rm ~/Xcode_{{ xcode_version }}.xip

- name: check xcode version
shell: xcodebuild -version
register: output
ignore_errors: true

- name: check if xcode version is correct
debug:

Check failure on line 45 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Yamllint

45:13 [trailing-spaces] trailing spaces
var: output

Check failure on line 46 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Yamllint

46:20 [trailing-spaces] trailing spaces

Check failure on line 47 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode_offline/tasks/xcode_offline.yml

View workflow job for this annotation

GitHub Actions / Yamllint

47:1 [trailing-spaces] trailing spaces
when: "'Xcode ' + xcode_version not in xcodebuild_version.stdout"
tags: xcode_offline
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---

- name: Check if Homebrew is already installed
stat:
path: /usr/local/bin/brew
register: b
when: ansible_architecture == "x86_64"
tags: brew

- name: Check if Homebrew is already installed
stat:
path: /opt/homebrew/bin/brew
register: b
when: ansible_architecture == "arm64"
tags: brew

- set_fact: brew_is_installed="{{b.stat.exists}}"

Check warning on line 17 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/brew/tasks/brew.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

jinja[spacing]

Jinja2 spacing could be improved: {{b.stat.exists}} -> {{ b.stat.exists }}
when: b.stat.exists is defined
tags: brew

- name: install home brew
block:
- name: add user j9admin to sudoers
template:
src: sudoers
dest: /etc/sudoers.d/{{ ansible_user }}
become: true

- name: install home brew
shell: |
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

- name: check brew installation
shell: /usr/local/bin/brew --version
register: check_brew
ignore_errors: true
when: ansible_architecture == "x86_64"

- set_fact: brew_is_installed="{{check_brew.rc == 0}}"

Check warning on line 39 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/brew/tasks/brew.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

jinja[spacing]

Jinja2 spacing could be improved: {{check_brew.rc == 0}} -> {{ check_brew.rc == 0 }}
when: check_brew.rc is defined

- name: check brew installation
shell: /opt/homebrew/bin/brew --version
register: check_brew
ignore_errors: true
when: ansible_architecture == "arm64"

- set_fact: brew_is_installed="{{check_brew.rc == 0}}"

Check warning on line 48 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/brew/tasks/brew.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

jinja[spacing]

Jinja2 spacing could be improved: {{check_brew.rc == 0}} -> {{ check_brew.rc == 0 }}
when: check_brew.rc is defined

- name: failed brew installation
fail:
msg: 'brew is not installed! exiting...'
when: not brew_is_installed

Check failure on line 54 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/brew/tasks/brew.yml

View workflow job for this annotation

GitHub Actions / Yamllint

54:34 [trailing-spaces] trailing spaces

- name: configure brew x86_64
blockinfile:
state: present
insertafter: EOF
dest: ~/.zprofile
marker: "<!-- added by Ansible -->"
content: |
eval $(/usr/local/bin/brew shellenv)
when: ansible_architecture == "x86_64"

- name: configure brew arm64
blockinfile:
state: present
insertafter: EOF
dest: ~/.zprofile
marker: "<!-- added by Ansible -->"
content: |
eval $(/opt/homebrew/bin/brew shellenv)
when: ansible_architecture == "arm64"

- name: remove user j9admin from sudoers
file:
path: /etc/sudoers.d/{{ ansible_user }}
state: absent
become: true

when: not brew_is_installed
tags: brew
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
########
# brew #
########

- name: Install homebrew
include_tasks: brew.yml
when: ansible_distribution == "MacOSX"
tags: brew

Check failure on line 10 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/brew/tasks/main.yml

View workflow job for this annotation

GitHub Actions / Yamllint

10:3 [new-line-at-end-of-file] no new line character at the end of file

Check failure on line 10 in ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/brew/tasks/main.yml

View workflow job for this annotation

GitHub Actions / Yamllint

10:1 [trailing-spaces] trailing spaces
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ ansible_user }} ALL=(ALL) NOPASSWD: ALL
Loading