Skip to content

Commit c157236

Browse files
committed
Initial commit
0 parents  commit c157236

33 files changed

+1137
-0
lines changed

.ansible-lint

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
skip_list:
2+
- risky-file-permissions
3+
- yaml
4+
- fqcn-builtins

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/FUNDING.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
---
3+
github: buluma
4+
patreon: buluma

.github/stale.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Configuration for probot-stale - https://github.com/probot/stale
2+
3+
# Number of days of inactivity before an Issue or Pull Request becomes stale
4+
daysUntilStale: 90
5+
6+
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
7+
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
8+
daysUntilClose: 30
9+
10+
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
11+
onlyLabels: []
12+
13+
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
14+
exemptLabels:
15+
- bug
16+
- pinned
17+
- security
18+
- planned
19+
20+
# Set to true to ignore issues in a project (defaults to false)
21+
exemptProjects: false
22+
23+
# Set to true to ignore issues in a milestone (defaults to false)
24+
exemptMilestones: false
25+
26+
# Set to true to ignore issues with an assignee (defaults to false)
27+
exemptAssignees: false
28+
29+
# Label to use when marking as stale
30+
staleLabel: stale
31+
32+
# Limit the number of actions per hour, from 1-30. Default is 30
33+
limitPerRun: 30
34+
35+
pulls:
36+
markComment: |-
37+
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
38+
39+
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark pull requests as stale.
40+
41+
unmarkComment: >-
42+
This pull request is no longer marked for closure.
43+
44+
closeComment: >-
45+
This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details.
46+
47+
issues:
48+
markComment: |-
49+
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
50+
51+
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
52+
53+
unmarkComment: >-
54+
This issue is no longer marked for closure.
55+
56+
closeComment: >-
57+
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

.github/workflows/ci.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
name: CI
3+
'on':
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
schedule:
9+
- cron: "0 5 * * 0"
10+
11+
defaults:
12+
run:
13+
working-directory: ansible_collections/buluma/mac
14+
15+
jobs:
16+
17+
lint:
18+
name: Lint
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Check out the codebase.
22+
uses: actions/checkout@v2
23+
with:
24+
path: ansible_collections/buluma/mac
25+
26+
- name: Set up Python 3.
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: '3.x'
30+
31+
- name: Install test dependencies.
32+
run: pip3 install yamllint ansible-core ansible-lint
33+
34+
- name: Lint code.
35+
run: |
36+
yamllint .
37+
ansible-lint
38+
39+
integration:
40+
name: Integration
41+
runs-on: ${{ matrix.os }}
42+
strategy:
43+
matrix:
44+
os:
45+
- macos-latest
46+
47+
steps:
48+
- name: Check out the codebase.
49+
uses: actions/checkout@v2
50+
with:
51+
path: ansible_collections/buluma/mac
52+
53+
- name: Uninstall GitHub Actions' built-in Homebrew.
54+
run: tests/uninstall-homebrew.sh
55+
56+
- name: Uninstall GitHub Actions' built-in browser installs.
57+
run: |
58+
sudo rm -rf /Applications/Firefox.app
59+
sudo rm -rf /Applications/Google\ Chrome.app
60+
61+
- name: Install test dependencies.
62+
run: |
63+
sudo pip3 install --upgrade pip
64+
sudo pip3 install ansible-core
65+
66+
- name: Set up the test environment.
67+
run: |
68+
cp tests/ansible.cfg ./ansible.cfg
69+
cp tests/inventory ./inventory
70+
ansible-galaxy collection install community.general
71+
ansible-galaxy role install elliotweiser.osx-command-line-tools
72+
73+
- name: Test the playbook's syntax.
74+
run: ansible-playbook tests/test.yml --syntax-check
75+
76+
- name: Test the playbook.
77+
run: ansible-playbook tests/test.yml
78+
env:
79+
ANSIBLE_FORCE_COLOR: '1'
80+
81+
- name: Idempotence check.
82+
run: |
83+
idempotence=$(mktemp)
84+
ansible-playbook tests/test.yml | tee -a ${idempotence}
85+
tail ${idempotence} | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
86+
env:
87+
ANSIBLE_FORCE_COLOR: '1'

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Release
3+
'on':
4+
push:
5+
tags:
6+
- '*'
7+
8+
defaults:
9+
run:
10+
working-directory: ansible_collections/buluma/mac
11+
12+
jobs:
13+
14+
release:
15+
name: Release
16+
runs-on: ubuntu-latest
17+
env:
18+
ANSIBLE_GALAXY_TOKEN: ${{ secrets.ANSIBLE_GALAXY_TOKEN }}
19+
ANSIBLE_FORCE_COLOR: 1
20+
21+
steps:
22+
- name: Check out the codebase.
23+
uses: actions/checkout@v2
24+
with:
25+
path: ansible_collections/buluma/mac
26+
27+
- name: Set up Python 3.
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: '3.x'
31+
32+
- name: Install Ansible.
33+
run: pip3 install ansible-core
34+
35+
- name: Release to Ansible Galaxy.
36+
run: ansible-playbook -i 'localhost,' galaxy-deploy.yml -e "github_tag=${{ github.ref }}"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
roles/.DS_Store

