Coder Social home page Coder Social logo

Comments (7)

geerlingguy avatar geerlingguy commented on May 13, 2024

@z00m1n - What version of Ansible are you running? Also, which task does this error come up on? It could be an improperly set variable, or it could be an issue with an older Ansible version.

from ansible-role-homebrew.

z00m1n avatar z00m1n commented on May 13, 2024

General setup

The Ansible controller host is a physical MacBook Pro (Retina, 13-inch, Mid 2014) running macOS Sierra 10.12.1 called ansible-control-host in here; the machine being controlled is a VMware Fusion Version 8.5.3 (4696910) virtual machine also running macOS Sierra 10.12.1 called vm-osx-1012. I am working on the controller as username; ansible-control-host connects to vm-osx-1012 via SSH as user ansible with password-less sudo privileges; SSH keys are properly set up and work OK.

On ansible-control-host, I've installed a small number of tools using brew; however, there's no newer version of git installed, so that's still the version that came with the system:

ansible-control-host:ansible username$ uname -a
Darwin ansible-control-host.domain 16.1.0 Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64

ansible-control-host:ansible username$ brew list
ack		cmake		gdbm		oniguruma	python		sqlite
ansible		coreutils	jq		openssl		readline	uncrustify
bash		findutils	libyaml		[email protected]	shellcheck

ansible-control-host:ansible username$ which python
/usr/local/bin/python
ansible-control-host:ansible username$ python --version
Python 2.7.12

ansible-control-host:ansible username$ which git
/usr/bin/git
ansible-control-host:ansible username$ git --version
git version 2.9.3 (Apple Git-75)

What version of Ansible are you running ?

I've installed Ansible using Homebrew; AFAICT, everything is at the latest released version:

ansible-control-host:ansible username$ brew upgrade && brew update && brew doctor
Already up-to-date.
Your system is ready to brew.

ansible-control-host:ansible username$ ansible --version
ansible 2.2.0.0
  config file = <project folder>/ansible/ansible.cfg
  configured module search path = Default w/o overrides

Also, I've installed geerlingguy.homebrew from the galaxy:

ansible-control-host:~ username$ ansible-galaxy install geerlingguy.homebrew
- downloading role 'homebrew', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ ...
  ... ansible-role-homebrew/archive/2.1.0.tar.gz
- extracting geerlingguy.homebrew to /usr/local/etc/ ...
  ... ansible/roles/geerlingguy.homebrew
- geerlingguy.homebrew was installed successfully

The vm-osx-1012 target machine is a fresh system with nothing installed apart from Xcode (from the AppStore), so all tools (git, python, etc.) involved are those that come with the system.

Also, which task does this error come up on ?

Ensure Homebrew is installed, as mentioned in the subject; I should have made that clearer. Full output, somewhat wrapped for readability:

ansible-control-host:ansible username$ ansible-playbook ci-infrastructure.yml --limit vm-osx-1012 --tags debug

PLAY [Install brew] ************************************************************

TASK [setup] *******************************************************************
ok: [vm-osx-1012]

