Skip to content

Instantly share code, notes, and snippets.

@mrlesmithjr
Last active January 21, 2025 16:34
Show Gist options
  • Save mrlesmithjr/f3c15fdd53020a71f55c2032b8be2eda to your computer and use it in GitHub Desktop.
Save mrlesmithjr/f3c15fdd53020a71f55c2032b8be2eda to your computer and use it in GitHub Desktop.

Revisions

  1. mrlesmithjr revised this gist Feb 8, 2020. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions ansible-macos-homebrew-packages.yml
    Original file line number Diff line number Diff line change
    @@ -80,9 +80,7 @@
    - not install_homebrew_if_missing

    - name: Installing Homebrew
    shell: >
    /usr/bin/ruby -e \
    "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    shell: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    when:
    - not homebrew_check.stat.exists
    - install_homebrew_if_missing
  2. mrlesmithjr revised this gist Feb 8, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ansible-macos-homebrew-packages.yml
    Original file line number Diff line number Diff line change
    @@ -80,7 +80,7 @@
    - not install_homebrew_if_missing

    - name: Installing Homebrew
    command: >
    shell: >
    /usr/bin/ruby -e \
    "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    when:
  3. mrlesmithjr revised this gist Feb 8, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ansible-macos-homebrew-packages.yml
    Original file line number Diff line number Diff line change
    @@ -82,7 +82,7 @@
    - name: Installing Homebrew
    command: >
    /usr/bin/ruby -e \
    $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)
    "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    when:
    - not homebrew_check.stat.exists
    - install_homebrew_if_missing
  4. mrlesmithjr revised this gist Feb 8, 2020. 1 changed file with 84 additions and 75 deletions.
    159 changes: 84 additions & 75 deletions ansible-macos-homebrew-packages.yml
    Original file line number Diff line number Diff line change
    @@ -4,110 +4,119 @@
    become: false
    vars:
    brew_cask_packages:
    - 'atom'
    - 'docker'
    - 'dropbox'
    - 'firefox'
    - 'google-chrome'
    - 'google-drive'
    - 'google-hangouts'
    - 'iterm2'
    - 'keepassx'
    - 'kodi'
    - 'lastpass'
    - 'macvim'
    - 'royal-tsx'
    - 'skype'
    - 'slack'
    - 'sling'
    - 'spotify'
    - 'sublime-text'
    - 'vagrant'
    - 'vagrant-manager'
    - 'virtualbox'
    - 'virtualbox-extension-pack'
    - 'visual-studio-code'
    - 'vmware-fusion'
    - atom
    - docker
    - dropbox
    - firefox
    - google-chrome
    - google-drive
    - google-hangouts
    - iterm2
    - keepassx
    - kodi
    - lastpass
    - macvim
    - royal-tsx
    - skype
    - slack
    - sling
    - spotify
    - sublime-text
    - vagrant
    - vagrant-manager
    - virtualbox
    - virtualbox-extension-pack
    - visual-studio-code
    - vmware-fusion
    brew_packages:
    - 'autoconf'
    - 'bash-completion'
    - 'boot2docker'
    - 'consul'
    - 'docker-compose'
    - 'docker-machine'
    - 'doxygen'
    - 'git'
    - 'git-lfs'
    - 'go'
    - 'jq'
    - 'nmap'
    - 'nomad'
    - 'openssl'
    - 'packer'
    - 'pyenv'
    - 'python'
    - 'rancher-compose'
    - 'rbenv'
    - 'ruby-build'
    - 'ssh-copy-id'
    - 'terraform'
    - 'terraform-inventory'
    - 'terraform-provisioner-ansible'
    - 'tmux'
    - 'tree'
    - 'vault'
    - 'wget'
    - 'zsh'
    - 'zsh-syntax-highlighting'
    - autoconf
    - bash-completion
    - boot2docker
    - consul
    - docker-compose
    - docker-machine
    - doxygen
    - git
    - git-lfs
    - go
    - jq
    - nmap
    - nomad
    - openssl
    - packer
    - pyenv
    - python
    - rancher-compose
    - rbenv
    - ruby-build
    - ssh-copy-id
    - terraform
    - terraform-inventory
    - terraform-provisioner-ansible
    - tmux
    - tree
    - vault
    - wget
    - zsh
    - zsh-syntax-highlighting
    install_homebrew_if_missing: false
    # python_modules:
    # - 'configparser'
    # - 'pylint'
    # - 'virtualenv'
    # - configparser
    # - pylint
    # - virtualenv
    upgrade_homebrew_packages: false

    pre_tasks:
    - name: Ensuring Homebrew Is Installed
    stat:
    path: "/usr/local/bin/brew"
    register: "homebrew_check"
    path: /usr/local/bin/brew
    register: homebrew_check

    - name: Fail If Homebrew Is Not Installed and install_homebrew_if_missing Is False
    fail:
    msg: "Homebrew is missing...Install from http://brew.sh/"
    when: >
    not homebrew_check.stat.exists and
    not install_homebrew_if_missing
    msg: Homebrew is missing...Install from http://brew.sh/
    when:
    - not homebrew_check.stat.exists
    - not install_homebrew_if_missing

    - name: Installing Homebrew
    command: '/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
    when: >
    not homebrew_check.stat.exists and
    install_homebrew_if_missing
    command: >
    /usr/bin/ruby -e \
    $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)
    when:
    - not homebrew_check.stat.exists
    - install_homebrew_if_missing

    tasks:
    - name: Updating Homebrew
    homebrew:
    update_homebrew: true
    when: homebrew_check.stat.exists

    - name: Installing Homebrew Packages
    - name: Upgrading Homebrew Packages
    homebrew:
    name: "{{ item }}"
    state: "present"
    upgrade_all: "{{ upgrade_homebrew_packages }}"
    with_items: '{{ brew_packages }}'
    register: result
    until: result is successful
    when: homebrew_check.stat.exists

    - name: Installing Homebrew Cask Packages
    homebrew_cask:
    name: "{{ item }}"
    state: "present"
    with_items: '{{ brew_cask_packages }}'
    name: "{{ brew_cask_packages }}"
    state: present
    register: result
    until: result is successful
    when: homebrew_check.stat.exists

    - name: Installing Homebrew Packages
    homebrew:
    name: "{{ brew_packages }}"
    state: present
    register: result
    until: result is successful
    when: homebrew_check.stat.exists
    # - name: Installing Python Modules
    # pip:
    # name: "{{ item }}"
    # state: "present"
    # state: present
    # with_items: '{{ python_modules }}'
  5. mrlesmithjr revised this gist Nov 12, 2016. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion ansible-macos-homebrew-packages.yml
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    ---
    - name: Install MacOS Homebrew Packages
    - name: Install MacOS Packages
    hosts: localhost
    become: false
    vars:
    @@ -16,6 +16,7 @@
    - 'kodi'
    - 'lastpass'
    - 'macvim'
    - 'royal-tsx'
    - 'skype'
    - 'slack'
    - 'sling'
    @@ -59,6 +60,10 @@
    - 'zsh'
    - 'zsh-syntax-highlighting'
    install_homebrew_if_missing: false
    # python_modules:
    # - 'configparser'
    # - 'pylint'
    # - 'virtualenv'
    upgrade_homebrew_packages: false

    pre_tasks:
    @@ -100,3 +105,9 @@
    state: "present"
    with_items: '{{ brew_cask_packages }}'
    when: homebrew_check.stat.exists

    # - name: Installing Python Modules
    # pip:
    # name: "{{ item }}"
    # state: "present"
    # with_items: '{{ python_modules }}'
  6. mrlesmithjr revised this gist Nov 11, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions ansible-macos-homebrew-packages.yml
    Original file line number Diff line number Diff line change
    @@ -20,10 +20,12 @@
    - 'slack'
    - 'sling'
    - 'spotify'
    - 'sublime-text'
    - 'vagrant'
    - 'vagrant-manager'
    - 'virtualbox'
    - 'virtualbox-extension-pack'
    - 'visual-studio-code'
    - 'vmware-fusion'
    brew_packages:
    - 'autoconf'
  7. mrlesmithjr created this gist Nov 11, 2016.
    100 changes: 100 additions & 0 deletions ansible-macos-homebrew-packages.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,100 @@
    ---
    - name: Install MacOS Homebrew Packages
    hosts: localhost
    become: false
    vars:
    brew_cask_packages:
    - 'atom'
    - 'docker'
    - 'dropbox'
    - 'firefox'
    - 'google-chrome'
    - 'google-drive'
    - 'google-hangouts'
    - 'iterm2'
    - 'keepassx'
    - 'kodi'
    - 'lastpass'
    - 'macvim'
    - 'skype'
    - 'slack'
    - 'sling'
    - 'spotify'
    - 'vagrant'
    - 'vagrant-manager'
    - 'virtualbox'
    - 'virtualbox-extension-pack'
    - 'vmware-fusion'
    brew_packages:
    - 'autoconf'
    - 'bash-completion'
    - 'boot2docker'
    - 'consul'
    - 'docker-compose'
    - 'docker-machine'
    - 'doxygen'
    - 'git'
    - 'git-lfs'
    - 'go'
    - 'jq'
    - 'nmap'
    - 'nomad'
    - 'openssl'
    - 'packer'
    - 'pyenv'
    - 'python'
    - 'rancher-compose'
    - 'rbenv'
    - 'ruby-build'
    - 'ssh-copy-id'
    - 'terraform'
    - 'terraform-inventory'
    - 'terraform-provisioner-ansible'
    - 'tmux'
    - 'tree'
    - 'vault'
    - 'wget'
    - 'zsh'
    - 'zsh-syntax-highlighting'
    install_homebrew_if_missing: false
    upgrade_homebrew_packages: false

    pre_tasks:
    - name: Ensuring Homebrew Is Installed
    stat:
    path: "/usr/local/bin/brew"
    register: "homebrew_check"

    - name: Fail If Homebrew Is Not Installed and install_homebrew_if_missing Is False
    fail:
    msg: "Homebrew is missing...Install from http://brew.sh/"
    when: >
    not homebrew_check.stat.exists and
    not install_homebrew_if_missing
    - name: Installing Homebrew
    command: '/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
    when: >
    not homebrew_check.stat.exists and
    install_homebrew_if_missing
    tasks:
    - name: Updating Homebrew
    homebrew:
    update_homebrew: true
    when: homebrew_check.stat.exists

    - name: Installing Homebrew Packages
    homebrew:
    name: "{{ item }}"
    state: "present"
    upgrade_all: "{{ upgrade_homebrew_packages }}"
    with_items: '{{ brew_packages }}'
    when: homebrew_check.stat.exists

    - name: Installing Homebrew Cask Packages
    homebrew_cask:
    name: "{{ item }}"
    state: "present"
    with_items: '{{ brew_cask_packages }}'
    when: homebrew_check.stat.exists