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

fix: add travis CI #4

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
f8d6070
add .travis.yml
DrPsychick Sep 20, 2020
4358f7a
install python3
DrPsychick Sep 20, 2020
c6e7917
install python3
DrPsychick Sep 20, 2020
a6f105e
install python3
DrPsychick Sep 20, 2020
8656bb0
install python3
DrPsychick Sep 20, 2020
0759d17
fix: pip3 update
DrPsychick Sep 20, 2020
faf3e92
fix: pip3 update
DrPsychick Sep 20, 2020
6cb88a4
fix: xcode version
DrPsychick Sep 20, 2020
230c18c
fix: skip pip3 upgrade for certain packages
DrPsychick Sep 20, 2020
7734114
fix: configurable uninstall of brew packages (per build)
DrPsychick Sep 20, 2020
10483c9
fix: configurable uninstall of brew packages (per build)
DrPsychick Sep 20, 2020
6275bf5
fix: configurable uninstall of brew packages (per build)
DrPsychick Sep 20, 2020
2be8e34
fix: configurable uninstall of brew packages (per build)
DrPsychick Sep 20, 2020
4348395
fix: configurable uninstall of brew packages (per build)
DrPsychick Sep 20, 2020
6638510
fix: exit subshell
DrPsychick Sep 20, 2020
1ad1877
fix: use homebrew[_cask]
DrPsychick Sep 20, 2020
80bd6c5
fix: use pip
DrPsychick Sep 20, 2020
76b3639
fix: use pip
DrPsychick Sep 20, 2020
f90840d
fix: use pip
DrPsychick Sep 20, 2020
1e07ba3
fix: split homebrew update & upgrade
DrPsychick Sep 20, 2020
5f4ba44
fix: optional skip brew upgrade
DrPsychick Sep 20, 2020
bad17bf
fix: upgrade python and ansible in one command
DrPsychick Sep 20, 2020
2a69ee9
fix: upgrade python and ansible in one command
DrPsychick Sep 20, 2020
7a222bd
fix: skip packages from examples
DrPsychick Sep 20, 2020
6525568
fix: changed_when
DrPsychick Sep 20, 2020
c5bf9be
fix: changed_when
DrPsychick Sep 20, 2020
f1aa83d
fix: timeout on brew install
DrPsychick Sep 20, 2020
8ff9b93
fix: debug 'changed' reason
DrPsychick Sep 20, 2020
836ce69
fix: debug 'changed' reason
DrPsychick Sep 20, 2020
22a3bc5
fix: cask update never changed
DrPsychick Sep 21, 2020
49e6c31
Add spotify, sweethome3d, ...
DrPsychick Jan 17, 2021
9587c09
run brew upgrade manually if it fails
DrPsychick Jan 17, 2021
07d2db8
feat: support bash & zsh
DrPsychick Feb 6, 2021
e0d6b6b
create if files missing
DrPsychick Feb 6, 2021
38858e7
feat: add functions-example
DrPsychick Apr 24, 2021
0737cd5
Update readme and add `install.sh`
DrPsychick Aug 26, 2021
d420aac
Support Ansible collections (#6)
DrPsychick Aug 26, 2021
ccb3b4e
Add example config
DrPsychick Oct 25, 2021
207a83c
Add PyCharm and GoLand
DrPsychick Oct 30, 2021
ac7e94b
Feature: macOS config (#7)
DrPsychick May 22, 2022
12c1be2
chore: cleanup README
DrPsychick May 22, 2022
3f29bbd
chore: add link to repos that inspired me
DrPsychick May 22, 2022
9970bbe
feat: support timemachine destination and exclusions
DrPsychick Jun 12, 2022
fc25df5
add brew packages
DrPsychick Jun 24, 2022
b969119
fix: get prefix from brew --prefix
DrPsychick Jul 9, 2022
6e3c8d6
fix: hostname
DrPsychick Jul 9, 2022
ecdf5c3
feat: make system/config tasks idempotent, update examples
DrPsychick Jul 9, 2022
063d606
fix: cleanup brew packages and sort alphabetically
DrPsychick Oct 3, 2022
75bf6b3
fix: empty pip packages
DrPsychick Oct 3, 2022
8c1f2d6
fix: determine homebrew install path (#8)
DrPsychick Oct 3, 2022
5b66e01
Merge remote-tracking branch 'origin/master' into 2-Add_travis_CI_and…
DrPsychick Oct 3, 2022
66f902b
fix: separate config for CI
DrPsychick Oct 3, 2022
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
31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
os: osx

jobs:
include:
- name: "XCode 10.1 macOS 10.13.6"
osx_image: xcode10.1
# swiftlint requires xcode10.2
env: BREW_UNINSTALL="postgis gdal swiftlint"
- name: "XCode 11.3 macOS 10.14.6"
osx_image: xcode11.3
env: BREW_UNINSTALL="postgis gdal"
- name: "XCode 12 macOS 10.15.6"
osx_image: xcode12

install:
- brew list
- brew install python
- (test -n "$BREW_UNINSTALL" && brew uninstall $BREW_UNINSTALL || exit 0)
- pip3 install ansible

script:
- ansible-playbook macdev.yml --syntax-check
- cp host_vars/localhost-ci.yml host_vars/localhost.yml
# run the playbook
- ansible-playbook macdev.yml -e brew_skip_upgrade=true
# run again -> expect no change
- >
ansible-playbook macdev.yml -e brew_skip_upgrade=true
| grep -B1 -A30 -e 'changed=0.*failed=0' -e '^changed'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
4 changes: 2 additions & 2 deletions host_vars/localhost-M1example.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# this is pretty much my own config for my MacBook Air M1
---

# roles
role_ssh: yes
role_sys: yes
role_cfg: yes
role_ansible: true
role_pip: yes
role_brew: yes
Expand Down Expand Up @@ -132,4 +133,3 @@ brew_cask_packages:
#- { name: qdslrdashboard, path: "/Applications/qDslrDashboard.app" }
- { name: finicky, path: "/Applications/finicky.app" }
- { name: microsoft-teams, path: "/Applications/Microsoft Teams.app" }

100 changes: 100 additions & 0 deletions host_vars/localhost-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---

# roles
role_ssh: yes
# role_sys requires sudo
role_sys: no
role_cfg: no
role_ansible: yes
role_pip: no
role_brew: yes
role_app: no

## system configuration (requires sudo)
system:
# # set ComputerName, HostName and NetBIOS Name
# hostname: example
# sudo systemsetup -help
systemsetup:
# - { key: "-setrestartfreeze", value: "on" }
# - { key: "-setcomputersleep", value: "10" }
# - { key: "-setdisplaysleep", value: "5" }
loginwindow:
# - { key: "AdminHostInfo", value: "HostName" } # shows host name and info on login screen
# - { key: "GuestEnabled", value: "0" }
generic:
# - { domain: "/Library/Preferences/com.apple.loginwindow", key: "AdminHostInfo", type: string, value: "HostName" }
# - { domain: "/Library/Preferences/com.apple.loginwindow", key: "GuestEnabled", type: bool, value: 0 }
timemachine:
# destination: "smb://timemachine/macbackups"
# exclusions:
# - /Users/myuser/Library/Containers/com.docker.docker

## user configuration (must be run per user)
config:
# domain = NSGlobalDomain
global:
# - { key: "InitialKeyRepeat", type: int, value: 15 }
# - { key: "KeyRepeat", type: int, value: 1 }
generic:
# - { domain: "com.apple.desktopservices", key: "DSDontWriteNetworkStores", type: bool, value: 1 }
# domain = com.apple.finder
finder:
# available views: `icnv`, `clmv`, `Flwv`, `Nlsv`
- { key: "FXPreferredViewStyle", type: string, value: "Nlsv" }
# domain = com.apple.dock
dock:
# https://github.com/mathiasbynens/dotfiles/blob/c886e139233320e29fd882960ba3dd388d57afd7/.macos#L356
# - { key: "magnification", type: int, value: 1 }
# - { key: "tilesize", type: int, value: 32 }
# - { key: "largesize", type: int, value: 128 }
# - { key: "autohide", type: int, value: 1 }
# hot corners: tl = top-left, br = bottom-right
# - { key: "wvous-tl-corner", type: int, value: 5 }
# - { key: "wvous-tl-modifier", type: int, value: 0 }
# - { key: "wvous-tr-corner", type: int, value: 11 }
# - { key: "wvous-tr-modifier", type: int, value: 0 }
# - { key: "wvous-bl-corner", type: int, value: 3 }
# - { key: "wvous-bl-modifier", type: int, value: 0 }
# - { key: "wvous-br-corner", type: int, value: 2 }
# - { key: "wvous-br-modifier", type: int, value: 0 }

## user files and templates:
# overwrite: replace file on target, if it exists
# source=(interactive|login): source file for "interactive" session = .bashrc/.zshrc or "login" session = .profile/.zprofile

# files you want to copy to the target
files:
# - { name: "gitconfig-example", path: "$HOME/.gitconfig-example", overwrite: true }

# templates you want to copy to the target
templates:
# - { name: "bashrc-example", path: "$HOME/.bashrc-example", overwrite: true }
# - { name: "bash_aliases-example", path: "$HOME/.bash_aliases-example", overwrite: true, source: "interactive" }

# instead of copying a file or template, you can define aliases one by one
shell_aliases:
- { name: "updatemac", cmd: "(cd ~/YOUR_MACDEV_DIRECTORY; {{ 'echo \"password for sudo:\"; sudo echo;' if role_sys }} ansible-playbook macdev.yml)" }

ansible_collections:
- { name: community.general }
# see https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#install-multiple-collections-with-a-requirements-file
#- { name: community.docker, version: "=1.9.0" }
#- { name: community.kubernetes, source: "" }

brew_packages:
- { name: pwgen, path: "{{ brew_bin }}/pwgen" }
- { name: jq, path: "{{ brew_bin }}/jq" }

brew_cask_packages:
- { name: iterm2, path: /Applications/iTerm.app }

pip_packages:
- { name: yamale, path: "{{pip_bin}}/yamale" }

# supports .zip and .dmg
app_packages: []
# - { name: iTerm2, app: "iTerm", url: https://iterm2.com/downloads/stable/iTerm2-3_3_2.zip } # brew install iterm2
# - { name: Atom, app: "Atom", url: https://github.com/atom/atom/releases/download/v1.40.1/atom-mac.zip } # brew install atom
# - { name: Chrome, app: "Google Chrome", url: https://dl.google.com/chrome/mac/stable/GCEA/googlechrome.dmg } # brew install google-chrome

8 changes: 8 additions & 0 deletions roles/ssh/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
- name: SSH directory permissions
file: path=$HOME/.ssh owner={{ ansible_user_id }} group={{ user_group }} mode=0700

- name: Check for SSH private key
stat: path=$HOME/.ssh/id_rsa
register: ssh_private
- name: SSH private key permissions
file: path=$HOME/.ssh/id_rsa owner={{ ansible_user_id }} group={{ user_group }} mode=0600
when: ssh_private.stat.exists

- name: Check for SSH public key
stat: path=$HOME/.ssh/id_rsa.pub
register: ssh_public
- name: SSH public key permission
file: path=$HOME/.ssh/id_rsa.pub owner={{ ansible_user_id }} group={{ user_group }} mode=0644
when: ssh_public.stat.exists