.yamllint

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
line-length:
6+
max: 180
7+
level: warning
8+
9+
ignore: |
10+
.github/stale.yml

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2021 Jeff Geerling
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Mac Collection for Ansible
2+
3+
[![Apache-2.0 licensed][badge-license]][link-license]
4+
[![Galaxy Collection][badge-collection]][link-galaxy]
5+
[![CI][badge-gh-actions]][link-gh-actions]
6+
7+
This collection includes helpful Ansible roles and content to help with macOS automation. For a good example of the collection's usage, see the [Mac Dev Playbook](https://github.com/buluma/mac-dev-playbook).
8+
9+
Roles included in this collection (click on the link to see the role's README and documentation):
10+
11+
- `buluma.mac.homebrew` ([documentation](https://github.com/buluma/ansible-collection-mac/blob/master/roles/homebrew/README.md))
12+
- `buluma.mac.mas` ([documentation](https://github.com/buluma/ansible-collection-mac/blob/master/roles/mas/README.md))
13+
- `buluma.mac.dock` ([documentation](https://github.com/buluma/ansible-collection-mac/blob/master/roles/dock/README.md))
14+
15+
## Installation
16+
17+
Install via Ansible Galaxy:
18+
19+
```
20+
ansible-galaxy collection install buluma.mac
21+
```
22+
23+
Or include this collection in your playbook's `requirements.yml` file:
24+
25+
```
26+
---
27+
collections:
28+
- name: buluma.mac
29+
```
30+
31+
For a real-world example, see my [Mac Dev Playbook's requirements file](https://github.com/buluma/mac-dev-playbook/blob/master/requirements.yml).
32+
33+
### Role Requirements
34+
35+
Requires separate installation of the `elliotweiser.osx-command-line-tools` role. Because Ansible collections are not able to depend on roles, you will need to make sure that role is installed either by manually installing it with the `ansible-galaxy` command, or adding it under the `roles` section of your `requirements.yml` file:
36+
37+
```yaml
38+
---
39+
roles:
40+
- name: elliotweiser.osx-command-line-tools
41+
42+
collections:
43+
- name: buluma.mac
44+
```
45+
46+
## Usage
47+
48+
Here's an example playbook which installs some Mac Apps (assuming you are signed into the App Store), CLI tools via Homebrew, and Cask Apps using Homebrew:
49+
50+
```yaml
51+
- hosts: localhost
52+
connection: local
53+
gather_facts: false
54+
55+
vars:
56+
mas_installed_app_ids:
57+
- 424389933 # Final Cut Pro
58+
- 497799835 # Xcode
59+
60+
homebrew_installed_packages:
61+
- node
62+
- nvm
63+
- redis
64+
- ssh-copy-id
65+
- pv
66+
67+
homebrew_cask_apps:
68+
- docker
69+
- firefox
70+
- google-chrome
71+
- vlc
72+
73+
roles:
74+
- buluma.mac.homebrew
75+
- buluma.mac.mas
76+
```
77+
78+
For a real-world usage example, see my [Mac Dev Playbook](https://github.com/buluma/mac-dev-playbook).
79+
80+
See the full documentation for each role in the role's README, linked above.
81+
82+
## License
83+
84+
Apache-2.0
85+
86+
## Author
87+
88+
This collection was created by [Michael Buluma](https://buluma.github.io).
89+
90+
[badge-gh-actions]: https://github.com/buluma/ansible-collection-mac/workflows/CI/badge.svg?event=push
91+
[link-gh-actions]: https://github.com/buluma/ansible-collection-mac/actions?query=workflow%3ACI
92+
[badge-collection]: https://img.shields.io/badge/collection-buluma.mac-blue
93+
[link-galaxy]: https://galaxy.ansible.com/buluma/mac
94+
[badge-license]: https://img.shields.io/github/license/buluma/ansible-collection-mac.svg
95+
[link-license]: https://github.com/buluma/ansible-collection-mac/blob/master/LICENSE
96+
[badge-gh-actions]: https://github.com/buluma/ansible-role-homebrew/workflows/CI/badge.svg?event=push

0 commit comments

Comments
 (0)