Using Ansible to Manage install and update Apple OSX DHCP clients
-
Okay so this is my existing tree.
/etc/ansible/ ├── ansible.cfg ├── apple.yml ├── clients ├── default.config.yml ├── hosts ├── main.yml ├── playbook-skeleton │ ├── ansible.cfg │ ├── group_vars │ │ └── README │ ├── inventory │ │ ├── apple_workstations │ │ └── dev │ ├── library │ │ └── README │ ├── Makefile │ └── roles │ └── requirements.yml ├── requirements.yml ├── roles │ ├── ansible-role-homebrew │ │ ├── defaults │ │ │ └── main.yml │ │ ├── handlers │ │ │ └── main.yml │ │ ├── LICENSE │ │ ├── meta │ │ │ └── main.yml │ │ ├── README.md │ │ ├── requirements.yml │ │ ├── tasks │ │ │ ├── main.yml │ │ │ └── playbook.yml │ │ └── tests │ │ ├── local-testing │ │ │ ├── playbook.yml │ │ │ └── README.md │ │ └── test.yml │ ├── elliotweiser.osx-command-line-tools │ │ ├── ansible.cfg │ │ ├── CONTRIBUTING.md │ │ ├── defaults │ │ │ └── main.yml │ │ ├── handlers │ │ │ └── main.yml │ │ ├── LICENSE │ │ ├── meta │ │ │ └── main.yml │ │ ├── molecule │ │ │ ├── default │ │ │ │ ├── create.yml │ │ │ │ ├── destroy.yml │ │ │ │ ├── molecule.yml │ │ │ │ └── prepare.yml │ │ │ ├── elcapitan.sh │ │ │ ├── highsierra.sh │ │ │ ├── mojave.sh │ │ │ ├── sierra.sh │ │ │ ├── unset.sh │ │ │ └── yosemite.sh │ │ ├── README.md │ │ ├── tasks │ │ │ └── main.yml │ │ ├── tests │ │ │ ├── inventory │ │ │ ├── playbook.yml │ │ │ ├── test_default.py │ │ │ ├── test-requirements.txt │ │ │ └── version_check.py │ │ └── vars │ │ └── main.yml │ └── geerlingguy.homebrew │ ├── defaults │ │ └── main.yml │ ├── handlers │ │ └── main.yml │ ├── LICENSE │ ├── meta │ │ └── main.yml │ ├── README.md │ ├── requirements.yml │ ├── tasks │ │ ├── main.yml │ │ └── playbook.yml │ └── tests │ ├── local-testing │ │ ├── playbook.yml │ │ └── README.md │ └── test.yml └── ssh.sh 29 directories, 61 files
The
make
command wasn't found so I installedmake
. Runningmake roles
from within the/etc/ansible/playbook-skeleton
I gotmake roles git clean -fdx roles ansible-galaxy install -r roles/requirements.yml - extracting ansible-role-homebrew to /etc/ansible/playbook-skeleton/roles/ansible-role-homebrew - ansible-role-homebrew was installed successfully - adding dependency: elliotweiser.osx-command-line-tools - downloading role 'osx-command-line-tools', owned by elliotweiser - downloading role from https://github.com/elliotweiser/ansible-osx-command-line-tools/archive/2.2.1.tar.gz - extracting elliotweiser.osx-command-line-tools to /etc/ansible/playbook-skeleton/roles/elliotweiser.osx-command-line-tools - elliotweiser.osx-command-line-tools (2.2.1) was installed successfully
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
Okay so this is my existing tree.
The
make
command wasn't found so I installedmake
. Runningmake roles
from within the/etc/ansible/playbook-skeleton
I gotmake roles
git clean -fdx roles
ansible-galaxy install -r roles/requirements.yml- extracting ansible-role-homebrew to /etc/ansible/playbook-skeleton/roles/ansible-role-homebrew
- ansible-role-homebrew was installed successfully
- adding dependency: elliotweiser.osx-command-line-tools
- downloading role 'osx-command-line-tools', owned by elliotweiser
- downloading role from https://github.com/elliotweiser/ansible-osx-command-line-tools/archive/2.2.1.tar.gz
- extracting elliotweiser.osx-command-line-tools to /etc/ansible/playbook-skeleton/roles/elliotweiser.osx-command-line-tools
- elliotweiser.osx-command-line-tools (2.2.1) was installed successfully
I think your missing my point. Don't use /etc/ansible.
Clone the repo somewhere in your home directory that you store your projects and run everything from there.
-
@stacksofplates eh. . .
Can I just use mv at this point?
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
@stacksofplates eh. . .
Can I just use mv at this point?
I mean you can but that's the reason this is all in a repo, so you can just check it out anywhere.
-
Plus your tree doesn't have the inventory directory which the ansible.cfg file is looking for.
-
@stacksofplates said in Using Ansible to Manage install and update Apple OSX DHCP clients:
Plus your tree doesn't have the inventory directory which the ansible.cfg file is looking for.
pwd /home/ansi/playbook-skeleton # tree . ├── ansible.cfg ├── group_vars │ └── README ├── inventory │ ├── apple_workstations │ └── dev ├── library │ └── README ├── Makefile └── roles └── requirements.yml 4 directories, 7 files
-
Hopefully that's better?
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
Hopefully that's better?
Yeah. I mean I'm not trying to make you do it certain way, but if you want to use that skeleton, it's looking for things in a certain directory unless you modify it.
-
So I'd put your playbook in
/etc/ansi/playbook-skeleton
and then you can runmake roles
to install the role (after you add it to the requirements.yml of course). -
@stacksofplates said in Using Ansible to Manage install and update Apple OSX DHCP clients:
So I'd put your playbook in
/etc/ansi/playbook-skeleton
and then you can runmake roles
to install the role (after you add it to the requirements.yml of course).okay so everything is in
/home/ansi/playbook-skeleton
With that, I need to make a playbook to do brew stuff, right?
Any pointers on where to go?
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
@stacksofplates said in Using Ansible to Manage install and update Apple OSX DHCP clients:
So I'd put your playbook in
/etc/ansi/playbook-skeleton
and then you can runmake roles
to install the role (after you add it to the requirements.yml of course).okay so everything is in
/home/ansi/playbook-skeleton
With that, I need to make a playbook to do brew stuff, right?
Any pointers on where to go?
What was in your apple.yml playbook?
-
@stacksofplates Nothing now, I blew it all away.
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
@stacksofplates Nothing now, I blew it all away.
Ok. So here https://docs.ansible.com/ansible/latest/user_guide/playbooks.html has pretty much everything you could want, but for a short start here's what I would do:
--- - name: Set up Macs hosts: apple_workstations user: dustin become: true tasks: - include_role: name: role-name
That should be a good simple start. You can pass any variables to the role by doing this:
tasks: - include_role: name: role-name vars: key: value
-