TASK [geerlingguy.homebrew : Get current account's username.] ******************
[DEPRECATION WARNING]: always_run is deprecated. Use check_mode = no instead..
This feature will be removed in version 2.4. Deprecation 
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
ok: [vm-osx-1012]

TASK [geerlingguy.homebrew : Ensure Homebrew parent directory has correct permissions.] ***
changed: [vm-osx-1012]

TASK [geerlingguy.homebrew : Ensure Homebrew directory exists.] ****************
changed: [vm-osx-1012]

TASK [geerlingguy.homebrew : Ensure Homebrew is installed.] ********************
fatal: [vm-osx-1012]: FAILED! => {"changed": false, "failed": true, "module_stderr":
   "Shared connection to vm-osx-1012 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n
   File \"/var/folders/jm/3n8_ksbs4fz49dlz_mlchtgw0000gn/T/ansible_6nEutM/ansible_module_git.py\", line 1040,
     in <module>\r\n    main()\r\n
   File \"/var/folders/jm/3n8_ksbs4fz49dlz_mlchtgw0000gn/T/ansible_6nEutM/ansible_module_git.py\", line 923,
     in main\r\n
       if depth is not None and git_version_used < LooseVersion('1.9.1'):\r\n
   File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/version.py\", line 296,
     in __cmp__\r\n    return cmp(self.version, other.version)\r\nAttributeError:
	   'NoneType' object has no attribute 'version'\r\n", "msg": "MODULE FAILURE"}
	to retry, use: --limit @<path to folder>/ci-infrastructure.retry

PLAY RECAP *********************************************************************
vm-osx-1012                : ok=4    changed=2    unreachable=0    failed=1   

from ansible-role-homebrew.

geerlingguy avatar geerlingguy commented on May 13, 2024

Hmm... I wonder—since the failed task shows something about the Git version comparison before failing—if Ansible can't see a valid/usable Git binary. When you run the playbook, are you running it on localhost, or on a machine controlled via SSH? If via SSH, can you log into that machine and run which git as well?

If Git's not installed, you should install it/configure it so it's in the $PATH prior to this role.

It could be something else... but that seems the most logical thing to check next.

Also, can you check the Python version on the controlled machine?

from ansible-role-homebrew.

z00m1n avatar z00m1n commented on May 13, 2024

I have updated my previous comment to list the required information more clearly.

The target system is a really fresh macOS Sierra installation where no changes were made (apart from ansible user setup) and no software was installed apart from Xcode. Therefore, I had expected git and python to be the versions that came with the system. However, getting the respective versions of git and python on vm-osx-1012 shows the cause of the problem:

ansible-control-host:~ username$ ssh vm-osx-1012
  ...
vm-osx-1012:~ ansible$ which python
/usr/bin/python
vm-osx-1012:~ ansible$ python --version
Python 2.7.10

vm-osx-1012:~ ansible$ which git
/usr/bin/git
vm-osx-1012:~ ansible$ git --version


Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.


vm-osx-1012:~ ansible$ sudo git --version


You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.

Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'

Apple Inc.

Xcode and Apple SDKs Agreement

( ... long text with ASCII codes (?) interspersed, e.g. <E2><80><9D> ... )
(hit q)

By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel] agree

You can view the license agreements in Xcode's About Box, or at /Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf

git version 2.9.3 (Apple Git-75)

The playbook now runs OK:

ansible-control-host:ansible username$ ansible-playbook ci-infrastructure.yml --limit vm-osx-1012 --tags debug

PLAY [Install brew] ************************************************************

TASK [setup] *******************************************************************
ok: [vm-osx-1012]

TASK [geerlingguy.homebrew : Get current account's username.] ******************
[DEPRECATION WARNING]: always_run is deprecated. Use check_mode = no instead..
This feature will be removed in version 2.4. Deprecation 
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
ok: [vm-osx-1012]

TASK [geerlingguy.homebrew : Ensure Homebrew parent directory has correct permissions.] ***
ok: [vm-osx-1012]

TASK [geerlingguy.homebrew : Ensure Homebrew directory exists.] ****************
ok: [vm-osx-1012]

TASK [geerlingguy.homebrew : Ensure Homebrew is installed.] ********************
changed: [vm-osx-1012]

TASK [geerlingguy.homebrew : Ensure proper permissions on homebrew_brew_bin_path dirs.] ***
changed: [vm-osx-1012]

TASK [geerlingguy.homebrew : Ensure proper ownership on homebrew_install_path subdirs.] ***
ok: [vm-osx-1012]

TASK [geerlingguy.homebrew : Check if homebrew binary is already in place.] ****
ok: [vm-osx-1012]

TASK [geerlingguy.homebrew : Symlink brew to homebrew_brew_bin_path.] **********
changed: [vm-osx-1012]

TASK [geerlingguy.homebrew : Force update brew after installation.] ************
changed: [vm-osx-1012]

TASK [geerlingguy.homebrew : Ensure configured taps are tapped.] ***************
ok: [vm-osx-1012] => (item=homebrew/core)
changed: [vm-osx-1012] => (item=caskroom/cask)

TASK [geerlingguy.homebrew : Ensure configured homebrew packages are installed.] ***
changed: [vm-osx-1012] => (item=[u'ant', u'cmake', u'jq'])

TASK [geerlingguy.homebrew : Upgrade all homebrew packages (if configured).] ***
skipping: [vm-osx-1012]

TASK [geerlingguy.homebrew : Get list of apps installed with cask.] ************
[DEPRECATION WARNING]: always_run is deprecated. Use check_mode = no instead..
This feature will be removed in version 2.4. Deprecation 
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
ok: [vm-osx-1012]

TASK [geerlingguy.homebrew : Install configured cask applications.] ************
changed: [vm-osx-1012] => (item=firefox)

TASK [geerlingguy.homebrew : Check for Brewfile.] ******************************
ok: [vm-osx-1012]

TASK [geerlingguy.homebrew : Install from Brewfile.] ***************************
skipping: [vm-osx-1012]

PLAY RECAP *********************************************************************
vm-osx-1012                : ok=15   changed=7    unreachable=0    failed=0   

Verify brew and the packages were installed correctly:

vm-osx-1012:~ ansible$ brew doctor
Your system is ready to brew.

vm-osx-1012:~ ansible$ which ant cmake jq
/usr/local/bin/ant
/usr/local/bin/cmake
/usr/local/bin/jq

vm-osx-1012:~ ansible$ ant -version
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
No Java runtime present, requesting install.
2016-12-12 01:04:24.577 java[431:2782] JLRequestRuntimeInstall: Error calling: CFMessagePortCreateRemote

vm-osx-1012:~ ansible$ cmake -version
cmake version 3.7.1

vm-osx-1012:~ ansible$ jq --version
jq-1.5

ant can't find a working Java installation, but that's beyond the scope of the problem at hand.

Conclusion

For the playbook to work on a brand new macOS Sierra installation, the Xcode license agreements must somehow be agreed to as part of homebrew setup. According to this SO answer, this could possibly be as simple as

sudo xcodebuild -license accept

I will try to add a corresponding task here now and submit a pull request if I'm successful.

from ansible-role-homebrew.

geerlingguy avatar geerlingguy commented on May 13, 2024

@z00m1n - Ah, you're correct. If you run the playbook locally (on the same machine Ansible's running on), then the prompt actually pipes through correctly, and you're prompted to agree in the terminal during the playbook run.

Maybe we can fix this through documentation, or adding an extra step (just to ensure it's done) in the install instructions.

from ansible-role-homebrew.

elliotweiser avatar elliotweiser commented on May 13, 2024

I think this has been fixed in #53

from ansible-role-homebrew.

geerlingguy avatar geerlingguy commented on May 13, 2024

Correct! This shouldn't be an issue anymore, after #53 was merged. Thanks!

from ansible-role-homebrew.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.