Giter Club home page Giter Club logo

Comments (5)

geerlingguy avatar geerlingguy commented on July 24, 2024

AttributeError: 'NoneType' object has no attribute 'version' usually either means your Ansible version is too old (2.9 or later is recommended), or your Python version is too old (3.6 or later is recommended)β€”most likely the latter.

from ansible-collection-mac.

zharbour avatar zharbour commented on July 24, 2024

Here are the relevant versions on the node executing the playbook

% ansible --version
ansible [core 2.11.5]
  config file = None
  configured module search path = ['/Users/administrator/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/administrator/Library/Python/3.8/lib/python/site-packages/ansible
  ansible collection location = /Users/administrator/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/administrator/Library/Python/3.8/bin/ansible
  python version = 3.8.2 (default, Apr  8 2021, 23:19:18) [Clang 12.0.5 (clang-1205.0.22.9)]
  jinja version = 3.0.2
  libyaml = True

from ansible-collection-mac.

geerlingguy avatar geerlingguy commented on July 24, 2024

@zharbour - It's weird, because in the playbook output, I'm seeing:

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals

Which seems to indicate when you run ansible-playbook it's picking up Python 2.7.

from ansible-collection-mac.

zharbour avatar zharbour commented on July 24, 2024

Figured it out.

Looking at the traceback it is running on the remote machine. File "/Users/anka/.ansible/... is in the anka userspace, which only exists on the VM. The anka user is the default user created by the anka CLI when creating VMs.

I opened a session on the VM and tried running python3

$ python3
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.

Looks like there are no command line tools on a fresh VM. Installed that.

$ softwareupdate -i "Command Line Tools for Xcode-13.0"
Software Update Tool

Finding available software

Downloaded Command Line Tools for Xcode
Installing Command Line Tools for Xcode
Done with Command Line Tools for Xcode
Done.

Python3 is working

$ python3
Python 3.8.9 (default, Aug 21 2021, 15:53:23)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

And I ran the playbook again to see everything running smoothly.

PLAY RECAP ******************************************************************************************************************************************************************************
127.0.0.1                  : ok=15   changed=6    unreachable=0    failed=0    skipped=8    rescued=0    ignored=0

Reviewing everything a final time, I noticed this:

playbook.yml

---
- name: Golden image configuration
  hosts: packer

  vars:
    homebrew_installed_packages:
      - git
      - openjdk@8

  roles:
    - geerlingguy.mac.homebrew

requirements.yml

---
roles:
  - name: elliotweiser.osx-command-line-tools

collections:
  - name: geerlingguy.mac

I did not add elliotweiser.osx-command-line-tools to the playbook roles. I was under the impression that your collection would run it as a dependency, but that's not how it works as I'm now finding out. I'm new to ansible, sorry about that.

from ansible-collection-mac.

geerlingguy avatar geerlingguy commented on July 24, 2024

I was under the impression that your collection would run it as a dependency, but that's not how it works as I'm now finding out.

Yeah... unfortunately when they built collections, they decided roles were some sort of weird legacy thing and thought people would never build collections that would depend on roles. Grr.

from ansible-collection-mac.

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.